brad
brad

Reputation: 32355

jruby rubygems update breaks jgem

Has anyone seen this: ?? No jgem command works at all?? Though jruby -S gem list does work. I'm using jruby 1.3.1 and Sun Java6 jre

root@test:/usr/local: jgem --version  
1.3.3  

root@test:/usr/local: jgem update --system  
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.3.6
/usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:103:Warning: Gem::SourceIndex#search support for String patterns is deprecated
Updating RubyGems to 1.3.6
Installing RubyGems 1.3.6
RubyGems 1.3.6 installed  

root@test:/usr/local: jgem list  
/usr/local/jruby/bin/jgem: line 8: require: command not found
/usr/local/jruby/bin/jgem: line 9: require: command not found
/usr/local/jruby/bin/jgem: line 10: require: command not found
/usr/local/jruby/bin/jgem: line 12: required_version: command not found
/usr/local/jruby/bin/jgem: line 14: unless: command not found
/usr/local/jruby/bin/jgem: line 15: abort: command not found
/usr/local/jruby/bin/jgem: line 16: end: command not found
/usr/local/jruby/bin/jgem: line 18: args: command not found
/usr/local/jruby/bin/jgem: line 20: begin: command not found
/usr/local/jruby/bin/jgem: line 21: Gem::GemRunner.new.run: command not found
/usr/local/jruby/bin/jgem: line 22: rescue: command not found
/usr/local/jruby/bin/jgem: line 23: exit: e.exit_code: numeric argument required

Upvotes: 1

Views: 1731

Answers (3)

Vladimir Sizikov
Vladimir Sizikov

Reputation: 877

There is a shell limitation: inability to use shell scripts in shebang lines, and since JRuby's launcher is (was) shell-based, that breaks things. The good news is that JRuby now has native launcher (for windows, linux, macos), and using it instead of shell launcher would allow to put it in shebang lines with no problem.

Upvotes: 2

brad
brad

Reputation: 32355

Note that this only seemed to happen on Linux (not OSX) And I fixed it by replacing the line at the top of the jgem script from:

#!/mnt/java/jruby-1.4.0/bin/jruby

to

#!/usr/bin/env jruby

Upvotes: 3

Robert Brown
Robert Brown

Reputation: 11026

Given that line 8 in the jgem script is the first line of ruby (the rest are comments/blanks) I'd say something broke (j)ruby in your shell.

Try starting a new shell session and see if it's just transient.

Try these:

jruby -v

jirb

etc...

Upvotes: 0

Related Questions