2012-11-17 00:38:13 +00:00
|
|
|
require 'open-uri'
|
|
|
|
|
2012-11-17 01:25:44 +00:00
|
|
|
RMQ_URI_BASE = 'http://www.rabbitmq.com/releases/rabbitmq-java-client'
|
|
|
|
RMQV = '2.8.7'
|
|
|
|
|
2012-11-17 00:38:13 +00:00
|
|
|
directory './tmp'
|
|
|
|
|
2012-11-19 13:45:55 +00:00
|
|
|
file "./tmp/rabbitmq-java-client-bin-#{RMQV}.tar.gz" => ['./tmp'] do |t|
|
2012-11-17 01:25:44 +00:00
|
|
|
puts "*** Downloading tarball"
|
2012-11-19 13:45:55 +00:00
|
|
|
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)
|
2012-11-17 00:38:13 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-11-17 01:25:44 +00:00
|
|
|
file "./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar" =>
|
|
|
|
["./tmp/rabbitmq-java-client-bin-#{RMQV}.tar.gz"] do
|
|
|
|
puts "*** Extracting tarball"
|
2012-11-17 00:38:13 +00:00
|
|
|
Dir.chdir('./tmp') do
|
2012-11-19 13:45:55 +00:00
|
|
|
sh "tar xzvf rabbitmq-java-client-bin-#{RMQV}.tar.gz"
|
2012-11-17 00:38:13 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-11-17 01:25:44 +00:00
|
|
|
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)
|
2012-11-17 00:38:13 +00:00
|
|
|
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]
|