Ensure existence of static build dir

main
Ben Busby 2021-07-02 15:28:27 -04:00
parent 68fdd55482
commit 13202cc6b1
No known key found for this signature in database
GPG Key ID: 339B7B7EB5333D14
4 changed files with 9 additions and 4 deletions

2
.gitignore vendored
View File

@ -12,6 +12,6 @@ app/static/custom_config
app/static/bangs app/static/bangs
# pip stuff # pip stuff
build/ /build/
dist/ dist/
*.egg-info/ *.egg-info/

View File

@ -101,7 +101,12 @@ for cb_dir in cache_busting_dirs:
full_cb_path = os.path.join(full_cb_dir, cb_file) full_cb_path = os.path.join(full_cb_dir, cb_file)
cb_file_link = gen_file_hash(full_cb_dir, cb_file) cb_file_link = gen_file_hash(full_cb_dir, cb_file)
build_path = os.path.join(app.config['BUILD_FOLDER'], cb_file_link) build_path = os.path.join(app.config['BUILD_FOLDER'], cb_file_link)
os.symlink(full_cb_path, build_path)
try:
os.symlink(full_cb_path, build_path)
except FileExistsError:
# Symlink hasn't changed, ignore
pass
# Create mapping for relative path urls # Create mapping for relative path urls
map_path = build_path.replace(app.config['APP_ROOT'], '') map_path = build_path.replace(app.config['APP_ROOT'], '')

2
app/static/build/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
run
View File

@ -12,8 +12,6 @@ SUBDIR="${1:-app}"
export APP_ROOT="$SCRIPT_DIR/$SUBDIR" export APP_ROOT="$SCRIPT_DIR/$SUBDIR"
export STATIC_FOLDER="$APP_ROOT/static" export STATIC_FOLDER="$APP_ROOT/static"
rm -rf $STATIC_FOLDER/build
# Check for regular vs test run # Check for regular vs test run
if [[ "$SUBDIR" == "test" ]]; then if [[ "$SUBDIR" == "test" ]]; then
# Set up static files for testing # Set up static files for testing