Created
April 21, 2011 03:28
-
-
Save swdyh/933656 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmd :gyast, '', 'post screencapture' do | |
now = Time.now.to_i | |
file_jpg = "/tmp/#{now}.jpg" | |
system "screencapture -i -t jpg \"#{file_jpg}\"" | |
unless File.exist? file_jpg | |
exit | |
end | |
begin | |
url = @g.create file_jpg | |
rescue Gisty::InvalidFileException => e | |
puts "Error: invalid file" | |
rescue Exception => e | |
puts "Error: #{e}" | |
else | |
id = url.split('/').last | |
system "open https://gist.github.com/raw/#{id}/#{now}.jpg" if /darwin/ === RUBY_PLATFORM | |
end | |
File.delete file_jpg | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment