Last active
August 29, 2015 14:03
-
-
Save dictav/219db360b121c25dd74c to your computer and use it in GitHub Desktop.
Guard::Selenium starts your Selenium server
This file contains hidden or 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
module ::Guard | |
class Selenium < Guard | |
def start | |
puts "Starting Selenium on port TODO" | |
IO.popen(executable) | |
puts "Selenium is running with PID #{pid}" | |
$?.success? | |
end | |
def stop | |
if pid | |
puts "Sending TERM signal to Selenium (#{pid})" | |
Process.kill("TERM", pid) | |
true | |
end | |
end | |
def reload | |
stop | |
start | |
end | |
def run_all | |
true | |
end | |
def run_on_change(paths) | |
true | |
end | |
private | |
def pidfile_path | |
options.fetch(:pidfile) { | |
File.expand_path('tmp/selenium.pid', File.dirname(__FILE__)) | |
} | |
end | |
def pid | |
File.exist?(pidfile_path) && File.read(pidfile_path).to_i | |
end | |
def executable | |
options.fetch(:executable){'selenium-server'} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment