Skip to content

Instantly share code, notes, and snippets.

@hone
Created December 2, 2009 19:22
Show Gist options
  • Select an option

  • Save hone/247462 to your computer and use it in GitHub Desktop.

Select an option

Save hone/247462 to your computer and use it in GitHub Desktop.
require 'net/http'
require 'uri'
require 'json'
new_file_lines = []
File.open('.gems') do |file|
file.each_line do |line|
gem_name = line.split.first
version = JSON.parse(Net::HTTP.get(URI.parse("http://gemcutter.org/gems/#{gem_name}.json")))["version"]
new_file_lines << "#{gem_name} -v #{version}"
end
end
puts new_file_lines.join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment