Class: Latest::RubiniusRetriever

Inherits:
Object
  • Object
show all
Includes:
REXML
Defined in:
lib/latest_ruby/retrievers/rubinius_retriever.rb

Instance Method Summary collapse

Instance Method Details

#retrieve(rbx) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/latest_ruby/retrievers/rubinius_retriever.rb', line 8

def retrieve(rbx)
  page = Net::HTTP.get(URI(rbx.source))
  xml  = Document.new(page)
  all_versions = XPath.match(xml, '//Contents//Key').map(&:text)
  candidates = all_versions.find_all { |v| v =~ /\Arubinius-/ }
  stables = candidates.flat_map { |v| v.scan(/-(\d\.\d\.\d)\.tar/) }.flatten
  stables.map { |v| RubyVersion.new(v) }.max
end