-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
57 lines (43 loc) · 1.45 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
PRJ_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/
BIN_DIR := $(PRJ_DIR)node_modules/.bin/
JSHINT := $(BIN_DIR)jshint
JSCS := $(BIN_DIR)jscs
NODEUNIT := $(BIN_DIR)nodeunit
ISTANBUL := $(BIN_DIR)istanbul
BORSCHIK := $(BIN_DIR)borschik
MOCHA := $(BIN_DIR)mocha
_MOCHA := $(BIN_DIR)_mocha
KARMA := $(PRJ_DIR)node_modules/karma/bin/karma
FILES_FOR_LINT := $(PRJ_DIR)lib $(PRJ_DIR)test/*.js $(PRJ_DIR)karma.conf.js
all: build test hook
.PHONY: test
test: codestyle unittests
.PHONY: codestyle
codestyle: jscs jshint
.PHONY: unittests
unittests: nodejsunittests browsersunittests
.PHONY: unittests_in_nodejs
nodejsunittests: $(MOCHA)
$(MOCHA) -u bdd -R spec -r chai $(PRJ_DIR)test/nodejs $(PRJ_DIR)test
.PHONY: unittests_in_browsers
browsersunittests: $(KARMA) build
$(KARMA) start $(PRJ_DIR)karma.conf.js --single-run
.PHONY: jshint
jshint: $(JSHINT)
$(JSHINT) $(FILES_FOR_LINT)
.PHONY: jscs
jscs: $(JSCS)
$(JSCS) $(FILES_FOR_LINT)
.PHONY: coverage
coverage: $(ISTANBUL) $(_MOCHA)
$(ISTANBUL) cover $(_MOCHA) -- -u bdd $(PRJ_DIR)test/nodejs $(PRJ_DIR)test
$(JSHINT) $(MOCHA) $(_MOCHA) $(ISTANBUL) $(JSCS) $(BORSCHIK) $(KARMA):
npm install
.PHONY: hook
hook: $(PRJ_DIR).git/hooks/pre-commit
$(PRJ_DIR).git/hooks/pre-commit: $(PRJ_DIR)pre-commit
cp $< $@
.PHONY: build
build: $(BORSCHIK)
$(BORSCHIK) -i $(PRJ_DIR)dist/susanin.tmp.js -o $(PRJ_DIR)dist/susanin.js -m no
$(BORSCHIK) -i $(PRJ_DIR)dist/susanin.tmp.js -o $(PRJ_DIR)dist/susanin.min.js