From ad077eac38a0616cebe88105a9e44b3b54e0d263 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 27 Oct 2017 10:57:59 -0200 Subject: Better message handling --- templater | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'templater') diff --git a/templater b/templater index 2fb612b..f7d5b48 100755 --- a/templater +++ b/templater @@ -41,6 +41,12 @@ function __templater_implementations { grep "^function templater_" $PROGRAM | cut -d ' ' -f 2 | sed -e 's/templater_//' } +# Message +function __templater_echo { + #echo "" + echo "-> $*" +} + # Checkout to develop branch if available function __templater_checkout_develop { if git branch --list develop | grep -q develop; then @@ -84,11 +90,14 @@ function templater_basic { # Git implementation function templater_git { if [ ! -d ".git" ]; then + __templater___templater_echo "Setting up git..." touch .gitignore git init git add . #git commit -m "Initial import" + else + __templater_echo "Git already installed" fi } @@ -97,8 +106,7 @@ function templater_githooks { # TODO: check if githooks are already set if [ -d ".git" ]; then if which git-hooks &> /dev/null; then - echo "" - echo "Installing hooks..." + __templater___templater_echo "Setting up git-hooks..." git hooks --install fi fi @@ -108,11 +116,13 @@ function templater_githooks { function templater_gitflow { if ! grep -q '^\[gitflow' .git/config; then if ! git branch --list develop | grep -q develop; then + __templater___templater_echo "Setting up git-flow..." + git branch develop if [ -e "/usr/lib/git-core/git-flow" ]; then echo "" - echo "Setting up git-flow..." + __templater_echo "Setting up git-flow..." git flow init -d fi fi @@ -122,8 +132,7 @@ function templater_gitflow { # Vagrant implementation function templater_vagrant { if [ ! -e "Vagrantfile" ]; then - echo "" - echo "Setting up vagrant..." + __templater___templater_echo "Setting up vagrant..." #__templater_checkout_develop vagrant init echo '.vagrant' >> .gitignore @@ -134,8 +143,7 @@ function templater_vagrant { # KVMX implementation function templater_kvmx { if [ ! -e "kvmxfile" ]; then - echo "" - echo "Setting up vagrant..." + __templater___templater_echo "Setting up kvmx..." kvmx init #git commit -a -m "Adds kvmx support" fi @@ -144,8 +152,7 @@ function templater_kvmx { # Puppet implementation function templater_puppet { if [ ! -d "puppet" ]; then - echo "" - echo "Setting up puppet..." + __templater___templater_echo "Setting up puppet..." # Use the best approach #git clone $BOOSTRAP $PROJECT/puppet @@ -158,8 +165,7 @@ function templater_puppet { # Ikiwiki implementation function templater_ikiwiki { if [ ! -e "ikiwiki.yaml" ]; then - echo "" - echo "Setting up ikiwiki..." + __templater___templater_echo "Setting up ikiwiki..." #__templater_checkout_develop __templater_copy_or_append ikiwiki .gitignore @@ -199,8 +205,7 @@ function templater_ikiwiki { # Sphinx implementation function templater_sphinx { if [ ! -e "conf.py" ]; then - echo "" - echo "Setting up sphinx..." + __templater_echo "Setting up sphinx..." #__templater_checkout_develop __templater_copy_or_append sphinx .gitignore @@ -229,8 +234,7 @@ function templater_sphinx { # Pelican implementation function templater_pelican { if [ ! -e "pelicanconf.py" ]; then - echo "" - echo "Setting up pelican..." + __templater_echo "Setting up pelican..." #__templater_checkout_develop __templater_copy_or_append pelican .gitignore @@ -312,4 +316,4 @@ fi # Teardown cd $CWD -echo "Done processing the project :)" +__templater_echo "Done processing the project :)" -- cgit v1.2.3