Sha256: 53d23358610830f6bfc254e38109884f4bace299bf89e0dc661ff27cd5bc4126

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

require 'rake/clean'

WARNING = <<-EOS.freeze
   WARNING: you may not have wget installed

EOS

WORDCRAM_VERSION     = '1.0.0'
CLOBBER.include("wordcram.#{WORDCRAM_VERSION}.zip")

desc "download, and copy to wordcram/lib"
task :default => [:download, :unpack_library, :copy_jars]

desc "download wordcram upstream sources"
task :download => ["wordcram.#{WORDCRAM_VERSION}.zip"]

file "wordcram.#{WORDCRAM_VERSION}.zip" do
  begin
    sh "wget http://wordcram.org/wordcram.#{WORDCRAM_VERSION}.zip"
  rescue
    warn(WARNING)
  end
  check_sha256("wordcram.#{WORDCRAM_VERSION}.zip", "d6b936db3628806099eba3f309fad81dae7f3db5e2a2846742c959b03eb0d25f")
end

desc "unpack wordcram library"
task :unpack_library do
  sh "unzip wordcram.#{WORDCRAM_VERSION}.zip"
end

directory "../lib"

desc "copy jars"
task :copy_jars => ["../lib"] do
  sh "cp -v WordCram/library/WordCram.jar ../lib/WordCram.jar"
  sh "cp -v WordCram/library/cue.language.jar ../lib/cue.language.jar"
  sh "cp -v WordCram/library/jsoup-1.7.2.jar ../lib/jsoup-1.7.2.jar"
end

def check_sha256(filename, expected_hash)
  require "digest"
  sha256 = Digest::SHA256.new
  File.open(filename, "r") do |f|
    while buf = f.read(4096)
      sha256.update(buf)
    end
  end
  if sha256.hexdigest != expected_hash
    raise "bad sha256 checksum for #{filename} (expected #{expected_hash} got #{sha256.hexdigest})"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby_wordcram-1.0.1 vendors/Rakefile
ruby_wordcram-1.0.0 vendors/Rakefile