diff --git a/.gitignore b/.gitignore index 485dee6..71940dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .idea +scratch-blocks +scratch-gui diff --git a/pbt.sh b/pbt.sh index bba9f74..aee3666 100755 --- a/pbt.sh +++ b/pbt.sh @@ -6,37 +6,51 @@ job_start() { # [*] job start - [target]:[job] # bold echo -e "\e[1m[*] job start - $1:$2\e[0m" - job_start=$(date +%s) + job_start=$(date +%s.%N) } job_success() { # [*] success! [target]:[job] finished in 241.2s :) - end=$(date +%s) - time=$(( end - job_start )) + end=$(date +%s.%N) + time=$( echo "$end - $job_start" | bc -l ) echo -e "\e[1m\e[32m[*] success! $1:$2 finished in $time seconds :)\e[0m" } job_fail() { # [x] FAIL! [target]:[job] failed in 241.2s :( - end=$(date +%s) - time=$(( end - job_start )) + end=$(date +%s.%N) + time=$( echo "$end - $job_start" | bc -l ) echo -e "\e[1m\e[31m[*] FAIL! $1:$2 failed in $time seconds :(\e[0m" } +job_skip() { + # [-] skipped - [target]:[job] skipped in 241.2s + end=$(date +%s.%N) + time=$( echo "$end - $job_start" | bc -l ) + echo -e "\e[1m\e[34m[-] skipped - $1:$2 skipped after $time seconds\e[0m" +} sub_clone() { job_start "scratch-blocks" "clone" - - git submodule init + if [ -d "$(pwd)/scratch-blocks" ]; then + echo "Clone dir already exists" + job_skip "scratch-blocks" "clone" + else + git clone https://github.com/scratchfoundation/scratch-blocks scratch-blocks + if [ "$?" != "0" ]; then + job_fail "scratch-blocks" "clone" + exit 1 + fi + job_success "scratch-blocks" "clone" + fi + job_start "scratch-blocks" "checkout" + pbase=$(