forked from alexyoung/ico
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Rakefile
executable file
·31 lines (26 loc) · 883 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'rubygems'
desc 'Packages Grafico'
task :package => [:require_compiler] do
sources = ['base', 'line', 'bar', 'spark']
packaged = File.join(File.dirname(__FILE__), 'packaged', 'grafico.min.js')
unpackagedsize = 0
contents = sources.map do |source|
file = File.join(File.dirname(__FILE__), 'source', "grafico.#{source}.js")
unpackagedsize += File.size(file)
File.read(file)
end.join("\n")
File.open(packaged, "w") do |f|
puts "Unpackaged: " + (unpackagedsize/1000).to_s + "KB"
f.write Closure::Compiler.new.compile(contents)
puts "Packaged: " + (File.size?(packaged)/1000).to_s + "KB (in " + packaged + ")"
end
end
task :require_compiler do
begin
require 'closure-compiler'
rescue LoadError
puts "Install closure-compiler:"
puts "sudo gem install closure-compiler --source http://gemcutter.org"
abort
end
end