从Pastie-Textmate命令获取
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从Pastie-Textmate命令获取相关的知识,希望对你有一定的参考价值。
#!/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(" "))[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
以上是关于从Pastie-Textmate命令获取的主要内容,如果未能解决你的问题,请参考以下文章