Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a ruby gem/module be added just like a java jar file?

Tags:

ruby

eclipse

I use Eclispse Kepler with DLTK plugin for ruby. I am unable to "require" nokogiri module because it cannot be found by eclipse. I tried some gem install command from some website and that did not help. Now, I don't want to use commandline until I first master Ruby programming.

I learned that I can add java jars to my project by creating a lib folder, copying jars to that folder and then adding them all to the build path. So easy, right ?

Can I do the same thing for ruby gems and modules ? Ideally, I'd like to use only the IDE for this instead of using commandline and complext install scripts.

Please help.

like image 424
Erran Morad Avatar asked Feb 11 '23 20:02

Erran Morad


2 Answers

If this gem already installed with all dependencies, then you can add it with simple require command:

require "/path_to_gems/gem_name/lib/gem_name"

In my case the command is:

require '/Users/yukke/.rvm/gems/ruby-2.1.1/gems/nokogiri-1.6.1/lib/nokogiri'

Otherwise you can try to require rubygems first:

require "rubygems"
require "gem-name"
like image 107
Alexander Karmes Avatar answered Feb 15 '23 09:02

Alexander Karmes


I would suggest maybe using a different IDE with better Ruby support, such as Aptana, which is Eclipse-based but has a lot of additional addons to support Ruby development. You can install Ruby gems in it on the start page, or through the integrated terminal.

like image 23
vgel Avatar answered Feb 15 '23 11:02

vgel