From 60c6cb3bcdc6edfaccd6df923a4b31ebf84d25f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20A=2E=20Ortega=20Froysa?= Date: Thu, 10 Nov 2022 17:45:00 +0100 Subject: [PATCH] Consolidate compilation and copy code. --- isidore.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/isidore.sh b/isidore.sh index 28f5028..8a449d7 100755 --- a/isidore.sh +++ b/isidore.sh @@ -184,25 +184,25 @@ function build_project() mkdir -p $OUTPUT_DIR/${i:${#SOURCE_DIR}} done - for i in $(find $SOURCE_DIR -name '*.php' -not -name '*.cfg.php') + for i in $(find site -type f -regextype posix-extended -not -regex '.*\.(cfg|CFG)\.(php|PHP)') do - : ${i:${#SOURCE_DIR}} - local OUT_FILE="$OUTPUT_DIR/${_: :-4}" - if [ $1 == 1 ] + if [[ $i =~ .*\.(php|PHP) ]] then - echo "Building $OUT_FILE ..." + : ${i:${#SOURCE_DIR}} + local OUT_FILE="$OUTPUT_DIR/${_: :-4}" + if [ $1 == 1 ] + then + echo "Building $OUT_FILE ..." + fi + cat $PROJECT_CONFIG_FILE $i | php > $OUT_FILE + else + local OUT_FILE="$OUTPUT_DIR/${i:${#SOURCE_DIR}}" + if [ $1 == 1 ] + then + echo "Copying $OUT_FILE ..." + fi + cp $i $OUT_FILE fi - cat $PROJECT_CONFIG_FILE $i | php > $OUT_FILE - done - - for i in $(find $SOURCE_DIR -type f -not -name '*.php') - do - local OUT_FILE="$OUTPUT_DIR/${i:${#SOURCE_DIR}}" - if [ $1 == 1 ] - then - echo "Copying $OUT_FILE ..." - fi - cp $i $OUT_FILE done }