Created
November 19, 2008 05:14
-
-
Save brynary/26424 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 :selenium do | |
namespace :app_server do | |
desc "Start a mongrel for the selenium environment on port 3001" | |
task :start do | |
rails_root = File.expand_path(File.dirname(__FILE__) + "/../..") | |
pid_file = File.expand_path(rails_root + "/tmp/pids/mongrel_selenium.pid") | |
system "cd #{rails_root}; mongrel_rails start -d -e selenium -p 3001 -c #{rails_root} --pid #{pid_file}" | |
end | |
desc "Start or restart a mongrel for the selenium environment on port 3001" | |
task :restart do | |
rails_root = File.expand_path(File.dirname(__FILE__) + "/../..") | |
pid_file = File.expand_path(rails_root + "/tmp/pids/mongrel_selenium.pid") | |
running = false | |
if File.exists?(pid_file) && (pid = open(pid_file).read.to_i) | |
begin | |
Process::kill 0, pid | |
running = true | |
rescue Errno::ESRCH, Errno::EPERM | |
end | |
end | |
if running | |
system "cd #{rails_root}; mongrel_rails restart -c #{rails_root} --pid #{pid_file}" | |
else | |
system "cd #{rails_root}; mongrel_rails start -d -e selenium -p 3001 -c #{rails_root} --pid #{pid_file}" | |
end | |
end | |
desc "Stop a mongrel for the selenium environment on port 3001" | |
task :stop do | |
rails_root = File.expand_path(File.dirname(__FILE__) + "/../..") | |
pid_file = File.expand_path(rails_root + "/tmp/pids/mongrel_selenium.pid") | |
system "cd #{rails_root}; mongrel_rails stop -c #{rails_root} --pid #{pid_file}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment