2010-02-23 51 views
1

有沒有人看到這個:??沒有jgem命令可以工作嗎?雖然jruby -S gem list確實工作。我使用JRuby 1.3.1和太陽的Java6 JREjruby ruby​​gems更新休息jgem

[email protected]:/usr/local: jgem --version 
1.3.3 

[email protected]:/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 

[email protected]:/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

注意,這似乎只在Linux(不OSX)發生,我通過更換線固定它在jgem腳本的頂部:

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

#!/usr/bin/env jruby 
0

鑑於在J偕腳本第8行是紅寶石的第一行(其餘的都是評論/空格),我要說的東西打破了(J)紅寶石在你的外殼。

嘗試開始一個新的shell會話,看看它是否只是暫時的。

嘗試這些:

jruby -v

jirb

等等

+0

布拉德@測試:〜$ jruby的-v 的jruby 1.3.1(紅寶石1.8.6p287)(2009-06-15 2fd6c3d)(爪哇的HotSpot(TM)客戶機VM 1.6.0_07)[I386-java的] brad @ test:〜$ jirb irb(main):001:0> exit Both work。另外,jruby的確可以工作,因爲jruby -S語法工作正常,只是不是jgem – brad 2010-02-25 14:40:29

+0

呃,好吧,我不能格式化這顯然,但它表明,這兩個命令的工作。這是在Linux上的btw。我很猶豫要在OSX上做更新,因爲我喜歡使用jgem,而且我有1.3.5這是我真正需要檢查這些文件的 – brad 2010-02-25 14:41:49

+0

,我注意到設置解釋器的最上面一行是不同的。 1.3.6有#!/ usr/local/jruby/bin/jruby和1.3.5有#!/ usr/bin/env jruby我想知道爲什麼區別?顯然1.3.6的版本不能正確加載紅寶石。我對shell腳本不太瞭解,不知道發生了什麼。使用1.3.5的#!/ usr/bin/env jruby替換1.3.6的解釋器行。 – brad 2010-02-25 14:49:38

2

有一個Shell限制:不能在家當線條中使用的shell腳本,而且由於JRuby的啓動器(是)外殼爲基礎,打破東西。好消息是,JRuby現在擁有本地啓動器(對於windows,linux,macos),並且使用它代替shell啓動器將允許將它放在沒有問題的shebang行中。