Issue Details (XML | Word | Printable)

Key: JRUBY-419
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Nick Sieger
Reporter: Nick Sieger
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JRuby

Experiments with direct complete-jar-launched utilities

Created: 07/Jan/07 08:38 PM   Updated: 30/Apr/07 03:12 AM
Component/s: None
Affects Version/s: JRuby 0.9.2
Fix Version/s: JRuby 0.9.8

Time Tracking:
Not Specified

Issue Links:
dependent
 


 Description  « Hide
This ticket is a placeholder for some work on the complete jar to allow extraction of a JRuby environment and direct launching of irb and gem. It features:
  • Extraction of a jruby directory footprint from a jruby-complete.jar. Run one of the following:
    java -jar jruby-complete.jar --command extract  # extracts to ~/.jruby
    java -jar jruby-complete.jar --command extract path/to/new/jruby/home
    

    The first command extracts the directory to a specified location, while the second extracts to jruby.home. Per JRUBY-418, jruby.home defaults to ~/.jruby if not specified as a system property.

  • Run irb directly from the jar.
    java -jar jruby-complete.jar --command irb
    
  • Run Rubygems' gem command directly from the jar. This will also perform an extraction if jruby.home does not exist, so that gem has a directory in which to place installed gems.
    java -jar jruby-complete.jar --command gem install rake
    

Note: this is only available with the maven-built form of jruby-complete.jar at the moment. To build yourself, cd to jruby/maven/jruby-complete.jar and type mvn install.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Charles Oliver Nutter added a comment - 08/Jan/07 02:38 AM
I like it a lot, but the command line is rather long. What about:

java -jar jruby-complete.jar -command=extract
java -jar jruby-complete.jar -command=irb
java -jar jruby-complete.jar -command=gem install rake

Or something similar? There could be a set of "known" commands and a way to register new ones (like for gem, rake, rails).


Nick Sieger added a comment - 08/Jan/07 10:51 AM
Absolutely. This was just the first pass, to get something working. I got a little nifty with the way the commands were invoked just so they could communicate a little bit of intent.

I like the -command idea quite a bit, and could be easy to implement. Are we ok with the idea of deviating from MRI command-line args? I assume so, as long as we don't override or change the meaning of existing args.


Nick Sieger added a comment - 11/Jan/07 08:56 AM
As of 2715, you can use "--command <script>" to run any script in $JRUBY_HOME/bin. "gem" and "irb/jirb" are also predefined if your jruby home doesn't contain any files yet. "extract" is available too, but will only really work if running from within the jruby-complete.jar.

Nick Sieger added a comment - 11/Jan/07 09:32 PM
Changed the description to reflect the implementation.

Aris Bartee added a comment - 12/Jan/07 08:38 AM
I really like playing with the "complete" jar version of jruby, Thanks man.

How do I tell it that my ".jruby" directory is not under my user account. I've set the environment variable JRUBY_HOME to where I'd like to go, but no dice.


Nick Sieger added a comment - 12/Jan/07 09:12 AM
You actually need to user the "jruby.home" system property. Either always pass it on the command line or create a simple script or alias:
java -Djruby.home=/dir/you/use -jar jruby-complete.jar ...