On Tue, Nov 3, 2009 at 9:35 AM, Nick S. [email protected]
wrote:
On Mon, Nov 2, 2009 at 4:03 PM, Steve M. [email protected] wrote:
I’m trying to package some ruby code for running inside spring batch. I’m
using the spring dynamic language bean feature to load ruby classes from
files on the class path. The problem is these ruby files require other
files via File.dirname(FILE). That’s not working. What’s the best way
to package up a bunch of jruby code for running inside a java application,
such that the jruby files can require other jruby files?
Thanks,
Steve
Did Spring load Ruby scripts from a classpath? If so, I might have got
an error from the same reason.
What is the value of FILE? Even with FILE set to a file: URL
of a path inside a jar file, typical Rubyisms like you indicate should
be working. If you can illustrate what is failing, that would help;
there might be a bug. Also indicate what version of JRuby you’re
using. Some of the bugs related to file: URLs and paths have been
fixed in recent releases.
I haven’t figured out what’s wrong with that, but FILE doesn’t
work when a script is loaded from a classpath. For example, when I
set all necessary all classapths and load test/test_file.rb from the
classpath, evaluation failed because the error below at the line
“expect = File.read(FILE)[0…100]”:
Loaded suite -
Started
…E…
Finished in 2.153 seconds.
- Error:
test_file_url(TestFile):
Errno::ENOENT: No such file or directory - File not found - test_file.rb
test_file.rb:926:in initialize' test_file.rb:926:in
test_file_url’
57 tests, 293 assertions, 0 failures, 1 errors
However, when I read test_file.rb from an absolute path, it worked
well. This happens in trunk version as well. If this should work even
when scripts are loaded from classpath, there might be a bug.
-Yoko
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email