mirror of https://github.com/rwf2/Rocket.git
Make running scripts more robust.
This commit is contained in:
parent
7dc6e432b8
commit
4a0984891a
|
@ -0,0 +1,23 @@
|
|||
# Simply sets up a few useful variables.
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function relative() {
|
||||
local full_path="${SCRIPT_DIR}/../${1}"
|
||||
echo $(realpath "${full_path}")
|
||||
}
|
||||
|
||||
EXAMPLES_DIR=$(relative "examples")
|
||||
LIB_DIR=$(relative "lib")
|
||||
CODEGEN_DIR=$(relative "codegen")
|
||||
CONTRIB_DIR=$(relative "contrib")
|
||||
DOC_DIR=$(relative "target/doc")
|
||||
|
||||
if [ "${1}" = "-p" ]; then
|
||||
echo $SCRIPT_DIR
|
||||
echo $EXAMPLES_DIR
|
||||
echo $LIB_DIR
|
||||
echo $CODEGEN_DIR
|
||||
echo $CONTRIB_DIR
|
||||
echo $DOC_DIR
|
||||
fi
|
|
@ -1,10 +1,9 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
EXAMPLES_DIR="examples"
|
||||
LIB_DIR="lib"
|
||||
CODEGEN_DIR="codegen"
|
||||
CONTRIB_DIR="contrib"
|
||||
# Brings in: EXAMPLES_DIR, LIB_DIR, CODEGEN_DIR, and CONTRIB_DIR, DOC_DIR
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source $SCRIPT_DIR/config.sh
|
||||
|
||||
# Add Cargo to PATH.
|
||||
export PATH=${HOME}/.cargo/bin:${PATH}
|
||||
|
@ -61,7 +60,7 @@ for file in ${EXAMPLES_DIR}/*; do
|
|||
if [ -x "${bootstrap_script}" ]; then
|
||||
echo ":: Bootstrapping ${file}..."
|
||||
|
||||
if ! ./${bootstrap_script}; then
|
||||
if ! ${bootstrap_script}; then
|
||||
echo ":: Running bootstrap script (${bootstrap_script}) failed!"
|
||||
echo ":: Skipping ${file}."
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue