RubyGems is a packaging system. It works by manipulating Ruby's load
path to include the lib directories of any gems you have installed...
but to make that work, you must include RubyGems in your script.
Starting with Ruby 1.9, RubyGems is built-in to Ruby, so you won't
need to do that any more, but while you're using Ruby 1.8, you'll need
to require rubygems whenever you want to use a gem.
As an alternative, you can set the environment variable RUBYOPT to 'rubygems':
On 2월6일, 오전4시25분, Ben Bleything <b...@bleything.net> wrote:
2010/2/5 Jun Young <juneng...@gmail.com>:
> it makes my script working. but, I am still wondering why it didn't
> work.
> I installed the library by using gems. why I have to load 'rubygems'
> library also before calling 'nokogiri'??
Because that is how it works
RubyGems is a packaging system. It works by manipulating Ruby's load
path to include the lib directories of any gems you have installed...
but to make that work, you must include RubyGems in your script.
Starting with Ruby 1.9, RubyGems is built-in to Ruby, so you won't
need to do that any more, but while you're using Ruby 1.8, you'll need
to require rubygems whenever you want to use a gem.
As an alternative, you can set the environment variable RUBYOPT to 'rubygems':
May i seek your help for captioned case ?
I am test the script named test.rb by command "ruby test.rb" and it
pass.
Then i converte it as rake task.
The rake task pass on rails 2.3.5 but fail on rails 3 beta4 with error
msg:
"no such file to load -- nokogiri"
it makes my script working. but, I am still wondering why it didn't
work.
I installed the library by using gems. why I have to load 'rubygems'
library also before calling 'nokogiri'??
Because that is how it works
RubyGems is a packaging system. It works by manipulating Ruby's load
path to include the lib directories of any gems you have installed...
but to make that work, you must include RubyGems in your script.
Starting with Ruby 1.9, RubyGems is built-in to Ruby, so you won't
need to do that any more, but while you're using Ruby 1.8, you'll need
to require rubygems whenever you want to use a gem.
As an alternative, you can set the environment variable RUBYOPT to
'rubygems':