Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux と macOS で挙動が異なっていた問題を修正 #160

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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