Created
October 10, 2010 01:20
-
-
Save ahawkins/618813 to your computer and use it in GitHub Desktop.
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
namespace :specjour do | |
def specjour_dir | |
"~/.specjour/#{fetch(:project_name)}" | |
end | |
def specjour_pid_file | |
specjour_dir + "/manager.pid" | |
end | |
task :start, :roles => :test do | |
run "mkdir -p #{specjour_dir}" | |
run "mkdir -p #{project_path}" | |
run "cd #{project_path} ; screen -dmS specjour specjour ; true" | |
screens = capture "screen -ls ; true" | |
logger.info screens | |
match_data = screens.match /(\d+)\.specjour/ | |
pid = match_data[1] | |
run "echo #{pid} > #{specjour_pid_file}" | |
end | |
task :stop, :roles => :test do | |
run %Q{if [ -f #{specjour_pid_file} ] ; then kill $(cat #{specjour_pid_file}) ; rm #{specjour_pid_file} ; screen -wipe ; fi ; true} | |
end | |
task :pid, :roles => :test do | |
pid = capture "echo #{specjour_pid_file}" | |
logger.info "PID: #{pid}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment