forked from bgrins/javascript-astar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
29 lines (23 loc) · 772 Bytes
/
Rakefile
File metadata and controls
29 lines (23 loc) · 772 Bytes
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
require 'rubygems'
HEADER = /((^\s*\/\/.*\n)+)/
desc "rebuild the javascript-astar files for distribution"
task :build do
begin
require 'closure-compiler'
rescue LoadError
puts "closure-compiler not found.\nInstall it by running 'gem install closure-compiler"
exit
end
graph = File.read('graph.js')
astar = File.read('astar.js')
header = astar.match(HEADER)
File.open('dist/astar-concat.js', 'w+') do |file|
file.write graph + astar
end
File.open('dist/astar-min.js', 'w+') do |file|
compressedAstar = Closure::Compiler.new.compress(astar)
compressedGraph = Closure::Compiler.new.compress(graph)
file.write header[1].squeeze(' ') + compressedGraph + compressedAstar
end
system('docco graph.js astar.js')
end