Created
August 5, 2010 08:19
-
-
Save fbehrens/509423 to your computer and use it in GitHub Desktop.
process commands with pid file
This file contains 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
#rakefile | |
require 'rake' | |
extend FileUtils | |
PID = '.pid' | |
task :default => :reset | |
module Kernel | |
def pid | |
raise "pid file already exists" if File.exists? PID | |
touch PID | |
yield | |
rm PID | |
end | |
end | |
desc "deletes PID file" | |
task :reset do | |
rm PID | |
end | |
desc "invokes my awkyard command" | |
task :short do | |
pid do | |
system 'ls' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment