From 25b6309cf248a1c5c092780e98107d281999bd85 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 26 Jun 2021 08:46:20 +0200 Subject: [mod] move functions from utils/manage_static.sh to ./manage script The functions: - static.build.commit - static.build.commit.drop - static.build.restore are imported into the ./manage script. To avoid name collisions some variables and fucntions has been renamed by adding the prefix *static_*. Signed-off-by: Markus Heiser --- utils/lib_static.sh | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100755 utils/lib_static.sh (limited to 'utils/lib_static.sh') diff --git a/utils/lib_static.sh b/utils/lib_static.sh new file mode 100755 index 000000000..0d4ba9bad --- /dev/null +++ b/utils/lib_static.sh @@ -0,0 +1,124 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: AGPL-3.0-or-later + + +STATIC_BUILD_COMMIT="[build] /static" +STATIC_BUILT_PATHS=( + searx/static/themes/oscar/css + searx/static/themes/oscar/js + searx/static/themes/oscar/src/generated/pygments-logicodev.less + searx/static/themes/oscar/src/generated/pygments-pointhi.less + searx/static/themes/simple/css + searx/static/themes/simple/js + searx/static/themes/simple/src/generated/pygments.less +) + +static_help(){ + cat </dev/null + + ( set -e + # build the themes + themes.all + + # add build files + for built_path in "${STATIC_BUILT_PATHS[@]}"; do + git add -v "${built_path}" + done + + # check for modified files that are not staged + if [ -n "$(git diff --name-only)" ]; then + die 42 "themes.all has created files that are not in STATIC_BUILT_PATHS" + fi + git commit -m "${STATIC_BUILD_COMMIT}" + ) +} + +static.build.restore() { + build_msg STATIC "git-restore of the built files (/static)" + git restore --staged "${STATIC_BUILT_PATHS[@]}" + git restore --worktree "${STATIC_BUILT_PATHS[@]}" +} -- cgit v1.2.3