Skip to content

Instantly share code, notes, and snippets.

@ftiasch
Last active August 29, 2015 13:56
Show Gist options
  • Save ftiasch/9105635 to your computer and use it in GitHub Desktop.
Save ftiasch/9105635 to your computer and use it in GitHub Desktop.
A auto-updated scripts for topcoder arena
require 'rexml/document'
require 'open-uri'
task :default => :run
task :run do
sh '(java -classpath "lib/*" com.topcoder.client.contestApplet.runner.generic www.topcoder.com 5001 >/dev/null 2>&1 &)'
end
task :update do
document = REXML::Document.new(open('http://www.topcoder.com/contest/arena/ContestAppletProd.jnlp'))
dependencies = []
document.each_element('jnlp/resources/jar') do |jar|
dependencies << jar.attribute('href')
end
rm_rf 'lib'
mkdir 'lib'
chdir 'lib'
dependencies.each do |dependency|
sh "wget -c \"#{dependency}\""
end
chdir '..'
end
task :make => :update do
sh "tar czvf topcoder.tar.gz run.bat run.sh lib/"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment