Can't load and run the scripts (like gem or irb) from the jruby-complete.jar
----------------------------------------------------------------------------

                 Key: JRUBY-6066
                 URL: https://jira.codehaus.org/browse/JRUBY-6066
             Project: JRuby
          Issue Type: Bug
          Components: Launcher
    Affects Versions: JRuby 1.6.4
         Environment: OS X 10.7
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)

            Reporter: Thomas Dudziak
            Assignee: Thomas E Enebo


I am trying to find a way to run all jruby scripts with only java and the 
jruby-complete jar but that doesn't seem to work. For testing, I put a dummy 
'gem' script into the PATH before the system's ruby one:

$ cat /usr/local/bin/gem
#!/bin/bash
echo "No gem"

$ gem
No gem

I then tried different approaches to execute the gem script within the JAR:

$ java -jar jruby-complete-1.6.4.jar -S gem env
NoMethodError: undefined method `echo' for main:Object
  (root) at /usr/local/bin/gem:2

$ java -jar jruby-complete-1.6.4.jar -S 
'file:jruby-complete-1.6.4.jar!/META-INF/jruby.home/bin/gem' env
SyntaxError: file:jruby-complete-1.6.4.jar!/META-INF/jruby.home/bin/gem:1: no 
.<digit> floating literal anymore; put 0 before 
dotJRuby::Commands.file:jruby-complete-1.6.4.jar!/META-INF/jruby.home/bin/gem

$ java -jar jruby-complete-1.6.4.jar -S 
'file://jruby-complete-1.6.4.jar!/META-INF/jruby.home/bin/gem' env
SyntaxError: file://jruby-complete-1.6.4.jar!/META-INF/jruby.home/bin/gem:1: no 
.<digit> floating literal anymore; put 0 before 
dotJRuby::Commands.file://jruby-complete-1.6.4.jar!/META-INF/jruby.home/bin/gem

$ java -jar jruby-complete-1.6.4.jar 
'file://jruby-complete-1.6.4.jar!/META-INF/jruby.home/bin/gem' env
Error opening script file: jruby-complete-1.6.4.jar

$ java -Djruby.home=jruby-complete-1.6.4.jar -jar jruby-complete-1.6.4.jar -S 
gem env
NoMethodError: undefined method `echo' for main:Object
  (root) at /usr/local/bin/gem:2

$ java '-Djruby.home=file:jruby-complete-1.6.4.jar' -jar 
jruby-complete-1.6.4.jar -S gem env
NoMethodError: undefined method `echo' for main:Object
  (root) at /usr/local/bin/gem:2

$ java '-Djruby.home=file://jruby-complete-1.6.4.jar' -jar 
jruby-complete-1.6.4.jar -S gem env
NoMethodError: undefined method `echo' for main:Object
  (root) at /usr/local/bin/gem:2


The problem might be that RubyInstanceConfig.resolveScript does not actually 
check for jars before using JRubyFile.create despite the comment at the 
beginning of the file indicating otherwise. E.g. the second case matches my 
attempts to use jruby.home but fails with JRubyFile.create not supporting jars 
as the comment rightly points out.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to