Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment