Permalink
Browse files

retrieve user projects + project commits via github API

  • Loading branch information...
0 parents commit c0712cb5c71797db2b723b080b70c712a0760b78 @igrigorik committed Jan 23, 2009
Showing with 373 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +8 −0 README
  3. +98 −0 gitter.rb
  4. +141 −0 swarm.config
  5. +123 −0 user-history.log
  6. +2 −0 user-history.log.xml
@@ -0,0 +1 @@
+nbproject
8 README
@@ -0,0 +1,8 @@
+To build and install codeswarm you will need JDK, Ant, and GIT, of course. For
+full instructions check the Readme file:
+ - http://github.com/rictic/code_swarm/tree/master
+
+= Great examples of code_swarm in action
+
+Wikipedia / Obama's Page: http://vimeo.com/2177573
+
@@ -0,0 +1,98 @@
+require 'rubygems'
+require 'open-uri'
+require 'date'
+require 'json'
+
+class DateTime
+ def to_rfc2822
+ sprintf("%.3s, %02d %.3s %04d %02d:%02d:%02d %s",
+ Date::DAYNAMES[self.wday],
+ self.day, Date::MONTHNAMES[self.mon],
+ self.year, self.hour, self.min, self.sec,
+ self.zone)
+ end
+end
+
+username = 'igrigorik'
+codeswarm_path = '/code/source/code_swarm/'
+
+userdata = JSON.parse(open('http://github.com/api/v1/json/'+username).read)["user"]
+puts "Author: #{userdata["name"]}"
+puts "Email: #{userdata["email"]}"
+puts "Blog: #{userdata["blog"]}" unless userdata["blog"].nil?
+puts "Repositories (#{userdata["repositories"].size}):"
+puts userdata["repositories"].collect {|r| r["name"] }.join(", ")
+
+puts "\nCollecting commits"
+history = File.open("user-history.log", "w")
+
+# Expected format in user_history.log
+# ------------------------------------------------------------------------
+# r14920d2 (14920d22c70d6ef6bbf9f4f40c173163c8cc7672) | todd.fisher@gmail.com | 2008-11-30 17:30:14 -0500 (Sun, 30 Nov 2008 17:30:14 -0500) | x lines
+# Changed paths:
+# M ext/extconf.rb
+# A tests/bug_curb_easy_blocks_ruby_threads.rb
+# D ext/ectconf_old.rb
+
+userdata["repositories"].each do |repo|
+
+ repodata = JSON.parse(open("http://github.com/api/v1/json/#{username}/#{repo["name"]}/commits/master").read)
+ commits = repodata["commits"]
+
+ # Sample commit information from API (JSON):
+ # {
+ # "author"=>{"name"=>"Ilya Grigorik", "email"=>"ilya@igvita.com"},
+ # "parents"=>[{"id"=>"5ba52cf1982690b2942b035fa2b33e44331d0c99"}],
+ # "url"=>"http://github.com/igrigorik/oauth-plugin/commit/8c75285fcbf88033dab024cd748d5f49792d2be0",
+ # "id"=>"8c75285fcbf88033dab024cd748d5f49792d2be0",
+ # "committed_date"=>"2008-08-03T01:51:43-07:00",
+ # "authored_date"=>"2008-08-03T01:51:43-07:00",
+ # "message"=>"FIXED: Bug in default ...",
+ # "committer"=>{"name"=>"Ilya Grigorik", "email"=>"ilya@igvita.com"},
+ # "tree"=>"211db4c1de04281c332d9dd2fcdc7b0a981b73f8"
+ # }
+
+ commits.each do |commit|
+ puts "#{repo["name"]}: #{commit["id"]}"
+
+ history.write("\n\n------------------------------------------------------------------------\n")
+ history.write("r#{commit["id"][0,7]} | #{commit["committer"]["email"]} | ")
+ history.write("#{DateTime.parse(commit["committed_date"]).strftime("%Y-%m-%d %H:%M:%S %Z")} ")
+ history.write("(#{DateTime.parse(commit["committed_date"]).to_rfc2822}) | ")
+ history.write("x lines\n")
+ history.write("Changed paths:")
+
+ commitdata = JSON.parse(open("http://github.com/api/v1/json/#{username}/#{repo["name"]}/commit/#{commit["id"]}").read)["commit"]
+
+ # Sample commit drilldown from API (JSON):
+ # {
+ # {"removed": [{"filename": "commands.rb"}, {"filename": "helpers.rb"}],
+ # "added": [{"filename": "commands/commands.rb"}, {"filename": "commands/helpers.rb"}],
+ # "message": "move commands.rb and helpers.rb into commands/ dir",
+ # "modified": [{"diff": "@@ -56,7 +56,7 @@ ..."}],
+ # "parents": [{"id": "d462d2a2e60438ded3dd9e8e6593ca4146c5a0ba"}],
+ # "url": "http://github.com/defunkt/github-gem/commit/c26d4ce9807ecf57d3f9eefe19ae64e75bcaaa8b",
+ # "author": {"name": "Chris Wanstrath", "email": "chris@ozmm.org"},
+ # "id": "c26d4ce9807ecf57d3f9eefe19ae64e75bcaaa8b",
+ # "committed_date": "2008-03-02T16:45:41-08:00",
+ # "authored_date": "2008-03-02T16:45:41-08:00",
+ # "tree": "28a1a1ca3e663d35ba8bf07d3f1781af71359b76",
+ # "committer": {"name": "Chris Wanstrath", "email": "chris@ozmm.org"}}}
+ # }
+
+ %w(added removed modified).each do |action|
+ commitdata[action].each do |file|
+ history.write("\n#{action[0,1].capitalize} #{file["filename"]}")
+ end
+ end
+
+ end
+
+ # convert git logs to code_swarm XML format (make sure codeswarm/bin is in your path)
+ `#{codeswarm_path}/bin/convert_logs.py -g user-history.log -o user-history.log.xml`
+
+ exit
+
+end
+
+
@@ -0,0 +1,141 @@
+# Author: Ilya Grigorik <http://www.igvita.com/>
+#
+# GitHub code_swarm configuration
+#
+# SETUP:
+# cd path/to/git/project
+# git-log --name-status --pretty=format:'%n------------------------------------------------------------------------%nr%h | %ae | %ai (%aD) | x lines%nChanged paths:' > my_git_pro
+# python convert_logs.py -g path/to/git/project/my_git_project -o git_log.xml
+#
+# CREATING A VIDEO:
+# http://code.google.com/p/codeswarm/wiki/GeneratingAVideo
+
+
+# Nice skin: http://jmdeldin.com/tmp/frames/
+
+# input file
+InputFile=igrigorik-history.log.xml
+
+# Frame width and height
+#Width=1280
+#Height=720
+Width=640
+Height=360
+
+# Particle sprite file
+ParticleSpriteFile=src/particle.png
+
+#Font Settings
+Font=SansSerif
+FontSize=10
+BoldFontSize=14
+
+# Save each frame to an image?
+#TakeSnapshots=true
+#SnapshotLocation=snapshots/code_swarm-#####.png
+
+# Maximum number of Background processes
+MaxThreads=4
+
+# Project time per frame
+# -> 8640000 = 1 day
+# -> 21915000 => 1 minute = 1 year
+MillisecondsPerFrame=21915000
+
+# Background in R,G,B
+# Background=255,255,255
+Background=0,0,0
+
+# Color assignment rules, must be in order, no numbers skipped (start at 1)
+#
+# Pattern: "Label", "regex", R,G,B, R,G,B
+# Label is optional. If it is omitted, the regex will be used.
+#
+# orange 255,150,60, 60,60,60
+# bright blue 120,120,255, 120,120,255
+# blue-green 60,255,255, 60,255,255
+# yellow 255,255,50, 255,255,50
+# light green 50,255,50, 50,255,50
+# bright green 50,255,50, 50,255,50
+# dark blue 20,20,255, 20,20,255
+# grey 155,155,155, 155,155,155
+# purple 255,50,255, 255,50,255
+# blue 0,0,255, 0,0,255
+# green 255,0,0, 255,0,0
+# red 0,255,0, 0,255,0
+
+ColorAssign1="Tests","(.*test.*|.*spec*.)", 90,225,90, 110,200,90
+ColorAssign2="Localizations","(.*(\.mo|\.po))|(.*\.lproj.*)", 90,225,225, 110,200,200
+ColorAssign3="Source Code",".*(\.py|\.rb|\.erb|\.hs|\.sql|\.c|\.cpp|\.h|\.m|\.d|\.js|\.pl|\.sh|\.java|\.lhs|\.hi)", 225,90,90, 200,90,110
+ColorAssign4="Documents/Images",".*(\.txt|\.html|\.tex|\.tmpl|\.css|\.xml|\.yml|\.json|\.png|\.jpg|\.gif|\.jpeg|README|COPYING|LICENSE|AUTHORS)", 90,90,225, 90,110,200
+
+# Draw names (combinatory) :
+# Draw sharp names?
+DrawNamesSharp=true
+
+# And draw a glow around names? (Runs slower)
+DrawNamesHalos=false
+
+# Draw files (combinatory) :
+# Draw sharp files
+DrawFilesSharp=false
+# Draw fuzzy files
+DrawFilesFuzzy=true
+# Draw jelly files
+DrawFilesJelly=false
+
+# Show the Legend at start
+ShowLegend=true
+
+# Show the History at start
+ShowHistory=true
+
+# Show the Date at start
+ShowDate=true
+
+# Show edges between authors and files, mostly for debug purpose
+#ShowEdges=true
+
+# Turn on Debug counts.
+ShowDebug=true
+
+# Natural distance of files to people
+EdgeLength=25
+
+# Amount of life to decrement
+EdgeDecrement=-2
+FileDecrement=-2
+PersonDecrement=-7
+
+#Speeds.
+#Optional: NodeSpeed=7.0, If used, FileSpeed and PersonSpeed need not be set.
+FileSpeed=2.0
+PersonSpeed=0.1
+
+#Masses
+FileMass=100.0
+PersonMass=10.0
+
+# Life of an Edge
+EdgeLife=250
+
+# Life of a File
+FileLife=1000
+
+# Life of a Person
+PersonLife=500
+
+# Highlight percent.
+# This is the amount of time that the person or
+# file will be highlighted.
+HighlightPct=10
+
+## Physics engine selection and configuration
+# Directory physics engine config files reside in.
+PhysicsEngineConfigDir=physics_engine
+
+# Force calculation algorithms ("PhysicsEngineLegacy", "PhysicsEngineSimple"...) :
+PhysicsEngineSelection=PhysicsEngineOrderly
+
+# OpenGL is experimental. Use at your own risk.
+UseOpenGL=false
@@ -0,0 +1,123 @@
+
+
+------------------------------------------------------------------------
+r8c75285 | ilya@igvita.com | 2008-08-03 01:51:43 -07:00 (Sun, 03 Aug 2008 01:51:43 -07:00) | x lines
+Changed paths:
+M lib/oauth/rails/controller_methods.rb
+
+------------------------------------------------------------------------
+r5ba52cf | jon@kaboomerang.com | 2008-06-23 21:42:15 -07:00 (Mon, 23 Jun 2008 21:42:15 -07:00) | x lines
+Changed paths:
+A generators/oauth_provider/templates/clients_controller.rb
+A generators/oauth_provider/templates/clients_controller_spec.rb
+A generators/oauth_provider/templates/clients_helper.rb
+A generators/oauth_provider/templates/controller_spec_helper.rb
+M CHANGELOG
+M README.rdoc
+M generators/oauth_provider/oauth_provider_generator.rb
+M generators/oauth_provider/templates/controller.rb
+M generators/oauth_provider/templates/controller_spec.rb
+
+------------------------------------------------------------------------
+rdf3b167 | pelleb@gmail.com | 2008-06-21 16:11:02 -07:00 (Sat, 21 Jun 2008 16:11:02 -07:00) | x lines
+Changed paths:
+A README.rdoc
+R README
+
+------------------------------------------------------------------------
+r5fb5480 | pelleb@gmail.com | 2008-06-21 16:09:16 -07:00 (Sat, 21 Jun 2008 16:09:16 -07:00) | x lines
+Changed paths:
+A .gitignore
+
+------------------------------------------------------------------------
+re4c8110 | pelleb@gmail.com | 2008-04-14 00:32:13 -07:00 (Mon, 14 Apr 2008 00:32:13 -07:00) | x lines
+Changed paths:
+M generators/oauth_provider/templates/authorize.html.erb
+
+------------------------------------------------------------------------
+r43dd078 | pelleb@gmail.com | 2008-03-17 09:19:03 -07:00 (Mon, 17 Mar 2008 09:19:03 -07:00) | x lines
+Changed paths:
+M generators/oauth_provider/templates/new.html.erb
+
+------------------------------------------------------------------------
+rb00a693 | pelleb@gmail.com | 2008-02-04 10:16:11 -08:00 (Mon, 04 Feb 2008 10:16:11 -08:00) | x lines
+Changed paths:
+M generators/oauth_provider/templates/client_application_spec.rb
+
+------------------------------------------------------------------------
+rc06e731 | pelleb@gmail.com | 2008-02-02 16:39:50 -08:00 (Sat, 02 Feb 2008 16:39:50 -08:00) | x lines
+Changed paths:
+M CHANGELOG
+M lib/oauth/rails/controller_methods.rb
+
+------------------------------------------------------------------------
+r2eda62c | pelleb@gmail.com | 2008-01-30 01:30:41 -08:00 (Wed, 30 Jan 2008 01:30:41 -08:00) | x lines
+Changed paths:
+M README
+M generators/oauth_provider/templates/client_application.rb
+M generators/oauth_provider/templates/client_application_spec.rb
+M generators/oauth_provider/templates/controller.rb
+M generators/oauth_provider/templates/controller_spec.rb
+M generators/oauth_provider/templates/oauth_nonce_spec.rb
+M generators/oauth_provider/templates/oauth_token.rb
+M init.rb
+M lib/oauth/rails/controller_methods.rb
+
+------------------------------------------------------------------------
+rc4e2ee1 | pelleb@gmail.com | 2008-01-21 11:24:32 -08:00 (Mon, 21 Jan 2008 11:24:32 -08:00) | x lines
+Changed paths:
+M init.rb
+
+------------------------------------------------------------------------
+r64acfb4 | pelleb@gmail.com | 2007-11-30 11:51:36 -08:00 (Fri, 30 Nov 2007 11:51:36 -08:00) | x lines
+Changed paths:
+M generators/oauth_provider/templates/controller_spec.rb
+M lib/oauth/rails/controller_methods.rb
+
+------------------------------------------------------------------------
+r5eaa4c2 | pelleb@gmail.com | 2007-11-30 10:04:51 -08:00 (Fri, 30 Nov 2007 10:04:51 -08:00) | x lines
+Changed paths:
+M README
+M lib/oauth/rails/controller_methods.rb
+
+------------------------------------------------------------------------
+r0af36bd | pelleb@gmail.com | 2007-11-28 08:37:07 -08:00 (Wed, 28 Nov 2007 08:37:07 -08:00) | x lines
+Changed paths:
+M generators/oauth_provider/templates/client_application_spec.rb
+
+------------------------------------------------------------------------
+r4edb8be | pelleb@gmail.com | 2007-11-27 00:46:14 -08:00 (Tue, 27 Nov 2007 00:46:14 -08:00) | x lines
+Changed paths:
+A CHANGELOG
+A MIT-LICENSE
+A README
+A Rakefile
+A generators/oauth_provider/USAGE
+A generators/oauth_provider/oauth_provider_generator.rb
+A generators/oauth_provider/templates/_form.html.erb
+A generators/oauth_provider/templates/access_token.rb
+A generators/oauth_provider/templates/authorize.html.erb
+A generators/oauth_provider/templates/authorize_failure.html.erb
+A generators/oauth_provider/templates/authorize_success.html.erb
+A generators/oauth_provider/templates/client_application.rb
+A generators/oauth_provider/templates/client_application_spec.rb
+A generators/oauth_provider/templates/client_applications.yml
+A generators/oauth_provider/templates/controller.rb
+A generators/oauth_provider/templates/controller_spec.rb
+A generators/oauth_provider/templates/helper.rb
+A generators/oauth_provider/templates/index.html.erb
+A generators/oauth_provider/templates/migration.rb
+A generators/oauth_provider/templates/new.html.erb
+A generators/oauth_provider/templates/oauth_nonce.rb
+A generators/oauth_provider/templates/oauth_nonce_spec.rb
+A generators/oauth_provider/templates/oauth_nonces.yml
+A generators/oauth_provider/templates/oauth_token.rb
+A generators/oauth_provider/templates/oauth_token_spec.rb
+A generators/oauth_provider/templates/oauth_tokens.yml
+A generators/oauth_provider/templates/request_token.rb
+A generators/oauth_provider/templates/show.html.erb
+A init.rb
+A install.rb
+A lib/oauth/rails/controller_methods.rb
+A tasks/oauth_tasks.rake
+A uninstall.rb
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<file_events><event date="1196142374000" author="pelleb@gmail.com" filename="CHANGELOG"></event><event date="1196142374000" author="pelleb@gmail.com" filename="MIT-LICENSE"></event><event date="1196142374000" author="pelleb@gmail.com" filename="README"></event><event date="1196142374000" author="pelleb@gmail.com" filename="Rakefile"></event><event date="1196142374000" author="pelleb@gmail.com" filename="generator"></event><event date="1196257027000" author="pelleb@gmail.com" filename="generators/oauth_provider/templates/client_application_spec.rb"></event><event date="1196435091000" author="pelleb@gmail.com" filename="README"></event><event date="1196435091000" author="pelleb@gmail.com" filename="lib/oauth/rails/controller_methods.rb"></event><event date="1196441496000" author="pelleb@gmail.com" filename="generators/oauth_provider/templates/controller_spec.rb"></event><event date="1196441496000" author="pelleb@gmail.com" filename="lib/oauth/rails/controller_methods.rb"></event><event date="1200932672000" author="pelleb@gmail.com" filename="init.rb"></event><event date="1201674641000" author="pelleb@gmail.com" filename="README"></event><event date="1201674641000" author="pelleb@gmail.com" filename="generators/oauth_provider/templates/client_application.rb"></event><event date="1201674641000" author="pelleb@gmail.com" filename="generators/oauth_provider/templates/client_application_spec.rb"></event><event date="1201674641000" author="pelleb@gmail.com" filename="generators/oauth_provider/templates/controller.rb"></event><event date="1201674641000" author="pelleb@gmail.com" filename="generators/oauth_provider/templates/controller_spec.rb"></event><event date="1201674641000" author="pelleb@gmail.com" filename="generators/oauth_provider/templates/oauth_nonce_spec.rb"></event><event date="1201674641000" author="pelleb@gmail.com" filename="generators/oauth_provider/templates/oauth_token.rb"></event><event date="1201674641000" author="pelleb@gmail.com" filename="init.rb"></event><event date="1201674641000" author="pelleb@gmail.com" filename="lib/oauth/rails/controller_methods.rb"></event><event date="1201988390000" author="pelleb@gmail.com" filename="CHANGELOG"></event><event date="1201988390000" author="pelleb@gmail.com" filename="lib/oauth/rails/controller_methods.rb"></event><event date="1202138171000" author="pelleb@gmail.com" filename="generators/oauth_provider/templates/client_application_spec.rb"></event><event date="1205759943000" author="pelleb@gmail.com" filename="generators/oauth_provider/templates/new.html.erb"></event><event date="1208147533000" author="pelleb@gmail.com" filename="generators/oauth_provider/templates/authorize.html.erb"></event><event date="1214078956000" author="pelleb@gmail.com" filename=".gitignore"></event><event date="1214079062000" author="pelleb@gmail.com" filename="README.rdoc"></event><event date="1214079062000" author="pelleb@gmail.com" filename="README"></event><event date="1214271735000" author="jon@kaboomerang.com" filename="generators/oauth_provider/templates/clients_controller.rb"></event><event date="1214271735000" author="jon@kaboomerang.com" filename="generators/oauth_provider/templates/clients_controller_spec.rb"></event><event date="1214271735000" author="jon@kaboomerang.com" filename="generators/oauth_provider/templates/clients_helper.rb"></event><event date="1214271735000" author="jon@kaboomerang.com" filename="generators/oauth_provider/templates/controller_spec_helper.rb"></event><event date="1214271735000" author="jon@kaboomerang.com" filename="CHANGELOG"></event><event date="1214271735000" author="jon@kaboomerang.com" filename="README.rdoc"></event><event date="1214271735000" author="jon@kaboomerang.com" filename="generators/oauth_provider/oauth_provider_generator.rb"></event><event date="1214271735000" author="jon@kaboomerang.com" filename="generators/oauth_provider/templates/controller.rb"></event><event date="1214271735000" author="jon@kaboomerang.com" filename="generators/oauth_provider/templates/controller_spec.rb"></event><event date="1217742703000" author="ilya@igvita.com" filename="lib/oauth/rails/controller_methods.rb"></event></file_events>

0 comments on commit c0712cb

Please sign in to comment.