<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -34,6 +34,7 @@
 require 'fileutils'
 require 'optparse'
 require 'tmpdir'
+require 'open-uri'
 include FileUtils
 
 def sh(*cmd)
@@ -41,6 +42,31 @@ def sh(*cmd)
   warn(&quot;Bad exit-status&quot;) unless system(*cmd)
 end
 
+def vendor_github(name_project_branch, target)
+  name, project, branch = name_project_branch.split('/')
+  branch ||= 'master'
+  uri = &quot;http://github.com/#{name}/#{project}/tarball/#{branch}&quot;
+  tar_name = [name, project, branch].join('-') + '.tar'
+
+  Dir.chdir(target) do
+    dirs_before = Dir['*']
+
+    puts &quot;Downloading #{uri} ...&quot;
+    File.open(tar_name, 'w+'){|tar| tar.write(open(uri).read) }
+    puts &quot;done.&quot;
+
+    sh('tar', 'xf', tar_name)
+    rm_f(tar_name)
+
+    unpacked_tar_dir = (Dir['*'] - dirs_before).first
+    mv(unpacked_tar_dir, project)
+
+    Dir.glob(File.join(project, '*')) do |path|
+      rm_r(path) unless File.basename(path) == 'lib'
+    end
+  end
+end
+
 def vendor_remote(repo, target)
   prefix = File.join(File.basename(repo, '.*'), '/')
 
@@ -73,18 +99,22 @@ def sandbox(source, name, dependencies = {})
     sh(&quot;git archive --format=tar HEAD | (cd '#{target_dir}' &amp;&amp; tar xf -)&quot;)
 
     dependencies.each do |type, repos|
+      repos.uniq!
+
       case type
       when :local
         repos.each{|repo| vendor_local(repo, target_vendor) }
       when :remote
         repos.each{|repo| vendor_remote(repo, target_vendor) }
+      when :github
+        repos.each{|repo| vendor_github(repo, target_vendor) }
       else
-        raise(ArgumentError, &quot;Invalid dependency type: %p&quot;, type)
+        raise(ArgumentError, &quot;Invalid dependency type: %p&quot; % type)
       end
     end
 
     Dir.chdir(target) do |now|
-      sh('tar', '--checkpoint-action', 'dot', '-cjf', target_tar, name)
+      sh('tar', '-cjf', target_tar, name)
     end
 
     puts '', &quot;All done, have fun playing, sandbox is waiting at #{target_tar}&quot;
@@ -95,6 +125,7 @@ source = Dir.pwd
 name = File.basename(source)
 locals = []
 remotes = []
+githubs = []
 
 op = OptionParser.new{|o|
   o.on('-s', '--source DIR',
@@ -105,6 +136,8 @@ op = OptionParser.new{|o|
        'Put archives of these git repos into target/vendor'){|d| locals += d }
   o.on('-r', '--remote uri1,uri2,uri3', Array,
        'Put archives of these remote git repos into target/vendor'){|r| remotes += r }
+  o.on('-g', '--github name/proj,name/proj/branch', Array,
+       'Retrieve tarballs from github for given projects, branch defaults to master'){|g| githubs += g }
   o.on('-h', '--help'){ puts o; exit }
 }
 
@@ -115,4 +148,4 @@ end
 
 op.parse!(ARGV)
 
-sandbox(source, name, :local =&gt; locals.uniq, :remote =&gt; remotes.uniq)
+sandbox(source, name, :local =&gt; locals, :remote =&gt; remotes, :github =&gt; githubs)</diff>
      <filename>sandbox.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4ece694c88414dc2a0d305e6110940e04eac765a</id>
    </parent>
  </parents>
  <author>
    <name>Michael Fellinger</name>
    <email>m.fellinger@gmail.com</email>
  </author>
  <url>http://github.com/manveru/buildmybike/commit/a8225a101b704c94ddcd8488fd6ec1d6ea590e0a</url>
  <id>a8225a101b704c94ddcd8488fd6ec1d6ea590e0a</id>
  <committed-date>2009-04-09T07:24:36-07:00</committed-date>
  <authored-date>2009-04-09T07:23:03-07:00</authored-date>
  <message>Add support for github tarballs</message>
  <tree>74bf27bde2c937bdf8d9df8fe750c8b845be0fa0</tree>
  <committer>
    <name>Michael Fellinger</name>
    <email>m.fellinger@gmail.com</email>
  </committer>
</commit>
