-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
55 lines (39 loc) · 1.5 KB
/
makefile
File metadata and controls
55 lines (39 loc) · 1.5 KB
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
54
REPORT_FILE=coverage.html
RMJS=rmdir.js
RMV=node $(RMJS)
# change this if using linux or others
BROWSE=start
all: | test-all coverage
# use this to cross platform
$(RMJS):
@echo 'var f=require("fs"),t=require("path");var r=function(a){var b=f.readdirSync(a);for(var c=0;c<b.length;c++){var d=b[c];if(d!=="."&&d!=".."){d=t.join(a,d);if(f.statSync(d).isDirectory()){r(d)}else{try{f.unlinkSync(d)}catch(e){}}}}try{f.rmdirSync(a)}catch(e){}};try{r(process.argv[2])}catch(e){}' > $(RMJS)
# use this to cross platform
rmtools:
@coffee -e "require('fs').unlink 'rmdir.js'"
test-all:
@echo 'Testing...'
@mocha --compilers coffee:coffee-script
compile-coffee: $(RMJS)
@$(RMV) lib-js
@echo 'CoffeeScript -> JavaScript compiling...'
@coffee -o lib-js -c lib
@$(RMV) -p
clean-compile:
@$(RMV) -p
jscoverage:
@jscoverage --no-highlight lib-js lib-cov
mocha-html-cov:
@echo 'Testing and generating coverage report...'
@mocha --compilers coffee:coffee-script -R html-cov > $(REPORT_FILE)
clean-coverage:
@$(RMV) lib-js
@$(RMV) lib-cov
open-coverage:
@echo 'Openning report in your default browser...'
@$(BROWSE) $(REPORT_FILE)
clean-report:
@$(RMV) $(REPORT_FILE)
compile: | $(RMJS) compile-coffee rmtools
coverage: | $(RMJS) compile-coffee jscoverage mocha-html-cov clean-coverage rmtools open-coverage
clean: | $(RMJS) clean-compile clean-coverage clean-report rmtools
.PHONY: all test-all compile-coffee clean-compile jscoverage mocha-html-cov clean-coverage open-coverage clean-report compile coverage clean rmtoos