-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
54 lines (45 loc) · 1.33 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
49
50
51
52
53
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/testtask'
require 'spec/rake/spectask'
task :default => [:spec]
#################################
## Custom tasks
#################################
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'lib')
def compileall(from, to, force = false)
require 'coffeecompiler'
outDir = File.expand_path to
coffeeDir = File.expand_path from
puts "Compiling all files: #{coffeeDir} -> #{outDir}"
compiler = CoffeeCompiler.new nil, force
begin
compiler.compileAll(__FILE__, coffeeDir, outDir)
rescue Exception => ex
puts ex.inspect
end
end
desc "compile all coffeescripts and start watching them"
task :compile_watch do
compileall 'lib', 'libjs'
system "watchr", 'compileall.rb'
end
desc "Forces the compilation of all coffeescripts and start watching them"
task :force_compile do
compileall 'lib', 'libjs', true
system "watchr", 'compileall.rb'
end
desc "Just compiles all coffeescripts"
task :compile do
compileall 'lib', 'libjs', true
end
desc "runs unit tests"
task :spec do
compileall 'lib', 'libjs'
compileall 'spec/coffee', 'spec/javascripts'
imports = %w[spec/jasmine-node/lib spec/javascripts libjs spec/dom]
system "env NODE_PATH=#{imports.join ':'} node spec/jasmine-node/specs.js"
end