forked from cnpm/mirrors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
98 lines (78 loc) · 2.24 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
TESTS = $(shell ls -S `find test -type f -name "*.test.js" -print`)
REPORTER = spec
TIMEOUT = 30000
MOCHA_OPTS =
REGISTRY = --registry=https://registry.npm.taobao.org
DB = sqlite
install:
@npm install --build-from-source $(REGISTRY) \
--disturl=https://npm.taobao.org/mirrors/node
install-production production:
@NODE_ENV=production $(MAKE) install
jshint: install
@-node_modules/.bin/jshint ./
init-database:
@node --harmony models/init_script.js force $(DB)
init-mysql:
@mysql -uroot -e 'DROP DATABASE IF EXISTS mirrors_test;'
@mysql -uroot -e 'CREATE DATABASE mirrors_test;'
test: install init-database
@NODE_ENV=test DB=${DB} node_modules/.bin/mocha \
--reporter $(REPORTER) \
--timeout $(TIMEOUT) \
--require should \
--require should-http \
--require co-mocha \
$(MOCHA_OPTS) \
$(TESTS)
test-sqlite:
@$(MAKE) test DB=sqlite
test-mysql: init-mysql
@$(MAKE) test DB=mysql
test-all: test-sqlite test-mysql
test-cov cov: install init-database
@NODE_ENV=test DB=${DB} \
node_modules/.bin/istanbul cover --preserve-comments \
node_modules/.bin/_mocha \
-- -u exports \
--reporter $(REPORTER) \
--timeout $(TIMEOUT) \
--require should \
--require should-http \
--require co-mocha \
$(MOCHA_OPTS) \
$(TESTS)
test-cov-sqlite:
@$(MAKE) test-cov DB=sqlite
test-cov-mysql: init-mysql
@$(MAKE) test-cov DB=mysql
test-travis: install init-database
@NODE_ENV=test DB=${DB} CNPM_SOURCE_NPM=https://registry.npmjs.org CNPM_SOURCE_NPM_ISCNPM=false \
node_modules/.bin/istanbul cover --preserve-comments \
node_modules/.bin/_mocha \
--report lcovonly \
-- \
--reporter dot \
--timeout $(TIMEOUT) \
--require should \
--require should-http \
--require co-mocha \
$(MOCHA_OPTS) \
$(TESTS)
test-travis-sqlite:
@$(MAKE) test-travis DB=sqlite
test-travis-mysql: init-mysql
@$(MAKE) test-travis DB=mysql
test-travis-all: test-travis-sqlite test-travis-mysql
contributors: install
@node_modules/.bin/contributors -f plain -o AUTHORS
autod: install
@node_modules/.bin/autod -w \
--prefix "~" \
--exclude public,views,coverage \
--dep mysql \
--devdep should,supertest,should-http,mm,pedding,mocha,istanbul-harmony,sqlite3,co-mocha
@$(MAKE) install
dev:
@node_modules/.bin/node-dev dispatch.js
.PHONY: test