Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing gems on jruby

I've worked with ruby, and ROR but this new project is requiring me to use jruby. And I have been given documentation ad it is asking me to install jgem install cucumber, ect..

I am doing this on Ubuntu 10.10

I don't understand the jgem part.

I Did some research and tried to install it via: jruby -S gem install cucumber

and got the output:

JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://jruby.kenai.com/pages/JRuby_Builtin_OpenSSL
ERROR:  While executing gem ... (SystemCallError)
    Unknown error - mkdir failed

And I tried to install: gem install jruby-openssl and got the same results

like image 635
eciusr Avatar asked Nov 21 '11 22:11

eciusr


People also ask

Where are RubyGems stored?

When you use the --user-install option, RubyGems will install the gems to a directory inside your home directory, something like ~/. gem/ruby/1.9. 1 . The commands provided by the gems you installed will end up in ~/.


2 Answers

These are the steps showing how to pack bio and jruby-openssl into jruby-complete-1.6.7.jar becoming biojruby.jar (just for my purpose, I need bioruby for developing bioinformatics programs)

Here are the steps:

  • Make sure you navigated into the directory containing jruby-complete-1.6.7.jar in terminal/console

  • In terminal/console, type in:

    mkdir biojruby
    
  • Just add any gems you want, for gems which written purely in ruby without any C extension will work in Jruby!

    java -jar jruby-complete-1.6.7.jar -S gem install -i ./biojruby bio
    java -jar jruby-complete-1.6.7.jar -S gem install -i ./biojruby jruby-openssl
    jar uf jruby-complete-1.6.7.jar -C biojruby .                                
    mv jruby-complete-1.6.7.jar biojruby.jar
    
  • Now you can remove the folder "biojruby"

  • Completed!

Now type in:

java -jar biojruby.jar -S gem list

and you will see (indicate success):

**** LOCAL GEMS ***
bio (1.4.2)
bouncy-castle-java (1.5.0146.1)
jruby-openssl (0.7.6.1)
rake (0.8.7)
sources (0.0.1)*

Now you can test with your ruby script by type in:

java -jar biojruby.jar #Your_Ruby_Script.rb#
like image 108
Vincent Cheng Wing Sang Avatar answered Sep 30 '22 15:09

Vincent Cheng Wing Sang


It sounds strange, how have you installed JRuby? With RVM?

If you use rvm it's super easy to install and use jruby like every others ruby implementation.

rvm install jruby
rvm use jruby

jruby -v
gem install jruby-openssl
like image 24
Luke Avatar answered Sep 30 '22 15:09

Luke