Gems not working (Windows 184-20)

I hate that I don’t understand why this is failing, and have to turn to
the list for help.

The problem is that rubygems can’t find files that it itself installed.

In an attempt to fix things, I just deleted my entire c:\ruby
directory, deleted all ruby-related environment variables, and re-ran
the 184-20 one-click installer. No help.

See the following session:

C:\Documents and Settings\gavin.kistner>gem -v
0.9.0

C:\Documents and Settings\gavin.kistner>gem install usage
Bulk updating Gem source index for: http://gems.rubyforge.org
Install required dependency SimpleTrace? [Yn]
Successfully installed usage-0.0.4
Successfully installed SimpleTrace-0.0.1

C:\Documents and Settings\gavin.kistner>gem list Usage

*** LOCAL GEMS ***

usage (0.0.4)
This module implements a simple no thought command line option
parser

C:\Documents and Settings\gavin.kistner>gem env
Rubygems Environment:

  • VERSION: 0.9.0 (0.9.0)
  • INSTALLATION DIRECTORY: C:/ruby/lib/ruby/gems/1.8
  • GEM PATH:
    • C:/ruby/lib/ruby/gems/1.8
  • REMOTE SOURCES:

C:\Documents and Settings\gavin.kistner>ruby -e ‘require_gem “Usage”’
C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:251:in
report_activate_error': Could not find RubyGem Usage (>= 0.0.0) (Gem: :LoadError) from C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:188:inactivate’
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:66:in
active_gem_with_options' from C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:59:inrequire_gem’
from -e:1

C:\Documents and Settings\gavin.kistner>ruby -ve ‘p ENV[“GEM_HOME”]’
ruby 1.8.4 (2006-04-14) [i386-mswin32]
nil

C:\Documents and Settings\gavin.kistner>set
GEM_HOME=c:\ruby\lib\ruby\gems\1.8\gems

C:\Documents and Settings\gavin.kistner>ruby -e ‘p ENV[“GEM_HOME”];
require_gem “Usage”’
“c:\ruby\lib\ruby\gems\1.8\gems”
C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:251:in
report_activate_error': Could not find RubyGem Usage (>= 0.0.0) (Gem: :LoadError) from C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:188:inactivate’
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:66:in
active_gem_with_options' from C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:59:inrequire_gem’

I’ve also tried GEM_HOME settings of:
c:\ruby
c:\ruby\lib
c:\ruby\lib\ruby
c:\ruby\lib\ruby\gems
c:\ruby\lib\ruby\gems\1.8
c:\ruby\lib\ruby\gems\1.8\gems
all to no avail.
(I wish the rubygems documentation would provide examples of the
various environment variables.)

The problem is that rubygems can’t find files that it itself installed.

Try: require ‘usage’. The windows shell isn’t case sensitive, but ruby
is.

C:\Documents and Settings\gthiesfeld\desktop>irb
irb(main):001:0> require ‘usage’
=> true
irb(main):002:0> exit

C:\Documents and Settings\gthiesfeld\desktop>gem list usage

*** LOCAL GEMS ***

usage (0.0.4)
This module implements a simple no thought command line option
parser

C:\Documents and Settings\gthiesfeld\desktop>gem list Usage

*** LOCAL GEMS ***

usage (0.0.4)
This module implements a simple no thought command line option
parser

Hrm, mine doesn’t work quite like yours, but I got it to work.
Crazy-cased gem. Thanks.

To hijack my own thread: Why doesn’t require work the same as
require_gem? Both find the Usage.rb file and load it, but using require
causes it not to properly run the "require_gem “SimpleTrace”, “<=
0.1.0” command inside Usage.rb, resulting in the error shown in the
first block below:

===

Thought it should work, given my RUBYOPT setting; but it doesn’t.

Case doesn’t matter here, on Windows.

===
require ‘Usage’ # or require ‘usage’; same effect

p Usage
#=> Usage

p Usage.new( “foo” )
C:/ruby/lib/ruby/gems/1.8/gems/usage-0.0.4/lib/Usage.rb:605:in
initialize': undefined methoddebug’ for nil:NilClass (NoMethodError)
from C:/ruby/lib/ruby/gems/1.8/gems/usage-0.0.4/lib/Usage.rb:977:in
`initialize’
from tmp.rb:2

===

Oops, bad case also caused me confusion.

===

require_gem ‘Usage’
C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:251:in
report_activate_error': Could not find RubyGem Usage (>= 0.0.0) (Gem::LoadError) from C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:188:inactivate’
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:66:in
active_gem_with_options' from C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:59:inrequire_gem’
from tmp.rb:1

===

Yay, the ‘magic’ combination that works!

===

require_gem ‘usage’

p Usage
#=> Usage

p Usage.new( “foo” )
#=> PROGRAM: tmp.rb
#=> ERROR: too few arguments 1 expected, 0 given
#=>
#=> USAGE: tmp.rb foo

Umm, I was wrong. Disregard my last email. I’ll try to think before I
reply from now on.

irb(main):001:0> require ‘Usage’
=> true

On 8/15/06, Phrogz [email protected] wrote:

Hrm, mine doesn’t work quite like yours, but I got it to work.
Crazy-cased gem. Thanks.

To hijack my own thread: Why doesn’t require work the same as
require_gem? Both find the Usage.rb file and load it, but using require
causes it not to properly run the "require_gem “SimpleTrace”, “<=
0.1.0” command inside Usage.rb, resulting in the error shown in the
first block below:

See
http://redhanded.hobix.com/inspect/autorequireIsBasicallyGoneEveryone.html
This might help explain how require_gem works

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs