Skip to content

Instantly share code, notes, and snippets.

@dictav
Last active August 29, 2015 14:03
Show Gist options
  • Save dictav/219db360b121c25dd74c to your computer and use it in GitHub Desktop.
Save dictav/219db360b121c25dd74c to your computer and use it in GitHub Desktop.
Guard::Selenium starts your Selenium server
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