Created
October 13, 2011 17:16
-
-
Save thefotios/1284843 to your computer and use it in GitHub Desktop.
This file contains 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
@ready_file = 'sauce_ready' | |
# Get the Sauce configuration information | |
cfg = Sauce::Config.new() | |
# Create a command to spawn the jar file | |
cmd = "java -jar Sauce-Connect.jar -f #{@ready_file} #{cfg.opts[:username]} #{cfg.opts[:access_key]}" | |
# Create a command to kill it when we're done | |
# Source: http://goo.gl/CCiFz | |
kill_cmd = "ps aux | grep -e '#{cmd}' | grep -v grep | awk '{print $2}' | xargs -i kill {}" | |
# Fork the jar | |
(`#{cmd} > /dev/null 2>&1` and exit) if fork.nil? | |
# Make sure to finish things off when the tests are done | |
at_exit{`#{kill_cmd}`} | |
# Wait for Sauce to be ready | |
until File.exists?(@ready_file) | |
puts "Waiting for Sauce Connect" | |
sleep 5 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment