-
Notifications
You must be signed in to change notification settings - Fork 5
/
extra_script.py
31 lines (21 loc) · 975 Bytes
/
extra_script.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
import os
Import("env")
print(">>> Current CLI targets", COMMAND_LINE_TARGETS)
print(">>> Current Build targets", BUILD_TARGETS)
# print(env.Dump())
# host = env.GetProjectOption("custom_ping_host")
def before_buildfs(source, target, env):
print("\n>>> before_buildfs: build-www")
env.Execute("ruby shared/build-www.rb")
print("\n>>> before_buildfs: copy assets")
env.Execute("rsync --delete -av shared/assets/ data/assets/")
print("\n>>> before_buildfs: gzip assets")
env.Execute("find data/ -type f \( -name \*.css -o -name \*.js -o -name \*.html \) -exec gzip -f \"{}\" \;")
print("\n>>> before_buildfs: total size")
env.Execute("du -sh data")
env.Execute("du -sh data/*")
env.AddPreAction("buildfs", before_buildfs)
def after_buildfs(source, target, env):
print("\n>>> after_buildfs: unzip assets")
# env.Execute("find data/ -type f -name *.gz -exec gunzip -f \"{}\" \;")
env.AddPostAction("buildfs", after_buildfs)