forked from collective/mockup-minimalpattern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (83 loc) · 3.17 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
99
100
# binary and other paths
GIT = git
NPM = npm
NODE = node
GRUNT = ./node_modules/grunt-cli/bin/grunt
BOWER = ./node_modules/bower/bin/bower
NODE_PATH = ./node_modules
# npm link has different behavior between node versions.
# Get node version, e.g. "0.11.12"
NODE_VERSION = $(shell $(NODE) -v)
# Get major version, e.g. "0"
NODE_VERSION_MAJ = $(shell echo $(NODE_VERSION) | cut -f1 -d. | cut -f2 -dv )
# Get minor version, E.g. 11
NODE_VERSION_MIN = $(shell echo $(NODE_VERSION) | cut -f2 -d.)
# Test if the version is below "0.11", E.g. "0.10"
NODE_VERSION_LT_011 = $(shell [ $(NODE_VERSION_MAJ) -eq 0 -a $(NODE_VERSION_MIN) -lt 11 ] && echo true)
# DEBUG and VERBOSE mode for grunt. E.g. `make all debug=true verbose=true`
DEBUG =
ifeq ($(debug), true)
DEBUG = --debug
endif
VERBOSE =
ifeq ($(verbose), true)
VERBOSE = --verbose
endif
# Make tasks
all: test-once bundle-minimalpattern
cleanplone:
# Remove buildout created Plone directories, except var
rm -Rf bin develop-eggs include lib lib64 parts .installed
plone5: cleanplone
# Install Plone 5
virtualenv .
./bin/pip install zc.buildout
./bin/buildout
plone4: cleanplone
# Install Plone 4
virtualenv .
./bin/pip install zc.buildout
./bin/buildout -c buildout-plone4.cfg
bundle-minimalpattern:
# Build minimalpattern bundle
mkdir -p build
NODE_PATH=$(NODE_PATH) $(GRUNT) bundle-minimalpattern $(DEBUG) $(VERBOSE) --gruntfile=src/mockup-minimalpattern/js/Gruntfile.js
bootstrap: clean
# Install node/bower dependencies
mkdir -p build
@echo node version: $(NODE_VERSION)
ifeq ($(NODE_VERSION_LT_011),true)
# for node < v0.11.x
$(NPM) link --prefix=.
else
$(NPM) link
endif
NODE_PATH=$(NODE_PATH) $(BOWER) install --config.interactive=0
NODE_PATH=$(NODE_PATH) $(GRUNT) sed:bootstrap $(DEBUG) $(VERBOSE) --gruntfile=src/mockup-minimalpattern/js/Gruntfile.js
jshint:
# Codecheck
NODE_PATH=$(NODE_PATH) $(GRUNT) jshint $(DEBUG) $(VERBOSE) --gruntfile=src/mockup-minimalpattern/js/Gruntfile.js
watch:
# Run grunt and watch for changes.
NODE_PATH=$(NODE_PATH) $(GRUNT) watch $(DEBUG) $(VERBOSE) --gruntfile=src/mockup-minimalpattern/js/Gruntfile.js
test:
# Run tests headless via PhantomJS and watch for changes.
NODE_PATH=$(NODE_PATH) $(GRUNT) test $(DEBUG) $(VERBOSE) --pattern=$(pattern) --gruntfile=src/mockup-minimalpattern/js/Gruntfile.js
test-once:
# Run the tests headless with PhantomJS only once and exit.
NODE_PATH=$(NODE_PATH) $(GRUNT) test_once $(DEBUG) $(VERBOSE) --pattern=$(pattern) --gruntfile=src/mockup-minimalpattern/js/Gruntfile.js
test-dev:
# Run the tests for Chromium and watch for changes.
NODE_PATH=$(NODE_PATH) $(GRUNT) test_dev $(DEBUG) $(VERBOSE) --pattern=$(pattern) --gruntfile=src/mockup-minimalpattern/js/Gruntfile.js
clean:
# Cleanup the project and remove directories set up by previous tasks
mkdir -p build
rm -rf build
rm -rf node_modules
rm -rf mockup/bower_components
clean-deep: clean
# Also clean bower and npm caches.
if test -f $(BOWER); then $(BOWER) cache clean; fi
if test -f $(NPM); then $(NPM) cache clean; fi
# Expose these options to the command line shell expansion mechanism
.PHONY: all plone plone4 bundle-minimalpattern bootstrap jshint watch test test-once test-dev clean clean-deep