require 'formula' class SeleniumServerStandalone < Formula homepage 'http://seleniumhq.org/' url 'http://selenium.googlecode.com/files/selenium-server-standalone-2.25.0.jar' sha1 '8e2b23874a6d3316079cf606ce7f75d221305934' def install prefix.install "selenium-server-standalone-#{version}.jar" plist_path.write startup_plist plist_path.chmod 0644 end def caveats; <<-EOS You can enable selenium-server to automatically load on login with: mkdir -p ~/Library/LaunchAgents cp "#{plist_path}" ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} If this is an upgrade and you already have the #{plist_path.basename} loaded: launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename} cp #{plist_path} ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} Or start it manually with: java -jar #{prefix}/selenium-server-standalone-#{version}.jar -p 4444 EOS end def startup_plist return <<-EOS Label #{plist_name} RunAtLoad KeepAlive ProgramArguments /usr/bin/java -jar #{prefix}/selenium-server-standalone-#{version}.jar -port 4444 ServiceDescription Selenium Server StandardErrorPath /var/log/selenium/selenium-error.log StandardOutPath /var/log/selenium/selenium-output.log EOS end end