Sha256: 11c3341d19f0cad310a695fb358d82116f6936801d71aa1f7469c398aef0e096

Contents?: true

Size: 1.28 KB

Versions: 13

Compression:

Stored size: 1.28 KB

Contents

Bundler::GemHelper.install_tasks

desc 'Generates an RSpec requires file free of dynamic requires'
task :generate_requires do
  # Do this free of any requires used to make this Rake task happen
  sh 'bin/generate_requires'
end

desc "Build build/opal-rspec.js"
task :dist do
  require 'fileutils'
  FileUtils.mkdir_p 'build'

  builder = Opal::Builder.new(stubs: Opal::Config.stubbed_files, # stubs already specified in lib/opal/rspec.rb
                              compiler_options: { dynamic_require_severity: :ignore }) # RSpec is full of dynamic requires
  src = builder.build('opal-rspec')

  min = uglify src
  gzp = gzip min

  File.open('build/opal-rspec.js', 'w+') do |out|
    out << src
  end

  puts "development: #{src.size}, minified: #{min.size}, gzipped: #{gzp.size}"
end

# Used for uglifying source to minify
def uglify(str)
  IO.popen('uglifyjs', 'r+') do |i|
    i.puts str
    i.close_write
    return i.read
  end
rescue Errno::ENOENT
  $stderr.puts '"uglifyjs" command not found (install with: "npm install -g uglify-js")'
  nil
end

# Gzip code to check file size
def gzip(str)
  IO.popen('gzip -f', 'r+') do |i|
    i.puts str
    i.close_write
    return i.read
  end
rescue Errno::ENOENT
  $stderr.puts '"gzip" command not found, it is required to produce the .gz version'
  nil
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
opal-rspec-1.1.0.alpha3 tasks/building.rake
opal-rspec-1.1.0.alpha2 tasks/building.rake
opal-rspec-1.1.0.alpha1 tasks/building.rake
opal-rspec-1.0.0 tasks/building.rake
opal-rspec-1.0.0.alpha1 tasks/building.rake
opal-rspec-0.8.0 tasks/building.rake
opal-rspec-0.8.0.alpha3 tasks/building.rake
opal-rspec-0.8.0.alpha2 tasks/building.rake
opal-rspec-0.8.0.alpha1 tasks/building.rake
opal-rspec-0.7.1 tasks/building.rake
opal-rspec-0.7.0 tasks/building.rake
opal-rspec-0.7.0.rc.2 tasks/building.rake
opal-rspec-0.7.0.rc.1 tasks/building.rake