-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
112 lines (78 loc) · 3.07 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
DATE = $(shell date +'%Y-%m-%d')
GIT_STATUS = $(shell git status --porcelain)
GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
CHAI = node_modules/chai/chai.js
CHAI_AS_PROMISED = node_modules/chai-as-promised/lib/chai-as-promised.js
cjsify = node_modules/commonjs-everywhere/bin/cjsify
TEST_FILES = $(shell find test -name *.coffee)
LIBS = $(CHAI) $(CHAI_AS_PROMISED)
MOCHA_PARAMS = --compilers coffee:coffee-script/register --require test/support/node.js
## Creating files and folders
## ==========================================================================
.cov: src/*.coffee
@jscov --expand --conditionals src .cov
lib: src/*.coffee makefile
@rm -rf lib
@coffee -co lib src
tmp:
@mkdir -p tmp
# Distribution files
# ------------------
tmp/dist-header.txt: package.json tmp
@echo "// z-std-pack v`cat package.json | json version`\n// Jakob Mattsson $(DATE)" > tmp/dist-header.txt
dist/z-std-pack.js: lib dist tmp/dist-header.txt
@$(cjsify) lib/index.js --no-node -x Z --alias util:./lib/browserInspect.js | cat tmp/dist-header.txt - > dist/z-std-pack.js
dist/z-std-pack-min.js: lib dist tmp/dist-header.txt
@$(cjsify) lib/index.js --no-node -x Z --m --alias util:./lib/browserInspect.js | cat tmp/dist-header.txt - > dist/z-std-pack-min.js
# Browser test files
# ------------------
tmp/browsertest:
@mkdir -p tmp/browsertest
tmp/vendor.js: package.json tmp $(LIBS) test/support/browser.js
@cat $(LIBS) test/support/browser.js > tmp/vendor.js
tmp/cases.js: package.json tmp $(TEST_FILES)
@find test -type f -name *.coffee ! -iname "versions.coffee" -exec $(cjsify) {} --no-node \; > tmp/cases.js
tmp/browsertest/default/tests.js: package.json tmp/browsertest tmp/vendor.js tmp/cases.js dist/z-std-pack.js
@mocha init tmp/browsertest/default
@cat tmp/vendor.js dist/z-std-pack.js tmp/cases.js > tmp/browsertest/default/tests.js
## Tasks
## ==========================================================================
clean:
@rm -rf lib tmp .cov
update-dist: dist/z-std-pack.js dist/z-std-pack-min.js
compile-browser-tests: tmp/browsertest/default/tests.js
deploy-browser-tests: compile-browser-tests
@bucketful
test-coverage: .cov
@JSCOV=.cov mocha --reporter mocha-term-cov-reporter $(MOCHA_PARAMS)
test-node:
@mocha --grep "$(TESTS)" $(MOCHA_PARAMS)
test-browsers: deploy-browser-tests
@chalcogen --platform saucelabs
run-tests: lib
ifneq ($(CI),true)
# Not running CI; only testing in node
@make test-node
else ifneq ($(TRAVIS_NODE_VERSION),0.10)
# Running CI in a node version other than 0.10; only testing in node
@make test-node
else
# Running CI in a node 0.10 - testing node AND browsers!
@make test-node
@make test-browsers
endif
release:
ifneq "$(GIT_STATUS)" ""
@echo "clean up your changes first"
else ifneq "$(GIT_BRANCH)" "master"
@echo "You can only release from the master branch"
else
@npm test
@json -I -e "version='$(VERSION)'" -f bower.json
@json -I -e "version='$(VERSION)'" -f package.json
@make update-dist
@git add bower.json package.json dist/*.js
@git commit -m v$(VERSION)
@git tag -a v$(VERSION) -m v$(VERSION)
@git push --follow-tags
endif