-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (90 loc) · 3.14 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
101
102
103
104
NAME := $(shell node -e "console.log(JSON.parse(require('fs').readFileSync('package.json', 'utf8')).name)")
VERSION := $(shell node -e "console.log(JSON.parse(require('fs').readFileSync('package.json', 'utf8')).version)")
TARBALL := $(NAME)-$(VERSION).tgz
FILES := rho_push_install rho_push_uninstall rhoconnect-push.conf rhoconnect-push
REPORTER := dot
MOCHA_OPTS :=
COMPILERS := coffee:coffee-script/register
cleanall: clean
rm -f build/node-*.tar.gz
rm -f build/*.rpm
rm -f build/*.deb
clean:
rm -rf vendor/ans2server-min.js bin/rhoconnect-push.js
rm -rf node_modules/ *.tgz
dependencies:
npm install
compress: dependencies
touch vendor/ans2server-min.js
node_modules/.bin/uglifyjs -mt -nc -o vendor/ans2server-min.js vendor/ans2server.js
package:
npm install
node_modules/.bin/coffee -c bin/rhoconnect-push
echo '#!/usr/bin/env node' | cat - bin/rhoconnect-push.js > bin/rhoconnect-push.js.tmp
mv bin/rhoconnect-push.js.tmp bin/rhoconnect-push.js
npm pack
all: clean compress package
install: all
npm install -g rhoconnect-push-$(VERSION).tgz
prepare: all
mkdir -p /tmp/installdir
cp rhoconnect-push-$(VERSION).tgz /tmp/installdir
cd ./build; cp $(FILES) /tmp/installdir
test:
@NODE_ENV=test ./node_modules/.bin/mocha \
--reporter $(REPORTER) \
--require coffee-script/register \
--compilers $(COMPILERS) \
$(MOCHA_OPTS)
test-w:
@NODE_ENV=test ./node_modules/.bin/mocha \
--reporter $(REPORTER) \
--compilers $(COMPILERS) \
--watch
$(MOCHA_OPTS)
.PHONY: test test-w
# Build rpm package
# yum groupinstall "Development Tools" equals to --category "Development Tools"
rpm: prepare
cd ./build; \
fpm -s dir -t rpm -n $(NAME) -v $(VERSION) --iteration 2 -a noarch -C /tmp/installdir \
--after-install /tmp/installdir/rho_push_install \
--after-remove /tmp/installdir/rho_push_uninstall \
--prefix /opt/rhoconnect/installer \
--description "RhoConnect Push Service" \
--category "Development Tools" \
./
rm -rf /tmp/installdir
# Build deb package
deb: prepare
cd ./build; \
fpm -s dir -t deb -n $(NAME) -v $(VERSION) --iteration 2 -a all -C /tmp/installdir \
-p rhoconnect-push-VERSION_ARCH.deb \
--after-install /tmp/installdir/rho_push_install \
--after-remove /tmp/installdir/rho_push_uninstall \
--prefix /opt/rhoconnect/installer \
--description "RhoConnect Push Service" \
-d "build-essential (>= 0)" \
./
rm -rf /tmp/installdir
# Build both rpm/deb packagees
build: prepare
cd ./build; \
fpm -s dir -t rpm -n $(NAME) -v $(VERSION) --iteration 2 -a noarch -C /tmp/installdir \
-p rhoconnect-push-VERSION_ARCH.rpm \
--after-install /tmp/installdir/rho_push_install \
--after-remove /tmp/installdir/rho_push_uninstall \
--prefix /opt/rhoconnect/installer \
--description "RhoConnect Push Service" \
--category "Development Tools" \
./
cd ./build; \
fpm -s dir -t deb -n $(NAME) -v $(VERSION) --iteration 2 -a all -C /tmp/installdir \
-p rhoconnect-push-VERSION_ARCH.deb \
--after-install /tmp/installdir/rho_push_install \
--after-remove /tmp/installdir/rho_push_uninstall \
--prefix /opt/rhoconnect/installer \
--description "RhoConnect Push Service" \
-d "build-essential (>= 0)" \
./
rm -rf /tmp/installdir