Actually I think I figured it out. The gem install also has a bin dir, which is what gets loaded when you "load 'rake'". This actually kicks off the script.

I found the issue in JRuby, but I thought I'd confirm it with you:

The logic behind 'load' and 'require' in JRuby has long been identical, other than 'require' keeping a hash of loaded features. Both searched all load paths for the filename specified PLUS the filename specified followed by a series of possible extensions. It seems that the correct behavior is as follows:

- load only looks for the exact filename specified in the current load path, and does not attempt any additional extensions
- require will look for the exact filename if it has a .rb, .so, .dll, etc extension. Otherwise it will attempt to append .rb and load.

So based on this logic, given files testreq and testreq2.rb in the current dir:

- load 'testreq' will succeed
- load 'testreq2' will not succeed
- load 'testreq2.rb' will succeed
- require 'testreq' will not succeed
- require 'testreq2' will succeed
- require 'testreq2.rb' will succeed

Does this sound correct to you?

On 6/29/06, Charles O Nutter < [EMAIL PROTECTED]> wrote:
I'm trying to get Rake running well under JRuby today, and I'm having some trouble understanding how Rake actually starts up. I see the following in rake.rb:

if __FILE__ == $0 then
  Rake::Application.new.run
end

However, when running the "rake" script in Ruby or JRuby, __FILE__ and $0 never appear to be ==. Since the "rake" script itself only loads rake.rb, I'm confused how Rake actually starts running under Ruby proper. Could you tell me what I'm missing?

Under Ruby, logging __FILE__ and $0 from above:

"/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb"
"/usr/bin/rake"
<then expected Rake run output displays>

Under JRuby:

"/home/headius/workspace/jruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb"
"/home/headius/workspace/jruby/bin/rake"
<nothing happens>

--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ www.jruby.org
Application Architect @ www.ventera.com



--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ www.jruby.org
Application Architect @ www.ventera.com
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jruby-devel mailing list
Jruby-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jruby-devel

Reply via email to