start script rewrite with options, banner, and colors

This commit is contained in:
Matthias Kretschmann 2018-10-10 12:21:56 +02:00
parent 3035d83273
commit d510167707
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 75 additions and 16 deletions

26
.banner Normal file
View File

@ -0,0 +1,26 @@
Welcome to
,-._
_.-' '--.
.' _ -`\_
/ .----.`_.'----'
;/ `
/_;
._ ._ ._ ._
_.-._)`\_.-._)`\_.-._)`\_.-._)`\_.-._
___ ___ _ _
/ _ \ __ ___ __ _ _ _ | _ \_ _ ___| |_ ___ __ ___| |
| (_) / _/ -_) _` | ' \ | _/ '_/ _ \ _/ _ \/ _/ _ \ |
\___/\__\___\__,_|_||_| |_| |_| \___/\__\___/\__\___/_|
---
Get info: oceanprotocol.com
Get code: github.com/oceanprotocol
Get help: gitter.im/oceanprotocol/Lobby
---

View File

@ -9,24 +9,57 @@ export REUSE_DATABASE="false"
export KEEPER_NETWORK_NAME="ganache"
export ARTIFACTS_FOLDER=~/.ocean/keeper-contracts/artifacts
# default to `stable` versions of all components
# unless `--latest` argument is given
if [ "$1" == "--latest" ] || [ "$2" == "--latest" ]; then
export OCEAN_VERSION=latest
else
export OCEAN_VERSION=stable
fi
# colors
COLOR_R="\033[0;31m" # red
COLOR_G="\033[0;32m" # green
COLOR_Y="\033[0;33m" # yellow
COLOR_B="\033[0;34m" # blue
COLOR_M="\033[0;35m" # magenta
COLOR_C="\033[0;36m" # cyan
if [ "$1" == "--no-pleuston" ]; then
# reset
COLOR_RESET="\033[00m"
export REUSE_DATABASE="true"
docker-compose --project-name=ocean -f docker-compose-no-pleuston.yml up
function show_banner {
local output=$(cat .banner)
echo -e "$COLOR_B$output$COLOR_RESET"
echo ""
}
elif [ "$1" == "--local-parity-node" ]; then
show_banner
export KEEPER_NETWORK_NAME="ocean_poa_net_local"
docker-compose --project-name=ocean -f docker-compose-local-parity-node.yml up
# default to stable versions
export OCEAN_VERSION=stable
COMPOSE_FILE='docker-compose.yml'
else
docker-compose --project-name=ocean up
fi
while :; do
case $1 in
--latest)
export OCEAN_VERSION=latest
printf $COLOR_Y'Switched to latest components...\n\n'$COLOR_RESET
;;
--no-pleuston)
export REUSE_DATABASE="true"
COMPOSE_FILE='docker-compose-no-pleuston.yml'
printf $COLOR_Y'Starting without Pleuston...\n\n'$COLOR_RESET
;;
--local-parity-node)
export KEEPER_NETWORK_NAME="ocean_poa_net_local"
COMPOSE_FILE='docker-compose-local-parity-node.yml'
printf $COLOR_Y'Starting with local Parity node...\n\n'$COLOR_RESET
;;
--) # End of all options.
shift
break
;;
-?*)
printf $COLOR_R'WARN: Unknown option (ignored): %s\n'$COLOR_RESET "$1" >&2
break
;;
*)
printf $COLOR_Y'Starting Ocean...\n\n'$COLOR_RESET
docker-compose --project-name=ocean -f $COMPOSE_FILE up
break
esac
shift
done