Skip to content

Instantly share code, notes, and snippets.

@drnic
Created July 12, 2010 23:27
Show Gist options
  • Save drnic/473222 to your computer and use it in GitHub Desktop.
Save drnic/473222 to your computer and use it in GitHub Desktop.
Sometimes you just need to know if anyone has forked your project recently
#!/usr/bin/env ruby
#
# USAGE:
#
# ruby -rubygems -ropen-uri -e 'eval open("http://gist.github.com/raw/473222/snippet.rb").read' jbarnette dr-nic-magic-awesome
#
# Or locally:
#
# $ show_forks jbarnette dr-nic-magic-awesome
# jbarnette - 2008/06/05 15:54:29 -0700
# evanphx - 2008/06/05 16:02:45 -0700
# wycats - 2008/06/05 16:06:44 -0700
# stevenbristol - 2008/06/05 16:12:07 -0700
# drnic - 2008/06/05 17:40:20 -0700
# Manfred - 2008/11/06 08:45:38 -0800
# alloy - 2008/11/06 08:45:58 -0800
# rishav - 2009/05/22 03:15:12 -0700
# kef - 2009/11/24 22:33:36 -0800
# sdegoeij - 2009/12/14 08:18:06 -0800
# veganstraightedge - 2010/07/12 13:43:17 -0700
# panpainter - 2010/07/12 15:40:10 -0700
require "json"
require "open-uri"
login, project = ARGV[0..1]
if login && project
url = "http://github.com/api/v2/json/repos/show/#{login}/#{project}/network"
json = JSON.parse(open(url).read)
json["network"].each do |repo|
puts "#{repo["owner"]} - #{repo["created_at"]}"
end
else
puts "USAGE: #{$0} [user] [project]"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment