Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 971e6d474d0c
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: eef232ceaf17
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Nov 8, 2013

  1. Whitespace

    elia committed Nov 8, 2013
    Copy the full SHA
    54a258a View commit details
  2. Copy the full SHA
    ecd6d42 View commit details
  3. Copy the full SHA
    eef232c View commit details
Showing with 12 additions and 9 deletions.
  1. +11 −8 Rakefile
  2. +1 −1 opal/core/hash.rb
19 changes: 11 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -54,9 +54,12 @@ task :dist do
env = Opal::Environment.new

Dir.mkdir 'build' unless File.directory? 'build'
libs = Dir['{opal,stdlib}/*.rb'].map { |lib| File.basename(lib, '.rb') }
width = libs.map(&:size).max

%w[opal opal-parser].each do |lib|
puts "* building #{lib}..."
libs.each do |lib|
print "* building #{lib}...".ljust(width+'* building ... '.size)
$stdout.flush

src = env[lib].to_s
min = uglify src
@@ -66,11 +69,11 @@ task :dist do
File.open("build/#{lib}.min.js", 'w+') { |f| f << min } if min
File.open("build/#{lib}.min.js.gz", 'w+') { |f| f << gzp } if gzp

print "done. (development: #{src.size}B"
print ", minified: #{min.size}B" if min
print ", gzipped: #{gzp.size}Bx" if gzp
print "done. ("
print "development: #{('%.2f' % (src.size/1000.0)).rjust(6)}KB"
print ", minified: #{('%.2f' % (min.size/1000.0)).rjust(6)}KB" if min
print ", gzipped: #{('%.2f' % (gzp.size/1000.0)).rjust(6)}KB" if gzp
puts ")."
puts
end
end

@@ -81,7 +84,7 @@ end

# Used for uglifying source to minify
def uglify(str)
IO.popen('uglifyjs', 'r+') do |i|
IO.popen('uglifyjs 2> /dev/null', 'r+') do |i|
i.puts str
i.close_write
return i.read
@@ -93,7 +96,7 @@ end

# Gzip code to check file size
def gzip(str)
IO.popen('gzip -f', 'r+') do |i|
IO.popen('gzip -f 2> /dev/null', 'r+') do |i|
i.puts str
i.close_write
return i.read
2 changes: 1 addition & 1 deletion opal/core/hash.rb
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ def initialize(defaults = undefined, &block)
}
}
else if (block !== nil) {
self.proc = block;
self.proc = block;
}
return self;