forked from jashkenas/backbone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
42 lines (36 loc) · 1.17 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
require 'rubygems'
HEADER = /((^\s*\/\/.*\n)+)/
desc "rebuild the backbone-min.js 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
source = File.read 'backbone.js'
header = source.match(HEADER)
File.open('backbone-min.js', 'w+') do |file|
file.write header[1].squeeze(' ') + Closure::Compiler.new.compress(source)
end
end
desc "build the docco documentation"
task :doc do
check 'docco', 'docco', 'https://github.com/jashkenas/docco'
system 'docco backbone.js && docco examples/todos/todos.js examples/backbone-localstorage.js'
end
desc "run JavaScriptLint on the source"
task :lint do
system "jsl -nofilelisting -nologo -conf docs/jsl.conf -process backbone.js"
end
desc "test the CoffeeScript integration"
task :test do
check 'coffee', 'CoffeeScript', 'https://github.com/jashkenas/coffee-script.git'
system "coffee test/*.coffee"
end
# Check for the existence of an executable.
def check(exec, name, url)
return unless `which #{exec}`.empty?
puts "#{name} not found.\nInstall it from #{url}"
exit
end