jruby ruby​​gems update break jgem

时间:2010-02-23 20:09:44

标签: rubygems jruby

有没有人见过这个:??没有jgem命令可以工作吗?虽然jruby -S gem list确实有用。我正在使用jruby 1.3.1和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

3 个答案:

答案 0 :(得分:3)

请注意,这似乎只发生在Linux(而非OSX)上我通过替换jgem脚本顶部的行来修复它:

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

#!/usr/bin/env jruby

答案 1 :(得分:2)

有一个shell限制:无法在shebang行中使用shell脚本,并且因为JRuby的启动器是基于shell的,所以会破坏它。好消息是JRuby现在有原生的启动器(用于windows,linux,macos),使用它而不是shell启动器可以将它放在shebang行中而没有任何问题。

答案 2 :(得分:0)

鉴于jgem脚本中的第8行是ruby的第一行(其余的是注释/空白),我会说你的shell中有一些东西破坏了(j)ruby。

尝试启动一个新的shell会话,看看它是否只是暂时的。

试试这些:

jruby -v

jirb

等...