-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
82 lines (62 loc) · 1.92 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
bin := ./node_modules/.bin
gulp := $(bin)/gulp --cwd ./
releaseBranch := gh-pages
developBranch := master
testDeps := test.karma test.protractor# test.mocha
tempFolder := $(shell mktemp -d -t $(shell basename "$PWD"))
lastCommit := $(shell git rev-parse --short=10 HEAD)
newReleaseMsg := "chore(release): $(lastCommit) by Makefile"
# evaluated at runtime
version = `$(bin)/lsc -e "require './package.json' .version |> console.log"`
newPublishMsg = "chore(publish): v$(version) by Makefile"
.PHONY: client server lib test
install:
mkdir -p tmp/public
npm install
$(bin)/bower install
clean.tmp:
rm -rf tmp pkg
clean: clean.tmp
rm -rf node_modules bower_components
server: clean.tmp install
$(gulp) --gulpfile ./server/gulpfile.ls server
test.karma: install
./node_modules/karma/bin/karma start test/karma.js
ifdef TRAVIS
find tmp/coverage -name lcov.info -follow -type f -print0 \
| xargs -0 cat | $(bin)/coveralls
endif
test.protractor: install
# start
$(gulp) --gulpfile ./server/gulpfile.ls server & echo $$! > tmp/pid
sleep 10
curl -I http://localhost:5000/
# run
$(bin)/webdriver-manager update
$(bin)/protractor test/protractor.js
# stop
kill `cat tmp/pid`
test.mocha: install
$(bin)/mocha test/**/*.ls --compilers ls:LiveScript
test: clean.tmp $(testDeps)
release: clean.tmp install
NODE_ENV=production $(gulp) --gulpfile ./client/gulpfile.ls client
cp -r public/* $(tempFolder)
cp -r tmp/public/* $(tempFolder)
git checkout $(releaseBranch)
git clean -f -d
git rm -rf .
cp -r $(tempFolder)/* .
rm -rf $(tempFolder)
git add -A
git commit -m $(newReleaseMsg)
git checkout $(developBranch)
make install
echo "Release public(s) onto $(releaseBranch) branch but not pushed.\nCheck it out!"
lib: install
$(bin)/karma start --auto-watch --no-single-run test/karma.js
publish: test
$(gulp) publish
git add -A
git commit -m $(newPublishMsg)
git tag -a v$(version) -m $(newPublishMsg)