box-o-sand/sylvilagus/jruby/Rakefile

38 lines
1.1 KiB
Ruby
Raw Normal View History

require 'open-uri'
RMQ_URI_BASE = 'http://www.rabbitmq.com/releases/rabbitmq-java-client'
RMQV = '2.8.7'
directory './tmp'
file "./tmp/rabbitmq-java-client-bin-#{RMQV}.tar.gz" => ['./tmp'] do |t|
puts "*** Downloading tarball"
open("#{RMQ_URI_BASE}/v#{RMQV}/rabbitmq-java-client-bin-#{RMQV}.tar.gz") do |dl|
open(t.name, 'w') do |out|
out.write(dl.read)
end
end
end
file "./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar" =>
["./tmp/rabbitmq-java-client-bin-#{RMQV}.tar.gz"] do
puts "*** Extracting tarball"
Dir.chdir('./tmp') do
sh "tar xzvf rabbitmq-java-client-bin-#{RMQV}.tar.gz"
end
end
file './lib/java/rabbitmq-client.jar' =>
["./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar"] do
puts "*** Copying jars"
Dir["./tmp/rabbitmq-java-client-bin-#{RMQV}/*.jar"].each do |jar|
puts "*** Copying #{jar} to ./lib/java"
FileUtils.cp(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]