Revision: 533
                            
                                                            
                                    
                                        
Updated Code
                                    
                                    
                                                    
                        at July 18, 2006 02:10 by nolith
                            
                            Updated Code
#!/usr/bin/env ruby
##Licence
# ger_from_pastie.rb - A TextMate command for getting file from http://pastie.caboo.se
#Copyright (C) 2006  Alessio Caiazza - abisso.org
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software Foundation,
#Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
##Installation
# for install create a new command in textmate and paste this code
# select Input: None and Output: Create New Document
# enjoy     
              
##Script
require 'net/http'
def request_document_number
  s = `\"#{ENV['TM_SUPPORT_PATH']}/bin/CocoaDialog.app/Contents/MacOS/CocoaDialog\" inputbox --title 'Get from Pastie' --informative-text 'Please enter the number of document to download' --text '' --button1 'Get' --button2 'Cancel'`
  case (a = s.split("\n"))[0].to_i
  when 1 then a[1].to_i
  when 2 then puts "Abort"; abort
  end
end  
begin                                 
  number = request_document_number 
  document = index = Net::HTTP.get_print(
    URI.parse("http://pastie.caboo.se/#{number}/download"))
rescue
  "Some error, document number may be wrong" 
end
                                
                            Revision: 532
                            
                                                            
                                    
                                        
Initial Code
                                    
                                    
                                
                                                            
                                    
                                        
Initial URL
                                    
                                    
                                
                                                            
                                    
                                        
Initial Description
                                    
                                    
                                
                                                            
                                    
                                        
Initial Title
                                    
                                    
                                                            
                                    
                                        
Initial Tags
                                    
                                    
                                                            
                                    
                                        
Initial Language
                                    
                                    
                                                    
                        at July 18, 2006 02:09 by nolith
                            
                            Initial Code
Initial URL
Initial Description
Initial Title
Get from Pastie - Textmate Command
Initial Tags
textmate, ruby
Initial Language
Ruby