What am I doing wrong?

M

Mark J. Reed

After installing pathname2 on my Windows box went so well, I decided to
go ahead and install it elsewhere for consistency, and it universally failed.
On the same Windows box under Cygwin, on Linux, on Mac OS X, I got the same
result. The gem installation appeared to succeed but Ruby couldn't find
the newly-installed module file. Any help?

$ sudo gem install pathname2
Password:
Attempting local installation of 'pathname2'
Local gem file not found: pathname2*.gem
Attempting remote installation of 'pathname2'
Updating Gem source index for: http://gems.rubyforge.org
Install required dependency facade? [Yn] y
Successfully installed pathname2-1.1.0
Successfully installed facade-1.0.1
Installing RDoc documentation for pathname2-1.1.0...
Installing RDoc documentation for facade-1.0.1...
$ irb -r pathname2
/usr/lib/ruby/1.8/irb/init.rb:215:in `require': No such file to load -- pathname2 (LoadError)
from /usr/lib/ruby/1.8/irb/init.rb:215:in `load_modules'
from /usr/lib/ruby/1.8/irb/init.rb:213:in `each'
from /usr/lib/ruby/1.8/irb/init.rb:213:in `load_modules'
from /usr/lib/ruby/1.8/irb/init.rb:21:in `setup'
from /usr/lib/ruby/1.8/irb.rb:54:in `start'
from /usr/bin/irb:13
$
 
J

Jason Foreman

After installing pathname2 on my Windows box went so well, I decided to
go ahead and install it elsewhere for consistency, and it universally fai= led.
On the same Windows box under Cygwin, on Linux, on Mac OS X, I got the sa= me
result. The gem installation appeared to succeed but Ruby couldn't find
the newly-installed module file. Any help?
=20
$ sudo gem install pathname2
Password:
Attempting local installation of 'pathname2'
Local gem file not found: pathname2*.gem
Attempting remote installation of 'pathname2'
Updating Gem source index for: http://gems.rubyforge.org
Install required dependency facade? [Yn] y
Successfully installed pathname2-1.1.0
Successfully installed facade-1.0.1
Installing RDoc documentation for pathname2-1.1.0...
Installing RDoc documentation for facade-1.0.1...
$ irb -r pathname2
/usr/lib/ruby/1.8/irb/init.rb:215:in `require': No such file to load -- p= athname2 (LoadError)
from /usr/lib/ruby/1.8/irb/init.rb:215:in `load_modules'
from /usr/lib/ruby/1.8/irb/init.rb:213:in `each'
from /usr/lib/ruby/1.8/irb/init.rb:213:in `load_modules'
from /usr/lib/ruby/1.8/irb/init.rb:21:in `setup'
from /usr/lib/ruby/1.8/irb.rb:54:in `start'
from /usr/bin/irb:13
$
=20
=20


try this:

irb -r rubygems -r pathname2
 
J

Jim Weirich

Thanks, that worked . . . as does using "-r ubygems", which is a nice
"nroff -man"ish touch. And I see that the reason it worked on Windows is
that it adds "-rubygems" to $RUBYOPT, and children's mods to the
environment affect their parents in Windows, unlike in the Unixy world.

Is $RUBYOPT the best way to set things up so that rubygems is always
"prequire"d?

If you consistently use rubygems and can control your own environment, it is
probably the easiest choice.

See http://docs.rubygems.org/read/chapter/3#page70 for your list of options.
 
J

Jim Weirich

Mark J.Reed said:
Which seem to boil down to "set RUBYOPT". Except that doesn't work
for gems which are themselves specified via -r. An explict
"ruby -rubygems -rsomeGem" works, but with RUBYOPT set to "-rubygems",
"ruby -rsomeGem" doesn't; I guess $RUBYOPT gets appended instead of
prepended and you wind up with the moral equivalent of
"ruby -rsomeGem -rubygems". So it's still not a complete solution.

My understanding is that -r does not honor the override of the require
command.

--=20
-- Jim Weirich (e-mail address removed) http://onestepback.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top