The problem with the Ruby gem environment is LoadError: there is no such file to load - robots

I am trying to write a scanner using the anemone gem, which requires the robots gem. For some reason, robots do not turn on at all. Here are some details about my environment:

$ 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 stones load correctly, I have never had this problem before. Please note that I am using ruby ​​version 1.9, so rubygems is implicitly required. Adding

 require 'rubygems' 

... the script returns false to the beginning, since the file is already included and does not help the situation. Any ideas?

EDIT: Post examples of failed code. Please note that rubygems returning false does not mean that rubygems cannot load - rather, it has already been downloaded. 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> 
+4
source share
1 answer

It seems that the stone was created with the wrong permissions; there is an error open for this on github .

Change permissions with

 sudo chmod a+r /usr/local/lib/ruby/gems/1.9.1/gems/robots-0.10.1/lib/robots.rb 

should fix this, but watch out for other permission issues. You might be better off

 sudo chmod -R a+r /usr/local/lib/ruby/gems/1.9.1/gems/robots-0.10.1 

to recursively make all gem files readable.

The robots.rb file (and some others) is installed with the permissions -rw-rw---- , so none of those who use the local rvm installation or the like, where gems are installed as a local user, will not be affected by this.

+13
source

All Articles