forked from paularmstrong/swig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (54 loc) · 1.8 KB
/
Makefile
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
55
56
57
58
59
60
61
62
63
64
65
66
SHA := $(shell git rev-parse HEAD)
THIS_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
TMP = 'tmp_build'
REMOTE = origin
BRANCH = gh-pages
all:
@npm install -d
@cp scripts/githooks/* .git/hooks/
@chmod -R +x .git/hooks/
clean:
@rm -rf ${TMP}
build:
@scripts/browser.sh
tests := $(shell find ./tests/node -name '*.test.js' ! -path "*node_modules/*")
reporter = dot
opts =
test:
@node_modules/mocha/bin/mocha --reporter ${reporter} ${opts} ${tests} --globals "_swigglobaltest"
test-browser: build
@node_modules/mocha-phantomjs/bin/mocha-phantomjs tests/browser/index.html
files := $(shell find . -name '*.js' ! -path "./node_modules/*" ! -path "./dist/*" ! -path "./tests/browser/*" ! -path "./docs*")
lint:
@node_modules/nodelint/nodelint ${files} --config=scripts/config-lint.js
out = tests/coverage.html
coverage:
# NOTE: You must have node-jscoverage installed:
# https://github.com/visionmedia/node-jscoverage
# The jscoverage npm module and original JSCoverage packages will not work
@jscoverage lib lib-cov
@SWIG_COVERAGE=1 $(MAKE) test reporter=html-cov > ${out}
@rm -rd lib-cov
@echo
@echo "Built Report to ${out}"
@echo
speed:
@node tests/speed.js
docs: all clean build
@mkdir -p docs/css
@node_modules/.bin/lessc --yui-compress --include-path=docs/less docs/less/swig.less docs/css/swig.css
@node_modules/.bin/still docs -o ${TMP} -i "layout" -i "json" -i "less"
@mkdir -p ${TMP}/js
@cp dist/swig.* ${TMP}/js/
@cp node_modules/zepto/zepto.min.js ${TMP}/js/lib
@git checkout ${BRANCH}
@cp -r ${TMP}/* ./
@rm -rf ${TMP}
@git add .
@git commit -n -am "Automated build from ${SHA}"
@git push ${REMOTE} ${BRANCH}
@git checkout ${THIS_BRANCH}
port = 3000
test-docs:
@node_modules/.bin/still-server docs/ -p ${port} -o
.PHONY: all build test test-browser lint coverage speed docs test-docs