patcher more betterer

This commit is contained in:
c0repwn3r 2023-05-24 09:58:42 -04:00
parent 7b20b9f89c
commit bf3ad058f4
Signed by: core
GPG Key ID: FDBF740DADDCEECF
2 changed files with 81 additions and 5 deletions

View File

@ -0,0 +1,44 @@
From 37f886f8bdd68cc14c637da6dfb1af338972a863 Mon Sep 17 00:00:00 2001
From: c0repwn3r <core@coredoes.dev>
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 @@
<script src="../blocks_vertical/upstream/event.js"></script>
<script src="../blocks_vertical/upstream/motion.js"></script>
<script src="../blocks_vertical/upstream/looks.js"></script>
- <script src="../blocks_vertical/upstream/procedures.js"></script>
+ <script src="../blocks_vertical/procedures.js"></script>
<script src="../blocks_vertical/operators.js"></script>
<script src="../blocks_vertical/pen.js"></script>
<script src="../blocks_vertical/upstream/sound.js"></script>
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 @@
<script src="../blocks_vertical/operators.js"></script>
<script src="../blocks_vertical/control.js"></script>
<script src="../blocks_vertical/imu.js"></script>
+ <script src="../blocks_vertical/procedures.js"></script>
<!-- PyBlocks end -->
--
2.40.1

42
pbt.sh
View File

@ -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