What am I doing wrong?

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
$

try this:

irb -r rubygems -r pathname2

···

On 8/11/05, Mark J. Reed <mreed@thereeds.org> wrote:

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
$

Jason Foreman <threeve.org@gmail.com> writes:

try this:

irb -r rubygems -r pathname2

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.

···

On Thursday 11 August 2005 04:21 pm, Mark J.Reed wrote:

Jason Foreman <threeve.org@gmail.com> writes:
>try this:
>
>irb -r rubygems -r pathname2

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?

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

Jim Weirich <jim@weirichhouse.org> writes:

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

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.

What if I run a find command in my profile to find all the gem
directories and just manually add them all to RUBYLIB myself?

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.

···

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)