[Rubygems-developers] Problem while installing the Gems with tests from remote gem-server

TANAKA Shin-ya zstanaka at archer.livedoor.com
Mon Oct 24 09:18:27 EDT 2005


Hi all,

I got following error while installing the Gems
with tests from remote gem-server.

$ sudo gem install -t trie
Attempting local installation of 'trie'
Local gem file not found: trie*.gem
Attempting remote installation of 'trie'
Successfully installed trie-0.0.1
Installing RDoc documentation for trie-0.0.1...
/usr/pkg/lib/ruby/site_ruby/1.8/rubygems.rb:204:in `report_activate_error': Could not find RubyGem trie (= 0.0.1) (Gem::LoadError)
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems.rb:141:in `activate'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems.rb:37:in `require_gem_with_options'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems.rb:31:in `require_gem'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems/validator.rb:127:in `unit_test'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:222:in `execute'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:220:in `each'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:220:in `execute'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:153:in `each'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:153:in `execute'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems/command.rb:49:in `invoke'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:94:in `process_args'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:67:in `run'
        from /usr/pkg/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:13:in `run'
        from /usr/pkg/bin/gem:17

In this case, installed gem isn't registered to Gem#source_index.
Gem#source_index is cached at RemoteInstaller#install(rubygems/remote_installer.rb:399).

To resolve this error, apply following patch.

diff -ur rubygems/gem_commands.rb.orig rubygems/gem_commands.rb
--- 1.8.orig/rubygems/gem_commands.rb	2005-10-19 05:50:56.000000000 +0900
+++ 1.8/rubygems/gem_commands.rb	2005-10-24 22:02:32.000000000 +0900
@@ -217,6 +217,7 @@
           # TODO: catch exceptions and inform user that doc generation was not successful.
         end
         if options[:test]
+	  Gem.clear_source_index
           installed_gems.each do |spec|
             gem_spec = Gem::SourceIndex.from_installed_gems.search(spec.name, spec.version.version).first
             result = Gem::Validator.new.unit_test(gem_spec)
diff -ur rubygems.rb.orig rubygems.rb
--- 1.8.orig/rubygems.rb	2005-10-19 05:50:56.000000000 +0900
+++ 1.8/rubygems.rb	2005-10-24 22:02:32.000000000 +0900
@@ -214,6 +214,12 @@
       @gem_path = nil
       @@source_index = nil  
     end
+
+    # Clear source_index cache.
+    #
+    def clear_source_index
+      @@source_index = nil  
+    end
     
     # Use the +home+ and (optional) +paths+ values for +dir+ and +path+.
     # Used mainly by the unit tests to provide environment isolation.

I think it's ugly patch.
Please suggest better solutions.

Regards,
TANAKA Shin-ya




-----------------------------------------------
得するキャンペーンやプレゼント情報を是非ご覧下さい!
livedoor 懸賞
http://present.livedoor.com/



More information about the Rubygems-developers mailing list