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
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
EXAMPLES_DIR="examples"
|
# Brings in: EXAMPLES_DIR, LIB_DIR, CODEGEN_DIR, and CONTRIB_DIR, DOC_DIR
|
||||||
LIB_DIR="lib"
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
CODEGEN_DIR="codegen"
|
source $SCRIPT_DIR/config.sh
|
||||||
CONTRIB_DIR="contrib"
|
|
||||||
|
|
||||||
# Add Cargo to PATH.
|
# Add Cargo to PATH.
|
||||||
export PATH=${HOME}/.cargo/bin:${PATH}
|
export PATH=${HOME}/.cargo/bin:${PATH}
|
||||||
|
@ -61,7 +60,7 @@ for file in ${EXAMPLES_DIR}/*; do
|
||||||
if [ -x "${bootstrap_script}" ]; then
|
if [ -x "${bootstrap_script}" ]; then
|
||||||
echo ":: Bootstrapping ${file}..."
|
echo ":: Bootstrapping ${file}..."
|
||||||
|
|
||||||
if ! ./${bootstrap_script}; then
|
if ! ${bootstrap_script}; then
|
||||||
echo ":: Running bootstrap script (${bootstrap_script}) failed!"
|
echo ":: Running bootstrap script (${bootstrap_script}) failed!"
|
||||||
echo ":: Skipping ${file}."
|
echo ":: Skipping ${file}."
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue