- Added the `herodo` package to the workspace. - Updated the MONOREPO_CONVERSION_PLAN.md to reflect the completion of the herodo package conversion. - Updated README.md and build_herodo.sh to reflect the new package structure. - Created herodo/Cargo.toml, herodo/README.md, herodo/src/main.rs, herodo/src/lib.rs, and herodo/tests/integration_tests.rs and herodo/tests/unit_tests.rs.
51 lines
1.2 KiB
Bash
Executable File
51 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Change to directory where this script is located
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
rm -f ./target/debug/herodo
|
|
|
|
# Build the herodo project from the herodo package
|
|
echo "Building herodo from herodo package..."
|
|
cd herodo
|
|
cargo build
|
|
# cargo build --release
|
|
cd ..
|
|
|
|
# Check if the build was successful
|
|
if [ $? -ne 0 ]; then
|
|
echo "Build failed. Please check the error messages."
|
|
exit 1
|
|
fi
|
|
|
|
# Echo a success message
|
|
echo "Build successful!"
|
|
|
|
if [ "$EUID" -eq 0 ]; then
|
|
echo "Running as root, copying to /usr/local/bin/"
|
|
cp target/debug/herodo /usr/local/bin/herodo
|
|
else
|
|
echo "Running as non-root user, copying to ~/hero/bin/"
|
|
mkdir -p ~/hero/bin/
|
|
cp target/debug/herodo ~/hero/bin/herodo
|
|
fi
|
|
|
|
# Check if a script name was provided
|
|
if [ $# -eq 1 ]; then
|
|
echo "Running specified test: $1"
|
|
|
|
# Check if the script exists in src/rhaiexamples/
|
|
if [ -f "src/rhaiexamples/$1.rhai" ]; then
|
|
herodo "src/rhaiexamples/$1.rhai"
|
|
# Check if the script exists in src/herodo/scripts/
|
|
elif [ -f "src/herodo/scripts/$1.rhai" ]; then
|
|
herodo "src/herodo/scripts/$1.rhai"
|
|
else
|
|
echo "Error: Script $1.rhai not found in src/rhaiexamples/ or src/herodo/scripts/"
|
|
exit 1
|
|
fi
|
|
|
|
exit 0
|
|
fi
|