UNPKG

1.79 kBPlain TextView Raw
1NPM_INSTALL_TEST = PYTHON=`which python2.6` NODE_ENV=test npm install
2TESTS = $(shell find tests -type f -name test-*)
3
4-COVERAGE_DIR := out/test/
5-RELEASE_DIR := out/release/
6
7-RELEASE_COPY := lib etc res tests
8
9-BIN_MOCHA := ./node_modules/.bin/mocha
10-BIN_ISTANBUL := ./node_modules/.bin/istanbul
11-BIN_COFFEE := ./node_modules/.bin/coffee
12-LUANTAI := ./node_modules/.bin/luantai
13
14-TESTS := $(sort $(TESTS))
15
16-TESTS_ENV := tests/web/env.js
17
18-COVERAGE_TESTS := $(addprefix $(-COVERAGE_DIR),$(-TESTS))
19-COVERAGE_TESTS := $(-COVERAGE_TESTS:.coffee=.js)
20
21-LOGS_DIR := logs
22
23-GIT_REV := $(shell git show | head -n1 | cut -f 2 -d ' ')
24-GIT_REV := $(shell echo "print substr('$(-GIT_REV)', 0, 8);" | /usr/bin/env perl)
25
26default: dev
27
28-common-pre: clean -npm-install -logs
29
30dev: -common-pre
31 @$(-BIN_MOCHA) \
32 --colors \
33 --compilers coffee:coffee-script/register \
34 --reporter spec \
35 --growl \
36 $(-TESTS)
37
38test: -common-pre
39 @$(-BIN_MOCHA) \
40 --colors \
41 --compilers coffee:coffee-script/register \
42 --reporter spec \
43 $(-TESTS)
44
45dev1:
46 @killall phantomjs || continue
47 @$(-LUANTAI) -c ../../../../tests/web/config.json
48
49-pre-test-cov: -common-pre
50 @echo 'copy files'
51 @mkdir -p $(-COVERAGE_DIR)
52
53 @rsync -av . $(-COVERAGE_DIR) --exclude out --exclude .git --exclude node_modules
54 @rsync -av ./node_modules $(-COVERAGE_DIR)
55 @$(-BIN_COFFEE) -cb out/test
56 @find ./out/test -path ./out/test/node_modules -prune -o -name "*.coffee" -exec rm -rf {} \;
57
58release: -release-pre
59 @rm -fr $(-RELEASE_DIR)/tests
60 @echo "all codes in \"$(-RELEASE_DIR)\""
61
62.-PHONY: default
63
64-npm-install:
65 @$(NPM_INSTALL_TEST)
66
67clean:
68 @echo 'clean'
69 @-rm -fr out
70 @-rm -fr $(-LOGS_DIR)
71
72-logs:
73 @mkdir -p $(-LOGS_DIR)
74
75publish:
76
\No newline at end of file