Method: CompactIndex::GemInfo#versions

Defined in:
lib/compact_index/gem_info.rb

#versionsObject

return a list of gem names and their versions



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/compact_index/gem_info.rb', line 74

def versions
  specs_hash = Hash.new {|h, k| h[k] = [] }
  rows = @conn[<<-SQL]
    SELECT v.full_name, v.number, v.platform
    FROM versions AS v
    WHERE v.indexed is true
SQL
  rows.each do |row|
    full_name = row[:full_name]
    version = row[:number]
    version += "-" << row[:platform] unless row[:platform] == "ruby"
    name = full_name.chomp("-" << version)
    specs_hash[name] << version
  end

  specs_hash.each {|k, v| v.sort! }
end