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' RMQ_URI_BASE = 'http://www.rabbitmq.com/releases/rabbitmq-java-client'
RMQV = '2.8.7' RMQV = '2.8.7'
GSONV = '2.2.2'
directory './tmp' 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| file "./tmp/rabbitmq-java-client-bin-#{RMQV}.tar.gz" => ['./tmp'] do |t|
puts "*** Downloading tarball" sh "curl -s -o #{t.name} " <<
open("#{RMQ_URI_BASE}/v#{RMQV}/rabbitmq-java-client-bin-#{RMQV}.tar.gz") do |dl| "#{RMQ_URI_BASE}/v#{RMQV}/rabbitmq-java-client-bin-#{RMQV}.tar.gz"
open(t.name, 'w') do |out|
out.write(dl.read)
end
end
end end
file "./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar" => file "./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar" =>
["./tmp/rabbitmq-java-client-bin-#{RMQV}.tar.gz"] do ["./tmp/rabbitmq-java-client-bin-#{RMQV}.tar.gz"] do
puts "*** Extracting tarball"
Dir.chdir('./tmp') do 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
end end
file './lib/java/rabbitmq-client.jar' => file './lib/java/rabbitmq-client.jar' =>
["./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar"] do ["./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar", './lib/java'] do
puts "*** Copying jars" sh "cp ./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar ./lib/java/"
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 end
desc 'Download and copy over the rabbitmq client jar' desc 'Do everything to set up the things'
task :rabbitmq_client_jar => ['./lib/java/rabbitmq-client.jar'] task :setup => ['./lib/java/rabbitmq-client.jar', './lib/java/gson.jar']
task :default => [:rabbitmq_client_jar] task :default => :setup