Updating rakefile setup task to pull in gson, too

This commit is contained in:
Dan Buch 2012-11-22 16:23:42 -05:00
parent 12bd530e6f
commit c01332ff84

View File

@ -1,37 +1,43 @@
require 'open-uri'
RMQ_URI_BASE = 'http://www.rabbitmq.com/releases/rabbitmq-java-client'
RMQV = '2.8.7'
GSONV = '2.2.2'
directory './tmp'
directory './lib/java'
file "./tmp/google-gson-#{GSONV}-release.zip" => ['./tmp'] do |t|
sh "curl -s -o #{t.name} " <<
"http://google-gson.googlecode.com/files/google-gson-#{GSONV}-release.zip"
end
file "./tmp/google-gson-#{GSONV}" => ["./tmp/google-gson-#{GSONV}-release.zip"] do
Dir.chdir('./tmp') do
sh "unzip -f -o google-gson-#{GSONV}-release.zip"
end
end
file "./lib/java/gson.jar" => ["./tmp/google-gson-#{GSONV}", './lib/java'] do |t|
sh "cp ./tmp/google-gson-#{GSONV}/gson-#{GSONV}.jar #{t.name}"
end
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
sh "curl -s -o #{t.name} " <<
"#{RMQ_URI_BASE}/v#{RMQV}/rabbitmq-java-client-bin-#{RMQV}.tar.gz"
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"
sh "tar xzf 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
["./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar", './lib/java'] do
sh "cp ./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar ./lib/java/"
end
desc 'Download and copy over the rabbitmq client jar'
task :rabbitmq_client_jar => ['./lib/java/rabbitmq-client.jar']
desc 'Do everything to set up the things'
task :setup => ['./lib/java/rabbitmq-client.jar', './lib/java/gson.jar']
task :default => [:rabbitmq_client_jar]
task :default => :setup