Convert all scripts into a basic bash cli

This commit is contained in:
greg 2018-06-03 17:19:33 -04:00
parent 1a5118de49
commit 4617325367
27 changed files with 77 additions and 8 deletions

View file

@ -1 +1,4 @@
#!/bin/bash
cd ./shyft-cli/postgres_setup
psql -U postgres -d shyftdb -f drop_tables.psql psql -U postgres -d shyftdb -f drop_tables.psql

View file

@ -1 +1,4 @@
#!/bin/bash
cd ./shyft-cli/postgres_setup
psql -U postgres -d shyftdb -f create_tables.psql psql -U postgres -d shyftdb -f create_tables.psql

View file

@ -0,0 +1,4 @@
#!/bin/bash
cd ./shyft-cli/postgres_setup
psql -U postgres -f create_shyftdb.psql

View file

@ -1,4 +1,4 @@
file=$1 file=$1
echo $file echo Executing "${file}"...
runthing="./build/bin/geth --exec 'loadScript(\""$file"\")' attach http://127.0.0.1:8545" runthing="./build/bin/geth --exec 'loadScript(\""$file"\")' attach http://127.0.0.1:8545"
eval $runthing eval $runthing

17
shyft-cli/setup.sh Normal file
View file

@ -0,0 +1,17 @@
#!/bin/bash
if ! psql -lqt | cut -d \| -f 1 | grep -qw shyftdb; then # Check if db is instantiated
echo Creating postgres db...
sh ./shyft-cli/postgres_setup/initdb.sh && # Init DB
echo Successfully created postgres db! &&
sh ./shyft-cli/postgres_setup/init_tables.sh && # Init tables
sh ./shyft-cli/resetShyftGeth.sh && # Reset geth data
sh ./shyft-cli/initShyftGeth.sh # Init Shyft Geth
else
echo Postgres DB found!
sh ./shyft-cli/postgres_setup/drop_tables.sh && # Drop tables
sh ./shyft-cli/postgres_setup/init_tables.sh && # Init tables
sh ./shyft-cli/resetShyftGeth.sh && # Reset geth data
sh ./shyft-cli/initShyftGeth.sh # Init Shyft Geth
fi

View file

@ -0,0 +1,12 @@
#!/bin/bash
if ! psql -lqt | cut -d \| -f 1 | grep -qw shyftdb; then
echo Creating postgres db...
sh ./shyft-cli/postgres_setup/initdb.sh &&
echo Successfully created postgres db!
fi
sh ./shyft-cli/postgres_setup/drop_tables.sh && # Drop tables
sh ./shyft-cli/postgres_setup/init_tables.sh && # Init tables
sh ./shyft-cli/resetShyftGeth.sh && # Reset geth data
sh ./shyft-cli/initShyftGeth.sh # Init Shyft Geth

36
shyft-geth.sh Executable file
View file

@ -0,0 +1,36 @@
#!/bin/bash
illegalCommands=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--setup)
sh ./shyft-cli/setup.sh
shift # past argument
;;
--start)
sh ./shyft-cli/startShyftGeth.sh
shift # past argument
;;
--js)
sh ./shyft-cli/runJs.sh ./shyft-cli/web3/$2
shift # past argument
shift # past argument
;;
--reset)
sh ./shyft-cli/shyftFullReset.sh
shift # past argument
;;
*) # unknown option
illegalCommands+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
if [[ "${#illegalCommands[@]}" -gt "0" ]] ; then
echo The following commands are not supported: "${illegalCommands[*]}"
fi

View file

@ -1 +0,0 @@
psql -U postgres -f create_shyftdb.psql

View file

@ -1,5 +0,0 @@
cd ./shyftDb/postgres_setup
sh drop_tables.sh && sh init_tables.sh
cd ..
cd ..
sh resetShyftGeth.sh && sh initShyftGeth.sh