require gem is not working for ruby19

Kim Shrier kim at westryn.net
Mon Apr 13 11:33:38 UTC 2009


Hello,

I am running FreeBSD 7.1 RELENG and I have installed ruby 1.9 using the
port in /usr/ports/lang/ruby19.  I have installed a gem named tmail that
I want to include in my script.  According to the ruby docs, I should be
able to just say:

require 'tmail'

However, this fails and reports that it cannot find the gem.  If I use
the folloowing statements:

require 'rubygems'
gem 'tmail'
require 'tmail'

I can load the gem and use it.  I also get 20 or so warning messages
like the following:

/usr/local/lib/ruby/1.9/rubygems/defaults.rb:11: warning: method  
redefined; discarding old default_sources
/usr/local/lib/ruby/1.9/rubygems/defaults.rb:19: warning: method  
redefined; discarding old default_dir
/usr/local/lib/ruby/1.9/rubygems/defaults.rb:31: warning: method  
redefined; discarding old user_dir
/usr/local/lib/ruby/1.9/rubygems/defaults.rb:39: warning: method  
redefined; discarding old default_path
...
/usr/local/lib/ruby/1.9/rubygems.rb:46: warning: method redefined;  
discarding old gem
/usr/local/lib/ruby/1.9/rubygems.rb:306: warning: method redefined;  
discarding old dir
...

It would appear that I am redefining methods that are already defined,
both with the require 'rubygems' statement and the gem 'tmail'  
statement.
However, if I don't include these 2 statements in my source, the
require 'tmail' statement fails with the following error:

./test.rb:24:in `require': no such file to load -- tmail (LoadError)
	from ./test.rb:24:in `<main>'

Is there some problem with the rubygems support that is built in to  
ruby19?

Thanks,
Kim
--
  Kim Shrier - principal, Shrier and Deihl - mailto:kim at westryn.net
Remote Unix Network Admin, Security, Internet Software Development
          westryn.net - Superior FreeBSD-based Web Hosting
                      http://www.westryn.net/









More information about the freebsd-ports mailing list