diff options
-rwxr-xr-x | templater (renamed from project) | 44 |
1 files changed, 22 insertions, 22 deletions
@@ -13,7 +13,7 @@ BOOTSTRAP="https://git.fluxo.info/puppet-bootstrap.git" TEMPLATES="https://git.fluxo.info/templates.git" # Read a parameter from user -function __project_ask { +function __templater_ask { local input local function="$1" local default="n" @@ -22,18 +22,18 @@ function __project_ask { read -rep "Setup $function? (defaults to $default): " input if [ "$input" == "y" ]; then - project_$function + templater_$function fi } # Return list of implementations -function __project_implementations { +function __templater_implementations { # Do not sort this list: the order in which functions are present in the code is important - grep "^function project_" $PROGRAM | cut -d ' ' -f 2 | sed -e 's/project_//' + grep "^function templater_" $PROGRAM | cut -d ' ' -f 2 | sed -e 's/templater_//' } # Checkout to develop branch if available -function __project_checkout_develop { +function __templater_checkout_develop { ( cd $PROJECT @@ -44,7 +44,7 @@ function __project_checkout_develop { } # Initialize project -function __project_init { +function __templater_init { if [ ! -d "$PROJECT" ]; then echo "Initializing $PROJECT..." mkdir -p $PROJECT @@ -52,7 +52,7 @@ function __project_init { } # Git implementation -function project_git { +function templater_git { if [ ! -d "$PROJECT/.git" ]; then ( cd $PROJECT @@ -82,7 +82,7 @@ function project_git { } # Setup git-flow implementation -function project_gitflow { +function templater_gitflow { if ! grep -q '^\[gitflow' $PROJECT/.git/config; then ( cd $PROJECT @@ -101,13 +101,13 @@ function project_gitflow { } # Vagrant implementation -function project_vagrant { +function templater_vagrant { if [ ! -e "$PROJECT/Vagrantfile" ]; then ( echo "" echo "Setting up vagrant implementation..." cd $PROJECT - #__project_checkout_develop + #__templater_checkout_develop vagrant init echo '.vagrant' >> .gitignore git commit -a -m "Adds vagrant support" @@ -116,7 +116,7 @@ function project_vagrant { } # KVMX implementation -function project_kvmx { +function templater_kvmx { if [ ! -e "$PROJECT/kvmxfile" ]; then ( echo "" @@ -129,7 +129,7 @@ function project_kvmx { } # Puppet implementation -function project_puppet { +function templater_puppet { if [ ! -d "$PROJECT/puppet" ]; then ( echo "" @@ -146,7 +146,7 @@ function project_puppet { } # Ikiwiki implementation -function project_ikiwiki { +function templater_ikiwiki { ( if [ ! -d "$HOME/file/templates" ]; then echo "Please clone $TEMPLATES into $HOME/file/templates" @@ -154,7 +154,7 @@ function project_ikiwiki { echo "" echo "Setting up ikiwiki implementation..." cd $PROJECT - #__project_checkout_develop + #__templater_checkout_develop if [ ! -e ".gitignore" ]; then cp $HOME/file/templates/ikiwiki/.gitignore . @@ -191,19 +191,19 @@ function project_ikiwiki { } # Sphinx implementation -function project_sphinx { +function templater_sphinx { echo "TODO: sphinx" true } # Pelican implementation -function project_pelican { +function templater_pelican { echo "TODO: pelican" true } # Hugo implementation -function project_hugo { +function templater_hugo { echo "TODO: hugo" true } @@ -215,22 +215,22 @@ if [ -z "$PROJECT" ]; then echo "usage: $BASENAME <path> [<module1> ... <moduleN>]" echo "available modules:" echo "" - __project_implementations | xargs -L 6 | column -t -c 6 | sed -e 's/^/\t/' + __templater_implementations | xargs -L 6 | column -t -c 6 | sed -e 's/^/\t/' echo "" exit 1 fi # Initialize -__project_init +__templater_init # Setup modules if [ ! -z "$MODULES" ]; then - for project in `__project_implementations`; do - __project_ask $project + for project in `__templater_implementations`; do + __templater_ask $project done else for module in $MODULES; do - project_$module + templater_$module done fi |