I'm attempting to write a crawler using the anemone gem, which requires the robots gem. For whatever reason, robots absolutely will not include. Here is some of my environment info:
$ gem list -d robots
*** LOCAL GEMS ***
robots (0.10.1)
Author: Kyle Maxwell
Homepage: http://github.com/fizx/robots
Installed at: /usr/local/lib/ruby/gems/1.9.1
Simple robots.txt parser
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.10
- RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [x86_64-darwin10.7.0]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-10
- GEM PATHS:
- /usr/local/lib/ruby/gems/1.9.1
- /Users/ryan/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
$ gem which robots
/usr/local/lib/ruby/gems/1.9.1/gems/robots-0.10.1/lib/robots.rb
Any ideas? All other gems load correctly, I've never had this problem before. Note that I am using ruby version 1.9, so rubygems is implicitly required. Adding
require 'rubygems'
...to the front of a script returns false, since the file is already included, and does not help the situation. Any ideas?
EDIT: Posting examples of failing code. Please note that rubygems returning false does not mean rubygems cannot load - rather that it has already been loaded. See this post: http://www.ruby-forum.com/topic/157442
$ irb
irb(main):001:0> require 'rubygems'
=> false
irb(main):002:0> require 'active_record'
=> true
irb(main):003:0> require 'mechanize'
=> true
irb(main):004:0> require 'robots'
LoadError: no such file to load -- robots
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from (irb):4
from /usr/local/bin/irb:12:in `<main>'
irb(main):005:0>
It looks like the gem has been created with the wrong permissions; there's a bug opened for this on github.
Changing the permissions with
sudo chmod a+r /usr/local/lib/ruby/gems/1.9.1/gems/robots-0.10.1/lib/robots.rb
should fix it, but watch out for other permission issues. You might be better with
sudo chmod -R a+r /usr/local/lib/ruby/gems/1.9.1/gems/robots-0.10.1
to recursively make all the files in the gem readable.
The robots.rb
file (and some others) is being installed with the permissions -rw-rw----
, so anyone using a local install of rvm or similar where gems are installed as the local user won't have been affected by this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With