UNPKG

3.06 kBPlain TextView Raw
1
2
3
4# User rules
5
6# The first rule is the default rule, when invoking "make" without argument...
7# Build every buildable things
8all: install
9
10# Just install things so it works, basicaly: it just performs a "npm install --production" ATM
11install: log/npm-install.log
12
13# Just install things so it works, basicaly: it just performs a "npm install" ATM
14dev-install: log/npm-dev-install.log
15
16# This run the JsHint & Mocha BDD test, display it to STDOUT & save it to log/mocha.log and log/jshint.log
17test: log/jshint.log log/mocha.log
18
19# This run the JsHint, display it to STDOUT & save it to log/jshint.log
20lint: log/jshint.log
21
22# This run the Mocha BDD test, display it to STDOUT & save it to log/mocha.log
23unit: log/mocha.log
24
25# This publish to NPM and push to Github, if we are on master branch only
26publish: log/npm-publish.log log/github-push.log
27
28# Clean temporary things, or things that can be automatically regenerated
29clean: clean-all
30
31
32
33# Variables
34
35MOCHA=./node_modules/mocha/bin/mocha
36JSHINT=./node_modules/jshint/bin/jshint --verbose
37
38
39
40# Files rules
41
42# JsHint STDOUT test
43log/jshint.log: log/npm-dev-install.log lib/*.js lib/colorScheme/*.json lib/termconfig/*.js
44 ${JSHINT} lib/*.js lib/colorScheme/*.json lib/termconfig/*.js | tee log/jshint.log ; exit $${PIPESTATUS[0]}
45
46# Mocha BDD STDOUT test
47log/mocha.log: log/npm-dev-install.log lib/*.js lib/colorScheme/*.json lib/termconfig/*.js test/terminal-test.js
48 ${MOCHA} test/terminal-test.js -R spec | tee log/mocha.log ; exit $${PIPESTATUS[0]}
49
50# Mocha Markdown BDD spec
51bdd-spec.md: log/npm-dev-install.log lib/*.js lib/colorScheme/*.json lib/termconfig/*.js test/terminal-test.js
52 ${MOCHA} test/terminal-test.js -R markdown > bdd-spec.md
53
54# Upgrade version in package.json
55log/upgrade-package.log: lib/*.js lib/colorScheme/*.json lib/termconfig/*.js test/terminal-test.js demo/*.js documentation.md
56 npm version patch -m "Upgrade package.json version to %s" | tee log/upgrade-package.log ; exit $${PIPESTATUS[0]}
57
58# Publish to NPM
59log/npm-publish.log: check-if-master-branch log/upgrade-package.log
60 npm publish | tee log/npm-publish.log ; exit $${PIPESTATUS[0]}
61
62# Push to Github/master
63log/github-push.log: lib/*.js lib/colorScheme/*.json lib/termconfig/*.js test/terminal-test.js demo/*.js package.json
64 #'npm version patch' create the git tag by itself...
65 #git tag v`cat package.json | grep version | sed -r 's/.*"([0-9.]*)".*/\1/'`
66 git push origin master --tags | tee log/github-push.log ; exit $${PIPESTATUS[0]}
67
68# NPM install
69log/npm-install.log: package.json
70 npm install --production | tee log/npm-install.log ; exit $${PIPESTATUS[0]}
71
72# NPM install for developpement usage
73log/npm-dev-install.log: package.json
74 npm install | tee log/npm-dev-install.log ; exit $${PIPESTATUS[0]}
75
76
77
78# PHONY rules
79
80.PHONY: clean-all check-if-master-branch
81
82# Delete files, mostly log and non-versioned files
83clean-all:
84 rm -rf log/*.log bdd-spec.md node_modules
85
86# This will fail if we are not on master branch (grep exit 1 if nothing found)
87check-if-master-branch:
88 git branch | grep "^* master$$"
89
90