fix: Restore assets during bench init

This commit is contained in:
Gavin D'souza 2020-10-13 17:25:05 +05:30
parent 1ad3bb76a5
commit f5e1cdc5ce

View file

@ -40,6 +40,7 @@ def build_missing_files():
# check which files dont exist yet from the build.json and tell build.js to build only those!
missing_assets = []
current_asset_files = []
frappe_build = os.path.join("..", "apps", "frappe", "frappe", "public", "build.json")
for type in ["css", "js"]:
current_asset_files.extend(
@ -49,7 +50,7 @@ def build_missing_files():
]
)
with open(os.path.join(sites_path, "assets", "frappe", "build.json")) as f:
with open(frappe_build) as f:
all_asset_files = json.load(f).keys()
for asset in all_asset_files:
@ -118,6 +119,11 @@ def download_frappe_assets(verbose=True):
if not file.isdir():
dest = "." + file.name.replace("./frappe-bench/sites", "")
show = dest.replace("./assets/", "")
dirname = os.path.dirname(dest)
if not os.path.exists(dirname):
os.makedirs(dirname, exist_ok=True)
tar.makefile(file, dest)
print("{0} Restored {1}".format(green(''), show))