[rspec-users] Problem seeing and accessing RSpec gems

David Chelimsky dchelimsky at gmail.com
Mon Apr 13 14:14:17 EDT 2009


On Mon, Apr 13, 2009 at 2:22 PM, Sarah Gray <sarahg.gray at gmail.com> wrote:
> Hello RSpec-list:
> I'm having trouble getting rspec and rspec-rails correctly installed on my
> system. (I had to uninstall, unfortunately).The upshot is that even when
> they are installed -- i.e. when I can see them on my system -- they don't
> appear known to gem which which and, more importantly, they are not
> accessible to my application.  I've tried options such as installing with
> --no-rdoc, cleaning out all files manually from ~/.gem (and cache, doc,
> etc), installing via rake gems:install from w/in the app and installing
> versus gem install and sudo gem install outside the app...
> Are there any steps that, if done wrong once, could have permanently hosed
> the system? For instance, if at some point I answered "Y", which I believe
> that I did to
> Remove executables:
> autospec, spec
> Would that cause this type of issue? If so, is there any way I can reset? A
> clean uninstall doesn't do it.
> I've put a fairly detailed log of what I've been doing and system responses
> if it's helpful.  It seems like it boils down to the first issue: that even
> though the gems show up via gem list, gem which doesn't turn them up.  The
> rest just confirms this. Any thoughts helpful.  Thanks.
>
> ***************************************************************
> # Are they there?
> $ gem list rspec
> *** LOCAL GEMS ***
> rspec (1.2.2)
> rspec-rails (1.2.2)
>
> # OK, where are they?
> $ gem which rspec
> Can't find ruby library file or shared library rspec
> $ gem which rspec-rails
> Can't find ruby library file or shared library rspec-rails
> # Let's do this manually
> $cd /usr/local/lib/ruby/gems/1.8/gems
> $ls | grep rspec
> rspec-1.2.2
> rspec-rails-1.2.2
> # Let's try to unpack them, then
> $ sudo rake vendor gems:unpack RAILS_ENV=test
> (in /Users/sarah/Sites/site-name)
> no such file to load -- rspec
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
> /Users/sarah/Sites/site-name/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in
> `require'
> .... massive stack trace here
> /usr/local/bin/rake:19:in `load'
> /usr/local/bin/rake:19
> These gems that this application depends on are missing:
>  - rspec
>  - rspec-rails
> Run "rake gems:install" to install them.
> no such file to load -- rspec
> # Doesn't sound promising, but OK, I'll try again
> $ rake gems:install RAILS_ENV=test
> (in /Users/sarah/Sites/site-name)
> no such file to load -- rspec
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> .... massive stack trace here; same as above
> However, at the end of the stack track, it installs the gems anyway, to
> ~/.gem
> gem install rspec --version ">= 1.2.0"
> WARNING:  Installing to ~/.gem since /usr/local/lib/ruby/gems/1.8 and
>  /usr/local/bin aren't both writable.
> Could not find main page README.rdoc
> Could not find main page README.rdoc
> Could not find main page README.rdoc
> Could not find main page README.rdoc
> **************************************************
>   Thank you for installing rspec-1.2.2
>   Please be sure to read History.rdoc and Upgrade.rdoc
>   for useful information about this release.
> **************************************************
> Successfully installed rspec-1.2.2
> 1 gem installed
> Installing ri documentation for rspec-1.2.2...
> Installing RDoc documentation for rspec-1.2.2...
> gem install rspec-rails --version ">= 1.2.0"
> WARNING:  Installing to ~/.gem since /usr/local/lib/ruby/gems/1.8 and
>  /usr/local/bin aren't both writable.
> Could not find main page README.rdoc
> Could not find main page README.rdoc
> Could not find main page README.rdoc
> Could not find main page README.rdoc
> **************************************************
>   Thank you for installing rspec-rails-1.2.2
>   If you are upgrading, do this in each of your rails apps
>   that you want to upgrade:
>     $ ruby script/generate rspec
>   Please be sure to read History.rdoc and Upgrade.rdoc
>   for useful information about this release.
> **************************************************
> Successfully installed rspec-rails-1.2.2
> 1 gem installed
> Installing ri documentation for rspec-rails-1.2.2...
> Installing RDoc documentation for rspec-rails-1.2.2...
> # Just for fun, try to unpack, again:
> $ sudo rake gems:unpack RAILS_ENV=test
> Password:
> (in /Users/sarah/Sites/radio-info)
> no such file to load -- rspec
> ... stack trace
> # OK, I will uninstall and try again
> $ sudo gem uninstall rspec
> Remove executables:
> autospec, spec
> in addition to the gem? [Yn]  n
> Executables and scripts will remain installed.
> You have requested to uninstall the gem:
> rspec-1.2.2
> rspec-rails-1.2.2 depends on [rspec (= 1.2.2)]
> If you remove this gems, one or more dependencies will not be met.
> Continue with Uninstall? [Yn]  y
> Successfully uninstalled rspec-1.2.2
> sarah-grays-computer:radio-info sarah$ sudo gem uninstall rspec-rails
> Successfully uninstalled rspec-rails-1.2.2
> # Still there?
> $ gem list rspec
> *** LOCAL GEMS ***
> rspec (1.2.2)
> rspec-rails (1.2.2)
> $ gem uninstall rspec
> ERROR:  While executing gem ... (Gem::InstallError)
>     Unknown gem rspec >= 0
> #OK, now I will manually remove the gem from
> $cd /Users/sarah/.gem/ruby/1.8/gems; $sudo rm -rf rspec*
> $cd /Users/sarah/.gem/ruby/1.8/cache; $sudo rm -rf rspec*
> $cd /Users/sarah/.gem/ruby/1.8/doc; $sudo rm -rf rspec*
> $cd /Users/sarah/.gem/ruby/1.8/specifications; $sudo rm -rf rspec*
> # Check gone.
> $ gem list rspec
> *** LOCAL GEMS ***
> # OK, confirmed gone, start from scratch
> $ sudo gem install rspec
> **************************************************
>   Thank you for installing rspec-1.2.2
>   Please be sure to read History.rdoc and Upgrade.rdoc
>   for useful information about this release.
> **************************************************
> Successfully installed rspec-1.2.2
> 1 gem installed
> Installing ri documentation for rspec-1.2.2...
> Installing RDoc documentation for rspec-1.2.2...
> Could not find main page README.rdoc
> Could not find main page README.rdoc
> Could not find main page README.rdoc
> Could not find main page README.rdoc
> sarah-grays-computer:~ sarah$ gem which rspec
> Can't find ruby library file or shared library rspec
> sarah-grays-computer:~ sarah$ gem list rspec
> *** LOCAL GEMS ***
> rspec (1.2.2)
> # See if the gem is accessible from w/in the application:
> $ ruby script/generate rspec
> :0:Warning: Gem::SourceIndex#search support for Regexp patterns is
> deprecated
> Couldn't find 'rspec' generator
> sarah-grays-computer:site-name sarah$
>
>
> **************
> Any thoughts?

I'm not familiar with a gemwhich - sounds crunchy - but ....

$ gem which spec
(checking gem rspec-1.2.3 for spec)
/Library/Ruby/Gems/1.8/gems/rspec-1.2.3/lib/spec.rb
$ gem which spec/rails
(checking gem rspec-rails-1.2.3 for spec/rails)
/Library/Ruby/Gems/1.8/gems/rspec-rails-1.2.3/lib/spec/rails.rb

Of course, 1.2.3 isn't released yet, but I have special privileges ;)

So it appears that "gem which" looks for files, not gems or executables.

HTH,
David

> Thanks,
> Sarah
>
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list