[Rubygems-developers] `gem outdated' ignores platform

Jos Backus jos at catnook.com
Fri Jan 19 16:49:44 EST 2007


This on Linux. RubyGems erroneously thinks the mysql gem needs to be updated:

# gem outdated
mysql (2.7 < 2.7.3)
# gem update
Updating installed gems...
Attempting remote update of mysql
Select which gem to install for your platform (i386-linux)
 1. mysql 2.7.3 (mswin32)
 2. mysql 2.7.1 (mswin32)
 3. mysql 2.7 (ruby)
 4. mysql 2.6 (ruby)
 5. Skip this gem
 6. Cancel installation
> 6
ERROR:  While executing gem ... (Gem::RemoteInstallationCancelled)
    Installation of mysql cancelled.
# 

As can be seen, there is no newer version applying to the current platform.

(Minor) Entering EOF (Ctrl-D) at the option prompt yields an error:

# gem update
Updating installed gems...
Attempting remote update of mysql
Select which gem to install for your platform (i386-linux)
 1. mysql 2.7.3 (mswin32)
 2. mysql 2.7.1 (mswin32)
 3. mysql 2.7 (ruby)
 4. mysql 2.6 (ruby)
 5. Skip this gem
 6. Cancel installation
> ERROR:  While executing gem ... (NoMethodError)
    undefined method `strip' for nil:NilClass
# 

Fix:

--- user_interaction.rb.orig    2007-01-19 16:45:34.420481258 -0500
+++ user_interaction.rb 2007-01-19 16:44:33.163111573 -0500
@@ -97,8 +97,13 @@
       end
       @outs.print "> "
       @outs.flush
-      result = @ins.gets.strip.to_i - 1
-      return list[result], result
+      result = @ins.gets
+      if result
+        result = result.strip.to_i - 1
+        return list[result], result
+      else
+        return nil, nil
+      end
     end
 
     # Ask a question.  Returns a true for yes, false for no.

-- 
Jos Backus
jos at catnook.com


More information about the Rubygems-developers mailing list