-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
42 lines (34 loc) · 1.59 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
# usage:
# `make build` or `make` compiles lib/*.coffee to lib/*.js (for all changed lib/*.coffee)
# `make lib/transform/each.coffee` compiles just that file to lib-js
# `make test` runs all the tests
# `make test/each.coffee` runs just that test
.PHONY: test test-cov test-w
TESTS=$(shell cd test && ls *.coffee | sed s/\.coffee$$// | grep -v credentials)
LIBS=$(shell find . -regex "^./lib\/.*\.coffee\$$" | sed s/\.coffee$$/\.js/ | sed s/lib/lib-js/)
build: $(LIBS)
lib-js/%.js : lib/%.coffee
node_modules/coffee-script/bin/coffee --bare -c -o $(@D) $(patsubst lib-js/%,lib/%,$(patsubst %.js,%.coffee,$@))
test: $(TESTS)
test-w:
NODE_ENV=test node_modules/mocha/bin/mocha --timeout 60000 -w --compilers coffee:coffee-script test/
$(TESTS): build
DEBUG=* NODE_ENV=test node_modules/mocha/bin/mocha --timeout 60000 --compilers coffee:coffee-script test/[email protected]
test-cov: build
# jscoverage only accepts directory arguments so have to rebuild everything
rm -rf lib-js-cov
jscoverage lib-js lib-js-cov
NODE_ENV=test TEST_SENTRY_NODE_COV=1 node_modules/mocha/bin/mocha --compilers coffee:coffee-script -R html-cov test/*.coffee | tee coverage.html
open coverage.html
publish: clean build
$(eval VERSION := $(shell grep version package.json | sed -ne 's/^[ ]*"version":[ ]*"\([0-9\.]*\)",/\1/p';))
@echo \'$(VERSION)\'
$(eval REPLY := $(shell read -p "Publish and tag as $(VERSION)? " -n 1 -r; echo $$REPLY))
@echo \'$(REPLY)\'
@if [[ $(REPLY) =~ ^[Yy]$$ ]]; then \
npm publish; \
git tag -a v$(VERSION) -m "version $(VERSION)"; \
git push --tags; \
fi
clean:
rm -rf lib-js lib-js-cov