[Rubygems-developers] bug in latest_specs

Ryan Davis ryand-ruby at zenspider.com
Tue Aug 28 00:40:02 EDT 2007


The platform dialog showed a bug in my flog-the-world script. It  
wasn't getting all the gems it could get. I didn't have the POpen4  
gem that Jim referred to downloaded to my disk and it was indeed the  
latest version. The problem is latest_specs collapses down too much  
so I'm now keying on [name, platform]. The platform can and should be  
handled better, but I'm not sure how at this stage. There are values  
that Gem::Platform::normalize will puke on (nil for example). Here is  
the current breakdown against what I do have:

---
i686-linux: 5
java: 2
windows: 1
jruby: 1
universal-darwin8.0: 1
i586-linux: 3
nil: 25
ruby: 1863
i386-mswin32: 7
i386-mswin32-mq6: 1
powerpc-darwin: 2
win32-1.8.2-VC7: 1
mswin32: 27

and here is my patch:

Index: source_index.rb
===================================================================
--- source_index.rb	(revision 1378)
+++ source_index.rb	(working copy)
@@ -135,10 +135,12 @@
        each do |full_name, spec|
          name = spec.name
-        if thin.has_key? name then
-          thin[name] = spec if spec.version > thin[name].version
+        plat = (spec.platform || "ruby").sub(/.*win32.*/, 'mswin32')  
# FIX
+        key = [name, plat]
+        if thin.has_key? key then
+          thin[key] = spec if spec.version > thin[key].version
          else
-          thin[name] = spec
+          thin[key] = spec
          end
        end



More information about the Rubygems-developers mailing list