templates.bin.stool-function Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stool Show documentation
Show all versions of stool Show documentation
Runs multiple web applications in multiple tomcats on a single machine.
Stool is a command line tool that provides a lifecycle for stages:
create, configure, build, run and remove. A stage contains web applications,
that may come in different flavors: Maven war projects or artifacts
(GAV coordinates).
The newest version!
# Stool shell functions for bash
# Source this file in your ~/.bashrc
export STOOL_INVOCATION=${{stool.bin}}/home/run/users/.stool-invocation-$$-$(date +%N)
${{man.path}}
stool() {
# Special variable handling: they are private and you cannot export them on Mac OS.
# We make them available to the java code under the EXPORTED_ prefix
export EXPORTED_PS1="$PS1"
export EXPORTED_PWD="$PWD"
# adjust this to configure a specific java version
local java=java
local bin=${{stool.bin}}
local cp
local verbose=false
local command="empty"
for arg in $* ; do
case "$arg" in
-v) verbose=true ;;
-*) true ;;
*)
if [ $command = "empty" ] ; then
command=$arg
fi
;;
esac
done
if [ $command = "reselect" ]; then
if [ -f $bin/home/run/users/$USER ]; then
if $verbose ; then
echo "reselect"
fi
. $bin/home/run/users/$USER
else
if $verbose ; then
echo "reselect none"
fi
fi
else
if [ -z $STOOL_SOURCE ] ; then
cp="$bin/stool.jar"
else
# for stool development
cp=$STOOL_SOURCE/target/setup-stool
if [ ! -e $cp ] ; then
echo "$cp not found. Check your STOOL_SOURCE variable and re-build."
return
fi
fi
for jar in $bin/home/extensions/*.jar; do
# caution: if the extensions directory is empty, $jar is the pattern ...
if [ -f $jar ] ; then
cp="$cp:$jar"
fi
done
STOOL_BIN=$bin $java $STOOL_OPTS -cp $cp net.oneandone.stool.Main -invocation $STOOL_INVOCATION "$@"
result=$?
if [ -f $STOOL_INVOCATION ] ; then
. $STOOL_INVOCATION
# I've seen an empty $USER when running stool from a cron jobs
mv -f $STOOL_INVOCATION $bin/home/run/users/$USER || echo '$USER variable is not set'
fi
fi
unset EXPORTED_PS1
unset EXPORTED_PWD
return $result
}
stoolIndicatorColor() {
local RED="\033[0;31m"
local BLUE_BACKGROUND="\033[44;1;37m"
local DIR=${{stool.bin}}/home/backstages/$STOOL_SELECTED/anchor
if [ ! -e $DIR ] ; then
echo -e "$BLUE_BACKGROUND"
else
if [ `uname` = Darwin ] ; then
local fmt=-f
else
local fmt=--format
fi
if [ $(id -u) = $(stat -L $fmt %u $DIR) ] ; then
echo -e ""
else
echo -e "$RED"
fi
fi
}
if [ "x$BASH" != "x" ] ; then
. ${{stool.bin}}/stool-complete
fi