Skip to content

Instantly share code, notes, and snippets.

@pablo-meier
Created October 28, 2010 07:09
Show Gist options
  • Save pablo-meier/650815 to your computer and use it in GitHub Desktop.
Save pablo-meier/650815 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
FILENAME = "this_many_pushes.txt"
PUSH_IT_DIR = "/Users/pmeier/Desktop/projects/push_it"
command = "git push "
ARGV.each { |x| command += x + " " }
puts command
success = system(command)
if not success then puts "Push failed!"; Process.exit end
num_pushes = File.read(FILENAME).strip.to_i
puts num_pushes.to_s
if num_pushes == 0
puts "Push it!"
system("mpg123 #{PUSH_IT_DIR}/push_it.mp3 &")
system("echo '5' > #{FILENAME}")
else
system("echo '#{num_pushes - 1}' > #{FILENAME}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment