<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>Commands/Add to multifile Gist.tmCommand</filename>
    </added>
    <added>
      <filename>Commands/Send multifile Gist.tmCommand</filename>
    </added>
    <added>
      <filename>Commands/Send private multifile Gist.tmCommand</filename>
    </added>
    <added>
      <filename>Support/bin/add_to_multifile_gist.rb</filename>
    </added>
    <added>
      <filename>Support/bin/send_multifile_gist.rb</filename>
    </added>
    <added>
      <filename>Support/lib/tmp_gists</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -3,55 +3,6 @@
 $:.unshift(File.dirname(__FILE__) + &quot;/../lib&quot;)
 require &quot;gist&quot;
 
-# Add extension for supported modes based on TM_SCOPE
-# Cribbed from http://github.com/defunkt/gist.el/tree/master/gist.el
-def get_extension
-  scope = ENV[&quot;TM_SCOPE&quot;].split[0]
-  case scope
-  when /source\.actionscript/ : &quot;as&quot;
-  when /source\.c/, &quot;source.objc&quot; : &quot;c&quot;
-  when /source\.c\+\+/, &quot;source.objc++&quot; : &quot;cpp&quot;
-  # common-lisp-mode : &quot;el&quot;
-  when /source\.css/ : &quot;css&quot;
-  when /source\.diff/, &quot;meta.diff.range&quot; : &quot;diff&quot;
-  # emacs-lisp-mode : &quot;el&quot;
-  when /source\.erlang/ : &quot;erl&quot;
-  when /source\.haskell/, &quot;text.tex.latex.haskel&quot; : &quot;hs&quot;
-  when /text\.html/ : &quot;html&quot;
-  when /source\.io/ : &quot;io&quot;
-  when /source\.java/ : &quot;java&quot;
-  when /source\.js/ : &quot;js&quot;
-  # jde-mode : &quot;java&quot;
-  # js2-mode : &quot;js&quot;
-  when /source\.lua/ : &quot;lua&quot;
-  when /source\.ocaml/ : &quot;ml&quot;
-  when /source\.objc/, &quot;source.objc++&quot; : &quot;m&quot;
-  when /source\.perl/ : &quot;pl&quot;
-  when /source\.php/ : &quot;php&quot;
-  when /source\.python/ : &quot;sc&quot;
-  when /source\.ruby/ : &quot;rb&quot; # Emacs bundle uses rbx
-  when /text\.plain/ : &quot;txt&quot;
-  when /source\.sql/ : &quot;sql&quot;
-  when /source\.scheme/ : &quot;scm&quot;
-  when /source\.smalltalk/ : &quot;st&quot;
-  when /source\.shell/ : &quot;sh&quot;
-  when /source\.tcl/, &quot;text.html.tcl&quot; : &quot;tcl&quot;
-  when /source\.lex/ : &quot;tex&quot;
-  when /text\.xml/, /text.xml.xsl/, /source.plist/, /text.xml.plist/ : &quot;xml&quot;
-  else &quot;txt&quot;
-  end
-end
-
-selection = nil
-gistname = nil
-if ENV['TM_SELECTED_TEXT']
-  selection = ENV['TM_SELECTED_TEXT']
-  gistname = &quot;snippet&quot; &lt;&lt; &quot;.&quot; &lt;&lt; get_extension
-else
-  selection = STDIN.read
-  gistname = ENV['TM_FILEPATH'] ? ENV['TM_FILEPATH'].split('/')[-1] : &quot;file&quot; &lt;&lt; &quot;.&quot; &lt;&lt; get_extension
-end
-
-if url = Gist.write(gistname, selection, ARGV[0] == &quot;private&quot; ? true : false)
-  puts &quot;Created gist at #{url}. URL copied to clipboard.&quot;
-end
\ No newline at end of file
+Gist.clear
+Gist.process_selection
+Gist.send(ARGV[0] == &quot;private&quot;)</diff>
      <filename>Support/bin/create_gist_from_selection.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,41 +8,116 @@ module Gist
   extend self
 
   @@gist_url = 'http://gist.github.com/%s.txt'
+  @@files = []
 
   def read(gist_id)
     return help if gist_id == '-h' || gist_id.nil? || gist_id[/help/]
     open(@@gist_url % gist_id).read
   end
-
-  def write(gistname, content, private_gist)
+  
+  def add_file(name, content)
+    load_files
+    @@files &lt;&lt; {:name =&gt; name, :content =&gt; content}
+    puts &quot;#{name} added.&quot;
+    save_files
+  end
+  
+  def send(private_gist)
+    load_files
     url = URI.parse('http://gist.github.com/gists')
-    req = Net::HTTP.post_form(url, data(gistname, nil, content, private_gist))
-    copy req['Location']
+    req = Net::HTTP.post_form(url, data(private_gist))
+    url = copy req['Location']
+    puts &quot;Created gist at #{url}. URL copied to clipboard.&quot;
+    clear
+  end
+  
+  def clear
+    @@files = []
+    save_files
+  end
+  
+  def process_selection
+    selection = nil
+    gistname = nil
+    if ENV['TM_SELECTED_TEXT']
+      selection = ENV['TM_SELECTED_TEXT']
+      gistname = &quot;snippet&quot; &lt;&lt; &quot;.&quot; &lt;&lt; get_extension
+    else
+      selection = STDIN.read
+      gistname = ENV['TM_FILEPATH'] ? ENV['TM_FILEPATH'].split('/')[-1] : &quot;file&quot; &lt;&lt; &quot;.&quot; &lt;&lt; get_extension
+    end
+    
+    add_file(gistname, selection)
+  end
+  
+  # Add extension for supported modes based on TM_SCOPE
+  # Cribbed from http://github.com/defunkt/gist.el/tree/master/gist.el
+  def get_extension
+    scope = ENV[&quot;TM_SCOPE&quot;].split[0]
+    case scope
+    when /source\.actionscript/ : &quot;as&quot;
+    when /source\.c/, &quot;source.objc&quot; : &quot;c&quot;
+    when /source\.c\+\+/, &quot;source.objc++&quot; : &quot;cpp&quot;
+    # common-lisp-mode : &quot;el&quot;
+    when /source\.css/ : &quot;css&quot;
+    when /source\.diff/, &quot;meta.diff.range&quot; : &quot;diff&quot;
+    # emacs-lisp-mode : &quot;el&quot;
+    when /source\.erlang/ : &quot;erl&quot;
+    when /source\.haskell/, &quot;text.tex.latex.haskel&quot; : &quot;hs&quot;
+    when /text\.html/ : &quot;html&quot;
+    when /source\.io/ : &quot;io&quot;
+    when /source\.java/ : &quot;java&quot;
+    when /source\.js/ : &quot;js&quot;
+    # jde-mode : &quot;java&quot;
+    # js2-mode : &quot;js&quot;
+    when /source\.lua/ : &quot;lua&quot;
+    when /source\.ocaml/ : &quot;ml&quot;
+    when /source\.objc/, &quot;source.objc++&quot; : &quot;m&quot;
+    when /source\.perl/ : &quot;pl&quot;
+    when /source\.php/ : &quot;php&quot;
+    when /source\.python/ : &quot;sc&quot;
+    when /source\.ruby/ : &quot;rb&quot; # Emacs bundle uses rbx
+    when /text\.plain/ : &quot;txt&quot;
+    when /source\.sql/ : &quot;sql&quot;
+    when /source\.scheme/ : &quot;scm&quot;
+    when /source\.smalltalk/ : &quot;st&quot;
+    when /source\.shell/ : &quot;sh&quot;
+    when /source\.tcl/, &quot;text.html.tcl&quot; : &quot;tcl&quot;
+    when /source\.lex/ : &quot;tex&quot;
+    when /text\.xml/, /text.xml.xsl/, /source.plist/, /text.xml.plist/ : &quot;xml&quot;
+    else &quot;txt&quot;
+    end
   end
 
 private
+  def load_files
+    path = File.join(File.dirname(__FILE__), 'tmp_gists')
+    save_files unless File.exists?(path)
+    @@files = Marshal.load(File.read(path))
+    @@files ||= []
+  end
+  
+  def save_files
+    path = File.join(File.dirname(__FILE__), 'tmp_gists')
+    File.open(path, 'w') {|f| f.puts Marshal.dump(@@files) }
+  end
+  
   def copy(content)
