Skip to content

Commit

Permalink
Merge pull request #160 from abap34/bug/#159
Browse files Browse the repository at this point in the history
Linux と macOS で挙動が異なっていた問題を修正
  • Loading branch information
abap34 authored Sep 18, 2024
2 parents 0c5d64a + aa047e6 commit dcfc3be
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,30 @@
mode=$(set -o | grep noglob | awk '{print $2}')
set -f

src_dir="src/"
build_dir="build/"
src_dir="src"
build_dir="build"
data_petterns=("*.css" "*.html" "*.js")
verbose=0


# 指定された内容を指定色で表示する.
# 指定なければ デフォルト、 赤か緑を指定できる
function vprint() {
if [ $verbose -eq 1 ]; then
echo "$1"
if [ $2 ]; then
if [ $2 == "green" ]; then
echo -e "\033[32m$1\033[0m"
elif [ $2 == "red" ]; then
echo -e "\033[31m$1\033[0m"
else
echo -e "\033[31m$1\033[0m"
fi
else
echo $1
fi
fi
}


while getopts "v" opt; do
case $opt in
v)
Expand All @@ -29,26 +41,14 @@ while getopts "v" opt; do
esac
done


vprint "========================================"
vprint "Start setup"
vprint " src_dir: $src_dir"
vprint " build_dir: $build_dir"
vprint " data_petterns: ${data_petterns[@]}"
vprint "========================================"


mkdir -p "$build_dir"
cp -r "$src_dir" "$build_dir"
cp -r "$src_dir"/. "$build_dir"


for file in $(find $build_dir -type f); do
vprint "----------------------------------------"
vprint "Check $file for data files"
for pettern in ${data_petterns[@]}; do
vprint " Check $pettern"
if [[ $file == $build_dir/*$pettern ]]; then
vprint "$file is matching $pettern"
vprint " Matched! with $pettern => $file" green
echo "R\"(" > "$file.tmp"
cat "$file" >> "$file.tmp"
echo ")\"" >> "$file.tmp"
Expand Down

0 comments on commit dcfc3be

Please sign in to comment.