-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (49 loc) · 1.36 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
SRC = $(wildcard *.coffee)
LIB = $(SRC:%.coffee=%.js)
REPO = $(shell cat .git/config | grep url | xargs echo | sed -E 's/^url = //g')
REPONAME = $(shell echo $(REPO) | sed -E 's_.+:([\.a-zA-Z0-9_\-]+)/([\.a-zA-Z0-9_\-]+)\.git_\1/\2_')
all: build
build: $(LIB)
watch:
watch -n1 $(MAKE) build
clean:
rm -f *.js
test:
$(MAKE) -Ctests
docs::
@sphinx-npm \
-C -E -a \
-Dhtml_theme_path=. \
-Dhtml_theme=noisy \
-Dmaster_doc=index \
-Agithub_repo='$(REPONAME)' \
./docs ./docs/build
docs-push::
rm -rf ./docs/build
$(MAKE) docs
touch ./docs/build/.nojekyll
(cd ./docs/build;\
git init && git add . && git ci -m 'docs' &&\
git push -f $(REPO) master:gh-pages)
%.js: %.coffee
coffee -bcp $< > $@
release-patch: build test
@$(call release,patch)
release-minor: build test
@$(call release,minor)
release-major: build test
@$(call release,major)
publish:
git push --tags origin HEAD:master
npm publish
define release
VERSION=`node -pe "require('./package.json').version"` && \
NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", '$(1)')"` && \
node -e "\
var j = require('./package.json');\
j.version = \"$$NEXT_VERSION\";\
var s = JSON.stringify(j, null, 2);\
require('fs').writeFileSync('./package.json', s);" && \
git commit -m "release $$NEXT_VERSION" -- package.json && \
git tag "$$NEXT_VERSION" -m "release $$NEXT_VERSION"
endef