English 中文(简体)
JRuby RubyGems 更新损坏了 jgem。
原标题:jruby rubygems update breaks jgem

有人看到这个了吗:?? 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
最佳回答

请注意,这似乎只是发生在Libert(而不是OSX)上。 并且,我确定,从以下几条文字中删除一条线:

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

到 (dào)

#!/usr/bin/env jruby
问题回答

有一个 shell 的限制:不能在 shebang 行中使用 shell 脚本,而且由于 JRuby 的启动器是(曾经是)基于 shell 的,这会破坏事情。好消息是,JRuby 现在有了本地启动器(适用于 Windows、Linux、macOS),使用它而不是 shell 启动器就可以毫无问题地将它放在 shebang 行中。

鉴于jgem脚本中的第8行是ruby的第一行(其余为注释/空白),我可以说你的shell中(j)ruby出了问题。

尝试启动一个新的命令行会话,看看它是否是暂时的。

试试这些:

jruby -v 的中文翻译是:jruby -v

jirb irb即Ruby语言自带的交互式解释器,用户可以使用irb命令进入REPL。Jirb是jruby中的交互式解释器,和irb非常类似,只不过它是基于jruby的,可以使用jruby进行一些操作。

等等...





相关问题
what do these ruby warnings mean?

cqq.rb:96 **warning: Statement not reached.** /root/newpackage/lib.rb:727 **warning: instance variable @object not initialized** Error: Your application used more memory than the safety cap of 500m. ...

How to register a JDBC driver using jruby-complete.jar?

I m trying to write a script that is executed with the jruby-complete.jar like so: java -cp derby.jar; -Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver -jar jruby-complete.jar -S my_script.rb I m ...

How do I unmarshal a ruby object in java?

I have a an object that I d like to grab the contents of in java. The only problem is that is is currently in ruby. irb(main):050:0> blah => "...

What s the difference between Ruby and JRuby? [closed]

Can anyone please provide me in layman s terms the difference between developing a JRuby and a Ruby, Rails application? I use NetBeans as my Ruby on Rails IDE and every-time I create a project is ...

Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

热门标签