Created
February 4, 2015 16:10
-
-
Save taichi/5b9cedc8f9a855c021f6 to your computer and use it in GitHub Desktop.
jruby download script using ruby.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :jruby do | |
VERSION = "1.7.18" | |
ZIPPATH = ".jruby/#{VERSION}.zip" | |
task :extract do | |
require 'zip' | |
Zip::File.open ZIPPATH do |zf| | |
zf.each do |e| | |
zf.extract e, ".jruby/#{e.to_s}" | |
end | |
end | |
end | |
def download (type, dest) | |
require 'open-uri' | |
require 'net/https' | |
target = "https://s3.amazonaws.com/jruby.org/downloads/#{VERSION}/jruby-#{type}-#{VERSION}.zip" | |
puts "download from #{target}" | |
open(target, "rb", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE) do |tmp| | |
cp tmp, dest | |
end | |
end | |
task :fetch do | |
download 'bin', ZIPPATH | |
download 'src', ".jruby/#{VERSION}-src.zip" | |
end | |
desc "fetch and extract JRuby-#{VERSION} to local directory." | |
task :install => [:fetch, :extract] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment