Sha256: 83216005f82cbe7e9e7ce6670e0f215c3e095552286df2c7bf1e296694fd78d9

Contents?: true

Size: 1.18 KB

Versions: 8

Compression:

Stored size: 1.18 KB

Contents

require 'fileutils'
require 'open-uri'

namespace :test do
  desc "Download third party libraries needed to successfully run tests"
  task :setup do
    root = File.join(File.dirname(__FILE__), "../../test/bin")
    yui242 = File.join(root, "yuicompressor-2.4.2.zip")
    jslint = File.join(root, "jslint.js")
    rhino = File.join(root, "rhino1_7R2-RC1.zip")

    download("http://www.julienlecomte.net/yuicompressor/yuicompressor-2.4.2.zip")
    FileUtils.cp(File.join(root, "yuicompressor-2.4.2.zip"), File.join(root, "yuicompressor-2.3.5.zip"))
    download("http://www.jslint.com/rhino/jslint.js")
    download("ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R1.zip")
    download("ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R2-RC1.zip")
    download("http://www.julienlecomte.net/yuicompressor/")
  end
end

def download(url)
  filename = File.expand_path(File.join(File.dirname(__FILE__), "../../test/bin", File.basename(url)))
  return filename if File.exists?(filename)

  puts "Downloading #{url} to #{filename}"
  FileUtils.mkdir_p(File.dirname(filename))

  File.open(filename, "wb") do |file|
    webpage = open(url)
    file.write(webpage.read)
    webpage.close
  end

  filename
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
cjohansen-juicer-0.2.4 tasks/test/setup.rake
cjohansen-juicer-0.2.5 tasks/test/setup.rake
juicer-0.2.6 tasks/test/setup.rake
juicer-0.2.0 tasks/test/setup.rake
juicer-0.2.5 tasks/test/setup.rake
juicer-0.2.1 tasks/test/setup.rake
juicer-0.2.4 tasks/test/setup.rake
juicer-0.2.3 tasks/test/setup.rake