-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
executable file
·65 lines (47 loc) · 1.87 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
### start list of variables
### to be available
### for use in the SETTINGS files
RANDOM := $(shell /bin/bash -c "echo $$RANDOM")
### end list
include SETTINGS
#default target, tried to reuse an existing install of node.js and bower dependencies
all: clean_cache build deploy
install: prereq configure get build deploy
#execute once before running make
configure:
sed 's/$$RETAIL_APP_NAME/$(RETAIL_APP_NAME)/g' manifest.yml.template | \
sed 's/$$RETAIL_APP_HOST/$(RETAIL_APP_HOST)/g' | \
sed 's/$$SPSS_APP_NAME/$(SPSS_APP_NAME)/g' | \
sed 's/$$SPSS_APP_HOST/$(SPSS_APP_HOST)/g' | \
sed 's/$$WEATHER_APP_NAME/$(WEATHER_APP_NAME)/g' | \
sed 's/$$WEATHER_APP_HOST/$(WEATHER_APP_HOST)/g' \
> manifest.yml
cf login
cf cups $(ALERTS_DATABASE_SERVICE_NAME) -p "cloudantUrl,alertsDbName,alertsDbKey,alertsDbPassword"
cf cups $(DISTRICTS_DATABASE_SERVICE_NAME) -p "cloudantUrl,districtsDbName,districtsDbKey,districtsDbPassword"
#use an empty app contents to create the initial app instance
mkdir -p tmp; cp package.json tmp
cf push $(RETAIL_APP_NAME) -n $(RETAIL_APP_HOST) -p tmp --no-manifest --no-start
cf bind-service ${RETAIL_APP_NAME} ${ALERTS_DATABASE_SERVICE_NAME}
cf bind-service ${RETAIL_APP_NAME} ${DISTRICTS_DATABASE_SERVICE_NAME}
cf se $(RETAIL_APP_NAME) ALERTS_DATABASE_SERVICE_NAME $(ALERTS_DATABASE_SERVICE_NAME)
cf se $(RETAIL_APP_NAME) DISTRICTS_DATABASE_SERVICE_NAME $(DISTRICTS_DATABASE_SERVICE_NAME)
cf se $(RETAIL_APP_NAME) WEATHER_APP_HOST $(WEATHER_APP_HOST)
touch configure
#a target to build a new application from scratch, removing and then re-downloading all dependencies prior to rebuilding
new: clean get build deploy
prereq:
which node
which bower
deploy:
cf push
build:
# -jbuild build
get:
# npm install
clean: clean_cache clean_deps
clean_cache:
-rm `find . | grep DS_Store`
-rm -rf tmp
clean_deps:
-rm -rf node_modules bower_components