Sha256: dbde7e45c557afff645e712f0ce1eb8077dcbf74870d7cfe4d9044927a945977

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require 'bundler'
Bundler.require
Bundler::GemHelper.install_tasks

require 'opal/rspec/rake_task'
Opal::RSpec::RakeTask.new(:default) do |s|
    s.index_path = 'spec/html/index.html.erb'
end

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

  src = Opal::Builder.build('opal-bootbox')
  #min = uglify src
  #gzp = gzip min

  File.open('build/opal-bootbox.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

4 entries across 4 versions & 1 rubygems

Version Path
opal-bootbox-0.1.3 lib/Rakefile
opal-bootbox-0.1.2 lib/Rakefile
opal-bootbox-0.1.1 lib/Rakefile
opal-bootbox-0.1.0 lib/Rakefile