From f8e9624fe308171c3c452d583917280910fc9169 Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Sun, 20 Jul 2025 19:06:26 -0700 Subject: [PATCH 1/2] Make `run-examples.sh` less location-dependent --- app-proto/run-examples.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app-proto/run-examples.sh b/app-proto/run-examples.sh index 50fafbe..0af2e35 100644 --- a/app-proto/run-examples.sh +++ b/app-proto/run-examples.sh @@ -3,8 +3,14 @@ # Karol Kuczmarski. "Add examples to your Rust libraries" # http://xion.io/post/code/rust-examples.html # +# you should invoke this script by calling `sh` or another interpreter, rather +# than calling `souce`, to ensure that the script can find the manifest file for +# the application prototype -cargo run --example irisawa-hexlet; echo -cargo run --example three-spheres; echo -cargo run --example point-on-sphere; echo -cargo run --example kaleidocycle \ No newline at end of file +# find the manifest file for the application prototype +MANIFEST="$(dirname -- $0)/Cargo.toml" + +cargo run --manifest-path $MANIFEST --example irisawa-hexlet; echo +cargo run --manifest-path $MANIFEST --example three-spheres; echo +cargo run --manifest-path $MANIFEST --example point-on-sphere; echo +cargo run --manifest-path $MANIFEST --example kaleidocycle \ No newline at end of file From edeb080745efe3190f3c38f2eb05bf2d17bdd1dc Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Sun, 20 Jul 2025 19:28:53 -0700 Subject: [PATCH 2/2] Reduce repetition in `run-examples.sh` --- app-proto/run-examples.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app-proto/run-examples.sh b/app-proto/run-examples.sh index 0af2e35..861addf 100644 --- a/app-proto/run-examples.sh +++ b/app-proto/run-examples.sh @@ -10,7 +10,11 @@ # find the manifest file for the application prototype MANIFEST="$(dirname -- $0)/Cargo.toml" -cargo run --manifest-path $MANIFEST --example irisawa-hexlet; echo -cargo run --manifest-path $MANIFEST --example three-spheres; echo -cargo run --manifest-path $MANIFEST --example point-on-sphere; echo -cargo run --manifest-path $MANIFEST --example kaleidocycle \ No newline at end of file +# set up the command that runs each example +RUN_EXAMPLE="cargo run --manifest-path $MANIFEST --example" + +# run the examples +$RUN_EXAMPLE irisawa-hexlet; echo +$RUN_EXAMPLE three-spheres; echo +$RUN_EXAMPLE point-on-sphere; echo +$RUN_EXAMPLE kaleidocycle \ No newline at end of file