Created
November 20, 2013 07:33
-
-
Save monkstone/7559135 to your computer and use it in GitHub Desktop.
Bleeding edge jruby-complete installer for ruby-processing
This file contains 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
require 'rake/clean' | |
#JRUBY_VERSION = "1.7.8" | |
JRUBY_VERSION = "9000.dev" | |
CLOBBER.include("jruby-complete-#{JRUBY_VERSION}.jar") | |
desc "download, and copy to ruby-processing" | |
task :default => [:download, :copy_ruby] | |
desc "download JRuby upstream sources" | |
task :download => ["jruby-complete-#{JRUBY_VERSION}.jar"] | |
file "jruby-complete-#{JRUBY_VERSION}.jar" do | |
sh "wget http://ci.jruby.org/snapshots/master/jruby-complete-#{JRUBY_VERSION}.jar" | |
sh "wget http://ci.jruby.org/snapshots/master/jruby-complete-#{JRUBY_VERSION}.jar.sha1" | |
sha1 = File.read("jruby-complete-#{JRUBY_VERSION}.jar.sha1").chomp | |
check_sha1("jruby-complete-#{JRUBY_VERSION}.jar", sha1) | |
end | |
directory "../lib/ruby" | |
desc "copy jruby-complete" | |
task :copy_ruby => ["../lib/ruby"] do | |
sh "cp -v jruby-complete-#{JRUBY_VERSION}.jar ../lib/ruby/jruby-complete.jar" | |
end | |
def check_sha1(filename, expected_hash) | |
require "digest/sha1" | |
sha1 = Digest::SHA1.new | |
File.open(filename, "r") do |f| | |
while buf = f.read(4096) | |
sha1.update(buf) | |
end | |
end | |
if sha1.hexdigest != expected_hash | |
raise "bad sha1 checksum for #{filename} (expected #{expected_hash} got #{sha1.hexdigest})" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment