Guest User

Untitled

a guest
Feb 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. namespace :selenium do
  2. namespace :app_server do
  3. desc "Start a mongrel for the selenium environment on port 3001"
  4. task :start do
  5. rails_root = File.expand_path(File.dirname(__FILE__) + "/../..")
  6. pid_file = File.expand_path(rails_root + "/tmp/pids/mongrel_selenium.pid")
  7.  
  8. system "cd #{rails_root}; mongrel_rails start -d -e selenium -p 3001 -c #{rails_root} --pid #{pid_file}"
  9. end
  10.  
  11. desc "Start or restart a mongrel for the selenium environment on port 3001"
  12. task :restart do
  13. rails_root = File.expand_path(File.dirname(__FILE__) + "/../..")
  14. pid_file = File.expand_path(rails_root + "/tmp/pids/mongrel_selenium.pid")
  15. running = false
  16.  
  17. if File.exists?(pid_file) && (pid = open(pid_file).read.to_i)
  18. begin
  19. Process::kill 0, pid
  20. running = true
  21. rescue Errno::ESRCH, Errno::EPERM
  22. end
  23. end
  24.  
  25. if running
  26. system "cd #{rails_root}; mongrel_rails restart -c #{rails_root} --pid #{pid_file}"
  27. else
  28. system "cd #{rails_root}; mongrel_rails start -d -e selenium -p 3001 -c #{rails_root} --pid #{pid_file}"
  29. end
  30. end
  31.  
  32. desc "Stop a mongrel for the selenium environment on port 3001"
  33. task :stop do
  34. rails_root = File.expand_path(File.dirname(__FILE__) + "/../..")
  35. pid_file = File.expand_path(rails_root + "/tmp/pids/mongrel_selenium.pid")
  36.  
  37. system "cd #{rails_root}; mongrel_rails stop -c #{rails_root} --pid #{pid_file}"
  38. end
  39. end
  40. end
Add Comment
Please, Sign In to add comment