forked from kossnocorp/role
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
24 lines (21 loc) · 777 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
# encoding: utf-8
task default: :test
desc 'Use UglifyJS to compress javascript'
task :build do
require 'uglifier'
%w(jquery.role role).each do |filename|
source = source = File.read("lib/#{filename}.js")
compressed = Uglifier.compile(source, copyright: false)
File.open("lib/#{filename}.min.js", 'w'){ |f| f.write(compressed) }
rate = compressed.length.to_f/source.length
puts "Compressed #{filename}.js: #{compressed.length}/#{source.length} #{(rate * 100).round}%"
end
end
JQUERY_VERSIONS = %w(1.2.6 1.3.2 1.4.2 1.5.2 1.6.1 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2)
desc 'Run tests'
task :test do
results = JQUERY_VERSIONS.map do |version|
system %{phantomjs ./test/phantom-test.js "test/test.html##{version}"}
end
exit(results.all?? 0 : 1)
end