-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoly.sh
executable file
·380 lines (360 loc) · 10.1 KB
/
poly.sh
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
#!/bin/bash
# set -e
POLY_SCRIPTS_FOLDER=~/poly-bash-scripts
if [[ -f $POLY_SCRIPTS_FOLDER/.global-env ]]; then
source $POLY_SCRIPTS_FOLDER/.global-env
fi
source $POLY_SCRIPTS_FOLDER/imports/exec_arguments.sh
source $POLY_SCRIPTS_FOLDER/imports/add-custom-post-types.sh
source $POLY_SCRIPTS_FOLDER/imports/add-taxonomies.sh
source $POLY_SCRIPTS_FOLDER/imports/all-copy-local-uploads-to-remote.sh
source $POLY_SCRIPTS_FOLDER/imports/all-copy-remote-uploads-to-local.sh
source $POLY_SCRIPTS_FOLDER/imports/all-deploy-sites.sh
source $POLY_SCRIPTS_FOLDER/imports/all-dump-remote-db.sh
source $POLY_SCRIPTS_FOLDER/imports/all-dump-remote-htaccess.sh
source $POLY_SCRIPTS_FOLDER/imports/all-dump-remote-env.sh
source $POLY_SCRIPTS_FOLDER/imports/all-dump-remote-config.sh
source $POLY_SCRIPTS_FOLDER/imports/all-exec-command.sh
source $POLY_SCRIPTS_FOLDER/imports/all-import-remote-to-local-db.sh
source $POLY_SCRIPTS_FOLDER/imports/all-import-local-to-remote-db.sh
source $POLY_SCRIPTS_FOLDER/imports/all-npm-install.sh
source $POLY_SCRIPTS_FOLDER/imports/all-open-sites.sh
source $POLY_SCRIPTS_FOLDER/imports/all-open-pagespeed.sh
source $POLY_SCRIPTS_FOLDER/imports/all-open-validate-html.sh
source $POLY_SCRIPTS_FOLDER/imports/all-open-resizer.sh
source $POLY_SCRIPTS_FOLDER/imports/all-symlink-uploads.sh
source $POLY_SCRIPTS_FOLDER/imports/all-update-sites.sh
source $POLY_SCRIPTS_FOLDER/imports/backup-remote-sites.sh
source $POLY_SCRIPTS_FOLDER/imports/backup-remote-sites-light.sh
source $POLY_SCRIPTS_FOLDER/imports/backup-remote-files.sh
source $POLY_SCRIPTS_FOLDER/imports/bootstrap-wordpress.sh
source $POLY_SCRIPTS_FOLDER/imports/bootstrap-static.sh
source $POLY_SCRIPTS_FOLDER/imports/bootstrap-static-spa.sh
source $POLY_SCRIPTS_FOLDER/imports/change-git-upstream.sh
source $POLY_SCRIPTS_FOLDER/imports/check-uploads.sh
source $POLY_SCRIPTS_FOLDER/imports/clear-remote-cache.sh
source $POLY_SCRIPTS_FOLDER/imports/commit-local-db.sh
source $POLY_SCRIPTS_FOLDER/imports/commit-remote-db.sh
source $POLY_SCRIPTS_FOLDER/imports/copy-local-uploads-to-remote.sh
source $POLY_SCRIPTS_FOLDER/imports/copy-remote-uploads-to-local.sh
source $POLY_SCRIPTS_FOLDER/imports/copy-static-assets-to-wordpress.sh
source $POLY_SCRIPTS_FOLDER/imports/copy-static-fonts-to-wordpress.sh
source $POLY_SCRIPTS_FOLDER/imports/copy-static-images-to-wordpress.sh
source $POLY_SCRIPTS_FOLDER/imports/copy-static-scripts-to-wordpress.sh
source $POLY_SCRIPTS_FOLDER/imports/copy-static-styles-to-wordpress.sh
source $POLY_SCRIPTS_FOLDER/imports/create-gh-pages.sh
source $POLY_SCRIPTS_FOLDER/imports/create-gh-pages-static.sh
source $POLY_SCRIPTS_FOLDER/imports/deploy-stage.sh
source $POLY_SCRIPTS_FOLDER/imports/deploy-static.sh
source $POLY_SCRIPTS_FOLDER/imports/import-local-to-remote-db.sh
source $POLY_SCRIPTS_FOLDER/imports/import-remote-to-local-db.sh
source $POLY_SCRIPTS_FOLDER/imports/init-poly.sh
source $POLY_SCRIPTS_FOLDER/imports/init-static-poly.sh
source $POLY_SCRIPTS_FOLDER/imports/optimize-local-assets.sh
source $POLY_SCRIPTS_FOLDER/imports/optimize-local-uploads.sh
source $POLY_SCRIPTS_FOLDER/imports/restore-remote-site.sh
source $POLY_SCRIPTS_FOLDER/imports/restore-remote-repository.sh
source $POLY_SCRIPTS_FOLDER/imports/restore-remote-config.sh
source $POLY_SCRIPTS_FOLDER/imports/restore-remote-uploads.sh
source $POLY_SCRIPTS_FOLDER/imports/restore-remote-db.sh
#INIT
function init {
echo "init"
init-poly
}
#INIT
function init-static {
echo "init static"
init-static-poly
}
#IMPORT
function import {
function local-database-to-remote {
echo "local-database-to-remote"
import-local-to-remote-db
}
function remote-database-to-local {
echo "remote-database-to-local"
import-remote-to-local-db
}
options=("local-database-to-remote" "remote-database-to-local")
exec_arguments options[@]
}
#BACKUP
function backup {
function remote-sites {
echo "backup remote-sites"
backup-remote-sites ${arguments[0]}
}
function remote-files {
echo "backup remote-files"
backup-remote-files ${arguments[0]}
}
function remote-sites-light {
echo "backup remote-sites-light"
backup-remote-sites-light ${arguments[0]}
}
options=("remote-files" "remote-sites" "remote-sites-light")
exec_arguments options[@]
}
#COPY
function copy {
function local {
function uploads-to-remote {
echo "uploads-to-remote"
copy-local-uploads-to-remote
}
options=("uploads-to-remote")
exec_arguments options[@]
}
function remote {
function uploads-to-local {
echo "uploads-to-local"
copy-remote-uploads-to-local
}
options=("uploads-to-local")
exec_arguments options[@]
}
function static {
function assets {
echo "assets"
copy-static-assets-to-wordpress
}
function styles {
echo "styles"
copy-static-styles-to-wordpress
}
function scripts {
echo "scripts"
copy-static-scripts-to-wordpress
}
function fonts {
echo "fonts"
copy-static-fonts-to-wordpress
}
function images {
echo "images"
copy-static-images-to-wordpress
}
options=("assets" "styles" "scripts" "fonts" "images")
exec_arguments options[@]
}
options=("local" "remote" "static")
exec_arguments options[@]
}
#CREATE
function create {
function gh-pages {
echo "gh-pages"
create-gh-pages
}
function gh-pages-static {
echo "gh-pages-static"
create-gh-pages-static
}
options=("gh-pages" "gh-pages-static")
exec_arguments options[@]
}
#COMMIT
function commit {
function local-database {
echo "commit local-database"
commit-local-db
}
function remote-database {
echo "commit remote-database"
commit-remote-db
}
options=("local-database" "remote-database")
exec_arguments options[@]
}
#ADD
function add {
function custom-post-types {
echo "custom-post-types"
add-custom-post-types
}
function taxonomies {
echo "taxonomies"
add-taxonomies
}
options=("custom-post-types" "taxonomies")
exec_arguments options[@]
}
#DEPLOY
function deploy {
function stage {
echo "deploy stage"
deploy-stage
}
function static {
echo "deploy static"
deploy-static
}
function production {
echo "not yet implemented production deploy"
}
options=("stage" "static" "production")
exec_arguments options[@]
}
#CLEAR
function clear {
function remote-cache {
echo "clear remote-cache"
clear-remote-cache
}
options=("remote-cache")
exec_arguments options[@]
}
#CHECK
function check {
function uploads {
echo "check uploads"
check-uploads
}
options=("uploads")
exec_arguments options[@]
}
#BOOTSTRAP
function bootstrap {
function wordpress {
echo "wordpress"
bootstrap-wordpress
}
function static {
echo "static"
bootstrap-static
}
function static-spa {
echo "static spa"
bootstrap-static-spa
}
options=("wordpress" "static" "static-spa")
exec_arguments options[@]
}
#DEPLOY
function restore {
function remote {
function site {
echo "restore remote site"
restore-remote-site
}
function repository {
echo "restore repository"
restore-remote-repository
}
function config {
echo "restore config"
restore-remote-config
}
function uploads {
echo "restore uploads"
restore-remote-uploads
}
function database {
echo "restore database"
restore-remote-db
}
options=("site" "repository" "config" "uploads" "database")
exec_arguments options[@]
}
options=("remote")
exec_arguments options[@]
}
#ALL
function all {
function import-remote-databases-to-local {
echo "import all remote databases to local"
all-import-remote-to-local-db
}
function import-local-databases-to-remote {
echo "import all local databases to remote"
all-import-local-to-remote-db
}
function copy-remote-uploads {
echo "copy all remote uploads to local"
all-copy-remote-uploads-to-local
}
function copy-local-uploads {
echo "copy all local uploads to remote"
all-copy-local-uploads-to-remote
}
function npm-install {
echo "run npm install to all folders"
all-npm-install
}
function open-sites {
echo "open all local sites"
all-open-sites
}
function open-pagespeed {
echo "open all local sites for pagespeed"
all-open-pagespeed
}
function open-validate-html {
echo "open all local sites for validation"
all-open-validate-html
}
function open-resizer {
echo "open all local sites to Google resizer"
all-open-resizer
}
function symlink-uploads {
echo "Symlink uploads"
all-symlink-uploads
}
function deploy {
echo "deploy all sites to remote host"
all-deploy-sites
}
function dump-remote-db {
echo "dump all remote databases"
all-dump-remote-db
}
function dump-remote-htaccess {
echo "dump all remote .htaccess files"
all-dump-remote-htaccess
}
function dump-remote-env {
echo "dump all remote .env files"
all-dump-remote-env
}
function dump-remote-config {
echo "dump all remote config files"
all-dump-remote-config
}
function exec-command {
echo "deploy all sites to remote host"
all-exec-command
}
function update {
echo "update all sites"
all-update-sites
}
options=("dump-remote-db" "dump-remote-htaccess" "dump-remote-env" "dump-remote-config" "import-remote-databases-to-local" "import-local-databases-to-remote" "deploy" "update" "copy-remote-uploads" "copy-local-uploads" "open-sites" "open-pagespeed" "open-validate-html" "open-resizer" "symlink-uploads" "exec-command" "npm-install")
exec_arguments options[@]
}
#CHANGE
function change {
options=("git-upstream")
exec_arguments options[@]
}
#OPTIMIZE
function optimize {
function local-assets {
echo "optimize local assets"
optimize-local-assets
}
function local-uploads {
echo "optimize local uploads"
optimize-local-uploads
}
options=("local-assets" "local-uploads")
exec_arguments options[@]
}
function main {
options=("optimize" "init" "init-static" "import" "backup" "bootstrap" "restore" "clear" "commit" "check" "copy" "create" "add" "deploy" "change" "all")
exec_arguments options[@]
}
arguments=("$@")
main