Skip to content

Commit

Permalink
Revert: RakeHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 24, 2013
1 parent 2946e9b commit e2535fe
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 62 deletions.
33 changes: 27 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ require 'bundler'
Bundler.require
Bundler::GemHelper.install_tasks

require 'opal/rake_helper'
Opal::RakeHelper.install_tasks

namespace :github do
task :upload_assets do
require 'octokit'
Expand Down Expand Up @@ -64,7 +61,7 @@ class SpecEnvironment < Opal::Environment
end

def build_min file = 'build/specs.min.js'
build Opal::RakeHelper.uglify(specs), file
build uglify(specs), file
end

def build code = specs, file = 'build/specs.js'
Expand Down Expand Up @@ -178,8 +175,8 @@ task :dist do
puts "* building #{lib}..."

src = env[lib].to_s
min = Opal::RakeHelper.uglify src
gzp = Opal::RakeHelper.gzip min
min = uglify src
gzp = gzip min

File.open("build/#{lib}.js", 'w+') { |f| f << src }
File.open("build/#{lib}.min.js", 'w+') { |f| f << min } if min
Expand All @@ -197,3 +194,27 @@ desc "Rebuild grammar.rb for opal parser"
task :racc do
%x(racc -l lib/opal/grammar.y -o lib/opal/grammar.rb)
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
56 changes: 0 additions & 56 deletions lib/opal/rake_helper.rb

This file was deleted.

0 comments on commit e2535fe

Please sign in to comment.