-
Notifications
You must be signed in to change notification settings - Fork 7
/
prebuild.py
55 lines (35 loc) · 1.48 KB
/
prebuild.py
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
# TODO - create different cloudfront distributions and S3 buckets for static files in different environments
import sys
sys.path.append('.')
from no8am.minify import update_static_files, update_metadata, invalidate_cache
def update_static_files_wrapper():
update_static_response = None
update_metadata_response = None
# Ask developer if static file update is necessary
while update_static_response not in ['y', 'n']:
update_static_response = raw_input("Update static files? [y/n]: ")
while update_metadata_response not in ['y', 'n']:
update_metadata_response = raw_input("Update metadata? [y/n]: ")
should_update_static = update_static_response == 'y'
should_update_metadata = update_metadata_response == 'y'
# update the requested files to S3 and invalidate the CloudFront cache
if should_update_static:
update_static_files()
if should_update_metadata:
update_metadata()
if should_update_static or should_update_metadata:
invalidate_cache()
# TODO - improve workaround to get multiple scheduled events for the same function
# https://github.com/Miserlou/Zappa/issues/506 - check for PR to Zappa
def update_metadata_wrapper_a():
update_metadata()
invalidate_cache()
def update_metadata_wrapper_b():
update_metadata()
invalidate_cache()
def update_metadata_wrapper_c():
update_metadata()
invalidate_cache()
def update_metadata_wrapper_d():
update_metadata()
invalidate_cache()