-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
64 lines (49 loc) · 1.8 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
VERSION = 0.4.0
BROWSERIFY = node ./node_modules/.bin/browserify
MOCHA = ./node_modules/.bin/mocha
LINTER = ./node_modules/.bin/standard
UGLIFYJS = ./node_modules/.bin/uglifyjs
CUCUMBER = ./node_modules/.bin/cucumber-js
STUBBY = ./node_modules/.bin/stubby
KARMA = ./node_modules/karma/bin/karma
MOCHA_PHANTOM = ./node_modules/.bin/mocha-phantomjs -s localToRemoteUrlAccessEnabled=true -s webSecurityEnabled=false
BANNER = "/*! resilient - v$(VERSION) - MIT License - https://github.com/resilient-http/resilient.js */"
default: all
all: test
browser: banner browserify uglify
test: lint browser mocha cucumber
test-phantom: mock-server-stop mock-server mocha-phantom mock-server-stop
test-browser: mock-server-stop mock-server karma mock-server-stop
banner:
@echo $(BANNER) > resilient.js
browserify:
$(BROWSERIFY) \
--exports require \
--standalone resilient \
--ignore request \
--entry ./lib/index.js >> ./resilient.js
lint:
$(LINTER) lib/*.js lib/resolvers/*.js
uglify:
$(UGLIFYJS) resilient.js --mangle --preamble $(BANNER) --source-map resilient.min.js.map --source-map-url http://cdn.rawgit.com/resilient-http/resilient.js/$(VERSION)/resilient.min.js.map > resilient.min.js
mocha:
$(MOCHA) --reporter spec --ui tdd --timeout 10000
mocha-phantom:
$(MOCHA_PHANTOM) --reporter spec --ui bdd test/runner.html
$(MAKE) mock-server-stop
cucumber:
$(CUCUMBER) -f pretty -r features/support -r features/step_definitions
loc:
wc -l resilient.js
mock-server:
$(STUBBY) -d ./test/fixtures/mocks.yaml > /dev/null & echo $$! > .server.pid
mock-server-stop:
[ -f .server.pid ] && kill -9 `cat .server.pid | head -n 1` && rm -f .server.pid || exit 0
karma:
$(KARMA) start
karma-ci:
$(KARMA) start --single-run --browsers Firefox
gzip:
gzip -c resilient.min.js | wc -c
publish: browser
git push --tags origin HEAD:master