require 'open-uri' directory './tmp' file './tmp/rabbitmq-java-client-bin-2.8.7.tar.gz' => ['./tmp'] do |f| open('http://www.rabbitmq.com/releases/rabbitmq-java-client/v2.8.7/rabbitmq-java-client-bin-2.8.7.tar.gz') do |f| open('./tmp/rabbitmq-java-client-bin.tar.gz', 'w') do |out| out.write(f.read) end end end file './tmp/rabbitmq-java-client-bin-2.8.7' => ['./tmp/rabbitmq-java-client-bin-2.8.7.tar.gz'] do Dir.chdir('./tmp') do `tar xzvf rabbitmq-java-client-bin.tar.gz` end end file './lib/java/rabbitmq-client.jar' => ['./tmp/rabbitmq-java-client-bin-2.8.7'] do Dir['./tmp/rabbitmq-java-client-bin-2.8.7/*.jar'].each do |jar| FileUtils.mv(jar, './lib/java', :verbose => true) end end desc 'Download and copy over the rabbitmq client jar' task :rabbitmq_client_jar => ['./lib/java/rabbitmq-client.jar'] task :default => [:rabbitmq_client_jar]