Closed camertron closed 11 years ago
Thanks Cameron, looks great but generally it would be even better if would could avoid the Gem dependency inside Rhino's code ... maybe using Rhino::VERSION
should do the trick ?
That would be fine except that Rhino::VERSION
is not in sync with the version of the jar. In the current release, for example, Rhino::VERSION
is 2.0.2 and the version of the jar is 1.7.4. I agree that having a dependency on Gem
isn't really desirable... what about defining another constant, like Rhino::JAR_VERSION
? The code might look like this:
module Rhino
JAR_VERSION = "1.7.4"
version_parts = JAR_VERSION.split(".")
current_dir = File.dirname(__FILE__)
jar_file = "rhino-#{version_parts[0]}.#{version_parts[1]}R#{version_parts[2]}.jar"
JAR_PATH = File.expand_path(File.join(current_dir, "../../../../jar/#{jar_file}"))
end
Right, I'm sorry - of course I meant using the jar gem's version somehow - that code does seem better ... p.s. You can save a File.join if you pass the current_dir as a second arg to expand_path :)
Ok @kares, how does that look?
thanks - mixed the commit message from the first commit while basic the code on your second one into https://github.com/cowboyd/therubyrhino/commit/a3eeda48b291f208ae4d27248eb111425f196ec6 now, you mention it's quite an issue with a (warbled) .war - somehow I have not seen it (maybe cause of precompiling assets) or is there anything specific about your setup why one might not run into this (I'm asking due whether a 'new' therubyrhino_jar.gem release is necessary) ?
Hey @kares, I don't think there's anything special about my setup necessarily... I would appreciate a new gem release if you have a few spare minutes, but it's not critical.
@kares can we do a new gem release? I think I'm hitting this issue right now
2.0.3 ... enjoy!
In attempting to include therubyrhino in a compiled .jar file (using warbler), I ran into an issue with the
glob
call injar/rhino/jar_path.rb
. It seems thatglob
does not behave as expected inside a .jar file, and apparently also exhibits inconsistent behavior between JRE 6 and JRE 7. This pull request removes the glob and constructs the name of the jar by using the gem's version.