From bf3ad058f49bafb7a5c668a5154732811aeb62b3 Mon Sep 17 00:00:00 2001 From: c0repwn3r Date: Wed, 24 May 2023 09:58:42 -0400 Subject: [PATCH] patcher more betterer --- patches/blocks/0003-re-enable-my-blocks.patch | 44 +++++++++++++++++++ pbt.sh | 42 +++++++++++++++--- 2 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 patches/blocks/0003-re-enable-my-blocks.patch diff --git a/patches/blocks/0003-re-enable-my-blocks.patch b/patches/blocks/0003-re-enable-my-blocks.patch new file mode 100644 index 0000000..d126a88 --- /dev/null +++ b/patches/blocks/0003-re-enable-my-blocks.patch @@ -0,0 +1,44 @@ +From 37f886f8bdd68cc14c637da6dfb1af338972a863 Mon Sep 17 00:00:00 2001 +From: c0repwn3r +Date: Wed, 24 May 2023 08:59:47 -0400 +Subject: [PATCH] re-enable my blocks + +--- + blocks_vertical/{upstream => }/procedures.js | 0 + tests/custom_procedure_playground.html | 2 +- + tests/vertical_playground.html | 1 + + 3 files changed, 2 insertions(+), 1 deletion(-) + rename blocks_vertical/{upstream => }/procedures.js (100%) + +diff --git a/blocks_vertical/upstream/procedures.js b/blocks_vertical/procedures.js +similarity index 100% +rename from blocks_vertical/upstream/procedures.js +rename to blocks_vertical/procedures.js +diff --git a/tests/custom_procedure_playground.html b/tests/custom_procedure_playground.html +index 8780a8af..e0e259eb 100644 +--- a/tests/custom_procedure_playground.html ++++ b/tests/custom_procedure_playground.html +@@ -14,7 +14,7 @@ + + + +- ++ + + + +diff --git a/tests/vertical_playground.html b/tests/vertical_playground.html +index 7eab4fd9..146ff974 100644 +--- a/tests/vertical_playground.html ++++ b/tests/vertical_playground.html +@@ -27,6 +27,7 @@ + + + ++ + + + +-- +2.40.1 + diff --git a/pbt.sh b/pbt.sh index 4dee98f..de2d834 100755 --- a/pbt.sh +++ b/pbt.sh @@ -89,11 +89,43 @@ sub_compile() { job_success "scratch-blocks" "compile" } +sub_patchc() { + job_start "generic" "patch-create:collect-info" + read -rp "Enter the current project name: " project + read -rp "Enter the patchlist ID (blocks for scratch-blocks): " plist + job_success "generic" "patch-create:collect-info" + job_start "$project" "patch-create" + cd "$project" || exit + fname=$(git format-patch -1 HEAD -o ../patches/"$plist"/) + base=$(basename "$fname") + patchnumnp=$(find ../patches/"$plist" -type f -name "*.patch" | wc -l) + patchnum=$(printf "%04d" "$patchnumnp") + nonumfname="$(echo "$base" | cut -c 5-)" + newfname="$patchnum$nonumfname" + newpath=$(echo "$fname" | sed "s/$base/$newfname/" -) + mv "$fname" "$newpath" + echo "Wrote out patch file to $newfname" + job_success "$project" "patch-create" + echo "Checking that patch file applies cleanly" + job_start "$project" "patch-check" + cd .. || exit + sub_patch + job_success "$project" "patch-check" +} + +sub_reset() { + sub_clone +} + sub_help() { - echo "clone - clone upstream source code" - echo "patch - apply patches" - echo "compile - compile bundles" - echo "bundle - create prod bundles" + echo "--- PyBlocks Build Tool ---" + echo "usage: ./pbt.sh [command]" + echo " clone - clone upstream source code" + echo " patch - (re)apply patches" + echo " compile - compile bundles" + echo " bundle - create prod bundles" + echo " patchc - create a patch for the current project" + echo " reset - reset to upstream patch base (equivalent to clone)" } subcommand=$1 @@ -104,7 +136,7 @@ case $subcommand in *) echo "[*] Running build command $subcommand" shift - sub_${subcommand} $@ + sub_"${subcommand}" "$@" if [ $? = 127 ]; then echo "Error: '$subcommand' is not a known subcommand." >&2 echo " Run 'pbt.sh --help' for a list of known subcommands." >&2