sh scripts run with bin dist and in source tree
This commit is contained in:
parent
757fd28756
commit
3415e436ba
@ -1,3 +1,6 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# Run basebox broker from the samples/toodo/bbconf directory
|
||||
../../basebox/bin/broker -c broker-config.toml
|
||||
|
||||
. ./util.sh
|
||||
|
||||
bb_run broker -c broker-config.toml
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# Compile the todo schema.
|
||||
#
|
||||
../../baseboxbin/bbc --prefix=bb_todo -f todo_schema.graphql
|
||||
. ./util.sh
|
||||
|
||||
bb_run bbc --prefix=bb_todo -f todo_schema.graphql
|
||||
|
@ -1,3 +1,6 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# Run basebox dbproxy from the samples/toodo/bbconf directory
|
||||
../../basebox/bin/dbproxy -c dbproxy-config.toml
|
||||
|
||||
. ./util.sh
|
||||
|
||||
bb_run dbproxy -c dbproxy-config.toml
|
||||
|
34
bbconf/util.sh
Normal file
34
bbconf/util.sh
Normal file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Utility functions for basebox test shell scripts
|
||||
#
|
||||
|
||||
bin_dir="../../basebox/bin"
|
||||
source_dir="../../.."
|
||||
|
||||
#
|
||||
# Run a basebox command.
|
||||
#
|
||||
# Assuming that if run by a customer that wants to try the demo app, we first look if there
|
||||
# is an exeutable at "../../basebox/bin/$1" and run it if present.
|
||||
# If not, we assume this is being run inside of a basebox developer environment and start the
|
||||
# command with "cargo run".
|
||||
#
|
||||
function bb_run {
|
||||
command="$1"
|
||||
args="${@:2}"
|
||||
|
||||
# check bin directory
|
||||
if [ -f "$bin_dir/$command" ]; then
|
||||
"$bin_dir/$command" $args
|
||||
return $?
|
||||
fi
|
||||
|
||||
# check source tree
|
||||
if [ -d "$source_dir/$command" ]; then
|
||||
cargo run --manifest-path=$source_dir/$command/Cargo.toml -- $args
|
||||
return $?
|
||||
fi
|
||||
|
||||
echo "Program '$command' not found!"
|
||||
return 2
|
||||
}
|
Loading…
Reference in New Issue
Block a user