-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathMakefile
63 lines (50 loc) · 1.34 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
.PHONY: clean package test
SHELL := /bin/bash
MANIFEST := \
background.js \
common.js \
deluminate-*.png \
deluminate.css \
deluminate.js \
manifest.json \
migrate.html \
migrate.js \
options.html \
options.js \
popup.html \
popup.js \
url_selector.css \
url_selector.js \
utils.js \
*.svg
BUILD_DIR := build
LAST_VERSION_COMMIT := $(shell git blame manifest.json | grep \\bversion \
| cut -d' ' -f1)
BUILD_NUM := $(shell git log $(LAST_VERSION_COMMIT)..HEAD --oneline \
| wc -l | tr -d ' ')
PKG_SUFFIX := $(shell git symbolic-ref --short HEAD \
| sed '/^master$$/d;s/^/-/')
package: deluminate$(PKG_SUFFIX).zip
deluminate.zip: $(MANIFEST)
zip "$@" $(MANIFEST)
deluminate%.zip: $(MANIFEST) | $(BUILD_DIR)
rm -f $(BUILD_DIR)/*
cp $(MANIFEST) $(BUILD_DIR)/
cp $(BUILD_DIR)/manifest.json $(BUILD_DIR)/manifest.json.orig
sed -e '/"version"/s/"[^"]*$$/.$(BUILD_NUM)&/' \
-e 's/"Deluminate"/"Deluminate$(PKG_SUFFIX)"/' \
"$(BUILD_DIR)/manifest.json.orig" > "$(BUILD_DIR)/manifest.json"
cd $(BUILD_DIR) && zip "../$@" $(MANIFEST)
$(BUILD_DIR):
mkdir $@
clean:
rm -f deluminate*.zip
find spec -name 'junit*.xml' -exec rm -f {} +
test: node_modules
npm test
node_modules: package.json
npm install
deploy: deluminate.zip node_modules
npm run deploy -- "$<"
deploy-dev: deluminate$(PKG_SUFFIX).zip node_modules
npm run deploy-dev -- "$<"