forked from tbaltrushaitis/cv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
166 lines (112 loc) · 4.04 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
## ------------------------------------------------------------------------ ##
## Build Project ##
## ------------------------------------------------------------------------ ##
# .SILENT:
.EXPORT_ALL_VARIABLES:
.IGNORE:
.ONESHELL:
## ------------------------------------------------------------------------ ##
APP_NAME := cv
APP_SLOG := "CV+PORTFOLIO"
APP_LOGO := ./assets/BANNER
APP_REPO := $(shell git ls-remote --get-url)
APP_ENV := $(shell cat ./NODE_ENV)
CODE_VERSION := $(shell cat ./VERSION)
GIT_COMMIT := $(shell git rev-list --remove-empty --remotes --max-count=1 --date-order --reverse)
WD := $(shell pwd -P)
DT = $(shell date +'%Y%m%d%H%M%S')
include ./bin/.bash_colors
## ------------------------------------------------------------------------ ##
COMMIT_EXISTS := $(shell [ -e COMMIT ] && echo 1 || echo 0)
ifeq ($(COMMIT_EXISTS), 0)
$(file > COMMIT,${GIT_COMMIT})
$(warning ${BYellow}[${DT}] Created file [COMMIT]${NC})
endif
DIR_SRC := ${WD}/src
DIR_BUILD := ${WD}/build-${CODE_VERSION}
DIR_DIST := ${WD}/dist-${CODE_VERSION}
DIR_WEB := ${WD}/webroot
APP_DIRS := $(addprefix ${WD}/,build-* dist-* webroot)
## ------------------------------------------------------------------------ ##
# Query the default goal.
ifeq ($(.DEFAULT_GOAL),)
.DEFAULT_GOAL := default
endif
## ------------------------------------------------------------------------ ##
## INCLUDES ##
## ------------------------------------------------------------------------ ##
include ./bin/Makefile.*
## ------------------------------------------------------------------------ ##
.PHONY: default
default: all;
## ------------------------------------------------------------------------ ##
# $(info [${DT}]${BYellow} Default goal is: [$(.DEFAULT_GOAL)]${NC});
.PHONY: test
test: banner state help banner;
## ------------------------------------------------------------------------ ##
.PHONY: clone
clone:
@ git clone ${APP_REPO} ${APP_NAME} \
&& cd ${APP_NAME} \
&& git pull \
&& find . -type f -exec chmod 664 {} \; \
&& find . -type d -exec chmod 775 {} \; \
&& find . -type f -name "*.sh" -exec chmod 755 {} \;
## ------------------------------------------------------------------------ ##
.PHONY: clean clean-all
.PHONY: clean-repo clean-src clean-deps
.PHONY: clean-build clean-dist clean-web clean-files
clean-all: clean clean-web clean-files
clean: clean-build clean-dist
clean-repo:
@ ${RM} -rf ${APP_NAME}
clean-src:
@ rm -rf ${DIR_SRC}
clean-build:
@ rm -rf ${DIR_BUILD}
clean-dist:
@ rm -rf ${DIR_DIST}
clean-web:
@ rm -rf ${DIR_WEB}
clean-deps:
@ rm -rf bower_modules/ \
node_modules/;
clean-files:
@ rm -rf ${APP_DIRS} \
bitbucket-pipelines.yml \
codeclimate-config.patch \
_config.yml;
## ------------------------------------------------------------------------ ##
.PHONY: rights
rights:
@ find . -type f -exec chmod 664 {} 2>/dev/null \;
@ find . -type d -exec chmod 775 {} 2>/dev/null \;
@ find . -type f -name "*.sh" -exec chmod a+x {} 2>/dev/null \;
## ------------------------------------------------------------------------ ##
.PHONY: setup build deploy dev
setup:
@ npm i -g npm
@ npm i -g bower
@ npm i
@ bower i
build:
@ NODE_ENV=${APP_ENV}; gulp build
deploy:
@ NODE_ENV=${APP_ENV}; gulp deploy
# deploy:
# @ cp -prv ${DIR_SRC}/* ./ \
# && sudo chmod a+x app/bin/*.sh ;
dev:
@ NODE_ENV=development gulp build
## ------------------------------------------------------------------------ ##
.PHONY: rebuild redeploy
rebuild: build;
redeploy: rebuild deploy banner;
## ------------------------------------------------------------------------ ##
.PHONY: all full cycle
#* means the word "all" doesn't represent a file name in this Makefile;
#* means the Makefile has nothing to do with a file called "all" in the same directory.
all: banner clean cycle;
full: clean-all all;
cycle: rights setup build deploy;
## ------------------------------------------------------------------------ ##