forked from wise9/enchant.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
48 lines (40 loc) · 1.19 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'net/http'
RELEASES = ['enchant.js', 'enchant.min.js', 'doc/index.html']
CLEAN << 'enchant.min.js' << 'doc/index.html'
Copyright = <<EOS
/*
Copyright (c) Ubiquitous Entertainment Inc.
Dual licensed under the MIT or GPL Version 3 licenses
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl-3.0.html
*/
EOS
task :default => [:test]
task :create => RELEASES
task :test do |t|
Dir.glob('./examples/**/index.html') {|example|
res = `phantomjs test-phantomjs.js #{example} | grep Error`
print res
}
end
task :doc => ['doc/index.html'] do |t|
end
file 'enchant.min.js' => ['enchant.js'] do |t|
File.open(t.name, 'w') {|f|
uri = URI.parse('http://closure-compiler.appspot.com/compile')
req = Net::HTTP::Post.new(uri.request_uri)
req.set_form_data({
'js_code' => File.read('enchant.js'),
'compilation_level' => 'SIMPLE_OPTIMIZATIONS',
'output_format' => 'text',
'output_info' => 'compiled_code'
})
f << Net::HTTP.start(uri.host, uri.port) {|http| Copyright + http.request(req).body }
}
end
file 'doc/index.html' do |t|
sh 'jsdoc -d=doc -t=doc/template enchant.js'
end