Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Apr 2009 05:17:30 -0600
From:      Kim Shrier <kim@westryn.net>
To:        freebsd-ports@FreeBSD.org
Subject:   require gem is not working for ruby19
Message-ID:  <C2FBA83D-042F-470D-9AF4-FFD0D9B2871C@westryn.net>

next in thread | raw e-mail | index | archive | help
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@westryn.net
Remote Unix Network Admin, Security, Internet Software Development
          westryn.net - Superior FreeBSD-based Web Hosting
                      http://www.westryn.net/










Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C2FBA83D-042F-470D-9AF4-FFD0D9B2871C>