forked from esamattis/underscore.string
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
23 lines (19 loc) · 831 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
# encoding: utf-8
task default: :test
desc 'Use UglifyJS to compress Underscore.string'
task :build do
require 'uglifier'
source = File.read('lib/underscore.string.js', :encoding => 'utf-8')
compressed = Uglifier.compile(source, copyright: false)
File.open('dist/underscore.string.min.js', 'w'){ |f| f.write compressed }
compression_rate = compressed.length.to_f/source.length
puts "compressed dist/underscore.string.min.js: #{compressed.length}/#{source.length} #{(compression_rate * 100).round}%"
end
desc 'Run tests'
task :test do
puts "Running underscore.string test suite."
result1 = system %{phantomjs ./test/run-qunit.js "test/test.html"}
puts "Running Underscore test suite."
result2 = system %{phantomjs ./test/run-qunit.js "test/test_underscore/index.html"}
exit(result1 && result2 ? 0 : 1)
end