-    case RUBY_PLATFORM
-    when /darwin/
-      return content if `which pbcopy`.strip == ''
-      IO.popen('pbcopy', 'r+') { |clip| clip.puts content }
-    when /linux/
-      return content if `which xclip`.strip == ''
-      IO.popen('xclip', 'r+') { |clip| clip.puts content }
-    when /i386-cygwin/
-    	return content if `which putclip`.strip == ''
-      IO.popen('putclip', 'r+') { |clip| clip.puts content }
-  	end
-  	
+    return content if `which pbcopy`.strip == ''
+    IO.popen('pbcopy', 'r+') { |clip| clip.puts content }
   	content
   end
 
-  def data(name, ext, content, private_gist)
-    return {
-      'file_ext[gistfile1]'      =&gt; ext,
-      'file_name[gistfile1]'     =&gt; name,
-      'file_contents[gistfile1]' =&gt; content
-    }.merge(private_gist ? { 'private' =&gt; 'on' } : {}).merge(auth)
+  def data(private_gist)
+    params = {}
+    @@files.each_with_index do |file, i|
+      params.merge!({
+        &quot;file_ext[gistfile#{i+1}]&quot;      =&gt; nil,
+        &quot;file_name[gistfile#{i+1}]&quot;     =&gt; file[:name],
+        &quot;file_contents[gistfile#{i+1}]&quot; =&gt; file[:content]
+      })
+    end
+    params.merge(private_gist ? { 'private' =&gt; 'on' } : {}).merge(auth)
   end
 
   def auth</diff>
      <filename>Support/lib/gist.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,6 +10,11 @@
 			&lt;string&gt;67262491-0033-4FF6-9AB7-46187500012D&lt;/string&gt;
 			&lt;string&gt;------------------------------------&lt;/string&gt;
 			&lt;string&gt;452D34DC-9122-4196-9BB1-BA571D21A8BB&lt;/string&gt;
+			&lt;string&gt;4D3B092F-0ABC-4152-923B-99D0B94B46B9&lt;/string&gt;
+			&lt;string&gt;4F4468C5-5CF8-4272-B87C-7CF1A56B1710&lt;/string&gt;
+			&lt;string&gt;------------------------------------&lt;/string&gt;
+			&lt;string&gt;51A5A6E5-7A54-4C4E-A315-02247461D9D4&lt;/string&gt;
+			&lt;string&gt;C5646D06-0BE2-49EA-B672-B34F56F880EB&lt;/string&gt;
 		&lt;/array&gt;
 		&lt;key&gt;submenus&lt;/key&gt;
 		&lt;dict/&gt;
@@ -23,6 +28,9 @@
 		&lt;string&gt;4D3B092F-0ABC-4152-923B-99D0B94B46B9&lt;/string&gt;
 		&lt;string&gt;4F4468C5-5CF8-4272-B87C-7CF1A56B1710&lt;/string&gt;
 		&lt;string&gt;452D34DC-9122-4196-9BB1-BA571D21A8BB&lt;/string&gt;
+		&lt;string&gt;51A5A6E5-7A54-4C4E-A315-02247461D9D4&lt;/string&gt;
+		&lt;string&gt;C5646D06-0BE2-49EA-B672-B34F56F880EB&lt;/string&gt;
+		&lt;string&gt;C8E0241B-0139-4DA0-A077-E1396148A1F9&lt;/string&gt;
 	&lt;/array&gt;
 	&lt;key&gt;uuid&lt;/key&gt;
 	&lt;string&gt;D79413BD-058B-4D38-9A99-776E2088932F&lt;/string&gt;</diff>
      <filename>info.plist</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f2ab428cd85113a6343edbc4a5d29fbb438c9080</id>
    </parent>
  </parents>
  <author>
    <name>teamon</name>
    <email>i@teamon.eu</email>
  </author>
  <url>http://github.com/drnic/github-tmbundle/commit/dca2243dccb1333504ce9b07ac8aaf8fbf80bc17</url>
  <id>dca2243dccb1333504ce9b07ac8aaf8fbf80bc17</id>
  <committed-date>2009-01-18T04:10:32-08:00</committed-date>
  <authored-date>2009-01-18T04:10:32-08:00</authored-date>
  <message>Added support for multifile gists</message>
  <tree>036fd6e2c327763bbf746b28ba16c55a3504f666</tree>
  <committer>
    <name>teamon</name>
    <email>i@teamon.eu</email>
  </committer>
</commit>
