<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/safegem/exception.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -11,6 +11,8 @@ begin
     s.homepage = &quot;http://github.com/github/safegem&quot;
     s.description = &quot;GitHub's safe gem eval web service&quot;
     s.authors = [&quot;PJ Hyett&quot;, &quot;Tom Preston-Werner&quot;]
+    s.add_dependency('json', '&gt;= 1.1.3')
+    s.add_dependency('json', '&gt;= 0.9.9.1')
   end
 rescue LoadError
   puts &quot;Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com&quot;</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -7,19 +7,28 @@ require 'rubygems/specification'
 require 'sinatra'
 require 'timeout'
 require 'yaml'
+require 'net/http'
+require 'safegem/exception'
+require 'json'
+require 'base64'
+require 'zlib'
 
 post '/' do
+  p params
   r, w = IO.pipe
 
   pid = nil
   begin
-    repo   = params[:repo]
-    data   = params[:data]
-    tmpdir = &quot;tmp/#{repo}&quot;
-    spec = nil
+    repo     = params[:repo]
+    data     = params[:data]
+    callback = params[:callback]
+    token    = params[:token]
+    tmpdir   = &quot;tmp/#{repo}&quot;
+    spec     = nil
 
-    Timeout::timeout(30) do
+    Timeout::timeout(300) do
       `git clone --depth 1 git://github.com/#{repo} #{tmpdir}`
+      p &quot;Cloned #{repo}&quot;
 
       pid = fork do
         begin
@@ -60,23 +69,41 @@ post '/' do
             spec.validate
           end
 
-          w.write YAML.dump(spec)
+          payload = Base64.encode64(Zlib::Deflate.deflate(YAML.dump(spec)))
+          p payload.size
+          w.write payload
+          w.close
         rescue Object
-          puts $!,$@
+          puts $!, $@
 
           w.write &quot;ERROR: #$!&quot;
+          w.close
         end
       end
-      w.close
 
+      w.close
+      p &quot;Waiting for conversion&quot;
       Process.wait(pid)
-      r.read
+      yaml = r.read
+      r.close
+
+      p &quot;Request build from GitHub&quot;
+      payload = {'token' =&gt; token, 'yaml' =&gt; yaml}
+      res  = Net::HTTP.post_form(URI.parse(callback), payload)
+      data = res.body
+      p data
+
+      p &quot;Success&quot;
+      packet = {'result' =&gt; &quot;Successfully converted #{repo} gemspec to YAML.&quot;, 'error' =&gt; nil}
+      p packet
+      packet.to_json
     end
-  rescue Exception
-    Process.kill(9, pid) if pid
-    puts $!,$@
+  rescue Exception =&gt; e
+    Process.kill(9, pid) rescue nil
+    packet = {'error' =&gt; e.to_hash}
+    p packet
 
-    &quot;ERROR: #$!&quot;
+    packet.to_json
   ensure
     `rm -rf #{tmpdir}` if tmpdir
   end</diff>
      <filename>bin/safegem</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,2 @@
 require 'safegem/lazy_dir'
-require 'safegem/security'
\ No newline at end of file
+require 'safegem/security'</diff>
      <filename>lib/safegem.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>389700abc0194c6688d180f60515d9de66defdae</id>
    </parent>
  </parents>
  <author>
    <name>Tom Preston-Werner</name>
    <email>tom@mojombo.com</email>
  </author>
  <url>http://github.com/github/safegem/commit/66316a2281970da70a5f95139f52066f91d02cb5</url>
  <id>66316a2281970da70a5f95139f52066f91d02cb5</id>
  <committed-date>2009-03-28T23:35:38-07:00</committed-date>
  <authored-date>2009-03-28T23:35:38-07:00</authored-date>
  <message>part of the two-phase gem build process now</message>
  <tree>4153f533f5f21e592013484f8a4c0acac674f7db</tree>
  <committer>
    <name>Tom Preston-Werner</name>
    <email>tom@mojombo.com</email>
  </committer>
</commit>
