forked from Clever/ARCHIVED-mongo-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (26 loc) · 980 Bytes
/
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
# build *.coffee in lib/ to lib-js/
LIBS=$(shell find . -regex "^./lib\/.*\.coffee\$$" | sed s/\.coffee$$/\.js/ | sed s/lib/lib-js/)
build: $(LIBS) cli.js
lib-js/%.js : lib/%.coffee
node_modules/coffee-script/bin/coffee --bare -c -o $(@D) $(patsubst lib-js/%,lib/%,$(patsubst %.js,%.coffee,$@))
cli.js: ./lib-js/cli.js
echo "#!/usr/bin/env node" | cat - ./lib-js/cli.js > /tmp/cli.js
mv /tmp/cli.js ./cli.js
chmod +x ./cli.js
TESTS=$(shell ls test/in/)
$(TESTS): build
cat test/in/$@ | ./cli.js > test/out/$@
test: $(TESTS)
git diff test/out
untest:
git checkout test/out/*
publish:
$(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