diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-03-16 10:37:24 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-03-16 10:37:24 -0300 |
commit | 1c8afde62ea550c6db0de80d1873feff5e3c7038 (patch) | |
tree | bc5bafd441373fd792ebbf2eb346b0f4dad64fa9 /inception | |
parent | 9a509b083bae8f995ce8a4eb3f708b8a54d0b960 (diff) | |
download | apps-1c8afde62ea550c6db0de80d1873feff5e3c7038.tar.gz apps-1c8afde62ea550c6db0de80d1873feff5e3c7038.tar.bz2 |
Inception: split into functions
Diffstat (limited to 'inception')
-rwxr-xr-x | inception | 59 |
1 files changed, 50 insertions, 9 deletions
@@ -7,10 +7,14 @@ BASENAME="`basename $0`" DIRNAME="$(cd `dirname $0` &> /dev/null && pwd)" -# Main -if [ -z "$1" ]; then +# Usage +function inception_usage { echo "usage: $BASENAME <action> [options]" -elif [ "$1" == "init" ]; then + exit 1 +} + +# Initialize +function inception_init { ( cd $DIRNAME @@ -39,7 +43,10 @@ elif [ "$1" == "init" ]; then echo "" echo "Please manually verify dotfiles version and tag from the above output." echo "If everything is fine, proceed running this command again with the 'load' parameter." -elif [ "$1" == "load" ]; then +} + +# Load +function inception_load { ( cd $DIRNAME @@ -64,12 +71,18 @@ elif [ "$1" == "load" ]; then ) echo "Done. Logout and login again to apply all changes." -elif [ "$1" == "install" ]; then +} + +# Install +function inception_install { # We could just do that, but we shall make sure that code was verified #$0 init #$0 load echo "Please README!" -elif [ "$1" == "deploy" ]; then +} + +# Deploy +function inception_deploy { if [ ! -z "$2" ]; then REMOTE="$2" MODULES="`$DIRNAME/metadot/metadot installed | xargs`" @@ -93,10 +106,38 @@ elif [ "$1" == "deploy" ]; then ##### END REMOTE SCRIPT ####### EOF fi -elif [ "$1" == "version" ]; then +} + +# Version information +function inception_version { ( cd $DIRNAME && git log --show-signature -n 1 ) -elif [ "$1" == "fetch" ]; then +} + +# Fetch +function inception_fetch { ( cd $DIRNAME && git fetch --all && git log -n 1 --branches=origin/master ) -elif [ "$1" == "merge" ]; then +} + +# Merge +function inception_merge { ( cd $DIRNAME && git merge origin/master && git submodule update --init --recursive ) +} + +# Main +if [ -z "$1" ]; then + inception_usage +elif [ "$1" == "init" ]; then + inception_init +elif [ "$1" == "load" ]; then + inception_load $* +elif [ "$1" == "install" ]; then + inception_install $* +elif [ "$1" == "deploy" ]; then + inception_deploy $* +elif [ "$1" == "version" ]; then + inception_version +elif [ "$1" == "fetch" ]; then + inception_fetch +elif [ "$1" == "merge" ]; then + inception_merge fi |