-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Makefile
77 lines (61 loc) · 1.98 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
COMPONENT := $(notdir $(CURDIR))
PKG_RELEASE ?= 1
PKG_VERSION ?= $(shell node -e "console.log(require('./package.json').st2_version)")
PREFIX ?= /opt/stackstorm/chatops
VIRTUALENV_DIR ?= venv
PYTHON ?= python2.7
REQUIREMENTS = Jinja2 PyYAML
ifneq (,$(wildcard /etc/debian_version))
DEBIAN := 1
DESTDIR ?= $(CURDIR)/debian/$(COMPONENT)
else
REDHAT := 1
endif
.PHONY: all build test clean distclean install
all: build
build:
# Permissions workaround for global `npm install`
chown -R root:root /root/st2chatops/
npm install --production
npm cache verify && npm cache clean --force
test:
npm test
clean:
rm -Rf node_modules/
distclean: clean
rm -Rf $(VIRTUALENV_DIR)
install: changelog
mkdir -p $(DESTDIR)$(PREFIX)
cp -R $(CURDIR)/bin $(DESTDIR)$(PREFIX)/bin
cp -R $(CURDIR)/node_modules $(DESTDIR)$(PREFIX)
cp -R $(CURDIR)/external-scripts.json $(DESTDIR)$(PREFIX)
cp -R $(CURDIR)/st2chatops.env $(DESTDIR)$(PREFIX)
install -m644 $(CURDIR)/conf/logrotate.conf $(DESTDIR)/etc/logrotate.d/st2chatops
.PHONY: virtualenv
virtualenv:
test -d $(VIRTUALENV_DIR) || virtualenv --python=$(PYTHON) $(VIRTUALENV_DIR)
.PHONY: requirements
requirements: virtualenv
. $(VIRTUALENV_DIR)/bin/activate; pip install $(REQUIREMENTS)
.PHONY: test-update
test-update: update
git diff --exit-code packagingenv/*/Dockerfile testingenv/*/Dockerfile
.PHONY: update
update: update-packagingenv update-testingenv
.PHONY: update-packagingenv
update-packagingenv: requirements
. $(VIRTUALENV_DIR)/bin/activate; python update.py packagingenv
.PHONY: update-testingenv
update-testingenv: requirements
. $(VIRTUALENV_DIR)/bin/activate; python update.py testingenv
changelog:
ifeq ($(DEBIAN),1)
debchange -v $(PKG_VERSION)-$(PKG_RELEASE) -M ""
endif
.PHONY: docker-dev-build
docker-dev-build:
docker build --tag st2chatops-dev dev
.PHONY: docker-dev
docker-dev:
docker images st2chatops-dev 1>/dev/null || make docker-dev-build
docker run -it --rm --publish 127.0.0.1:8081:8081/tcp --volume $$(pwd):/app st2chatops-dev