Skip to content

Instantly share code, notes, and snippets.

@hanshasselberg
Created April 16, 2012 10:52
Show Gist options
  • Save hanshasselberg/2397750 to your computer and use it in GitHub Desktop.
Save hanshasselberg/2397750 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'typhoeus'
require 'json'
require 'date'
require 'ostruct'
apikey = "0187fce21254fce68e5858518443c207"
version_url = "https://rubygems.org/api/v1/versions"
gem_url = "https://rubygems.org/api/v1/gems"
all_gems = `gem list -r`.split("\n").map{|gem| gem.split(" ").first}.map(&:strip)
all_gems.each do |gem|
gem_data = JSON.parse(Typhoeus::Request.get("#{gem_url}/#{gem}.json", password: apikey).body)
uses_mongoid = gem_data["dependencies"]["runtime"].find{ |dep| dep["name"] == "mongoid"}
if uses_mongoid
last_release = JSON.parse(Typhoeus::Request.get("#{version_url}/#{gem}.json", password: apikey).body).first
maintained = Date.parse(last_release["built_at"]) > Date.new(2011, 10, 13)
if maintained
popular = gem_data["downloads"].to_i >= 10_000
if popular
p "#{gem}: #{last_release["built_at"]}/#{gem_data["downloads"]}"
end
end
end
end
"carrierwave-mongoid: 2012-04-08T00:00:00Z/27103" -> needs gridfs
"delayed_job_mongoid: 2011-12-30T00:00:00Z/34019" -> there is already a pull request
"locomotive_cms: 2012-04-02T00:00:00Z/12886"
"mongoid-tree: 2012-02-06T00:00:00Z/13114"
"mongoid_session_store: 2011-11-03T00:00:00Z/10773"
"mongoid_slug: 2012-03-15T00:00:00Z/31495"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment