diff options
-rwxr-xr-x | templater | 84 |
1 files changed, 67 insertions, 17 deletions
@@ -52,6 +52,22 @@ function __templater_checkout_develop { ) } +# Copy or append source file into destination +function __templater_copy_or_append { + local implementation="$1" + local file="$2" + + if [ -z "$file" ]; then + return + fi + + if [ ! -e "$file" ]; then + cp $DIRNAME/share/$implementation/$file . + elif ! grep -q -f $DIRNAME/share/$implmenentation/$file $file; then + cat $DIRNAME/share/$implementation/$file >> $file + fi +} + # Git implementation function templater_git { if [ ! -d "$PROJECT/.git" ]; then @@ -113,7 +129,7 @@ function templater_vagrant { if [ ! -e "$PROJECT/Vagrantfile" ]; then ( echo "" - echo "Setting up vagrant implementation..." + echo "Setting up vagrant..." cd $PROJECT &> /dev/null #__templater_checkout_develop vagrant init @@ -128,7 +144,7 @@ function templater_kvmx { if [ ! -e "$PROJECT/kvmxfile" ]; then ( echo "" - echo "Setting up vagrant implementation..." + echo "Setting up vagrant..." cd $PROJECT &> /dev/null kvmx init git commit -a -m "Adds kvmx support" @@ -141,7 +157,7 @@ function templater_puppet { if [ ! -d "$PROJECT/puppet" ]; then ( echo "" - echo "Setting up puppet implementation..." + echo "Setting up puppet..." cd $PROJECT &> /dev/null # Use the best approach @@ -155,24 +171,22 @@ function templater_puppet { # Ikiwiki implementation function templater_ikiwiki { + if [ ! -e "$PROJECT/ikiwiki.yaml" ]; then ( echo "" - echo "Setting up ikiwiki implementation..." + echo "Setting up ikiwiki..." cd $PROJECT &> /dev/null - #__templater_checkout_develop - if [ ! -e ".gitignore" ]; then - cp $DIRNAME/share/ikiwiki/.gitignore . - elif ! grep -q -f $DIRNAME/share/ikiwiki/.gitignore .gitignore; then - cat $DIRNAME/share/ikiwiki/.gitignore >> .gitignore - fi + #__templater_checkout_develop + __templater_copy_or_append ikiwiki .gitignore - if [ ! -e "index.mdwn" ]; then - cp $DIRNAME/share/ikiwiki/index.mdwn . - fi + #if [ ! -e "index.md" ]; then + # cp $DIRNAME/share/ikiwiki/index.md . + #fi + cp $DIRNAME/share/ikiwiki/index.md . - if [ ! -e "ikiwiki.setup" ]; then - cp $DIRNAME/share/ikiwiki/ikiwiki.setup . + if [ ! -e "ikiwiki.yaml" ]; then + cp $DIRNAME/share/ikiwiki/ikiwiki.yaml. fi if [ ! -e "Makefile" ]; then @@ -194,12 +208,36 @@ function templater_ikiwiki { #git commit -a -m "Static site generation support using ikiwiki" fi ) + fi } # Sphinx implementation function templater_sphinx { - echo "TODO: sphinx" - true + if [ ! -e "$PROJECT/conf.py" ]; then + ( + echo "" + echo "Setting up sphinx..." + cd $PROJECT &> /dev/null + + #__templater_checkout_develop + __templater_copy_or_append sphinx .gitignore + + if [ ! -e "Makefile" ]; then + cp $DIRNAME/share/sphinx/Makefile . + elif ! grep -q sphinx Makefile; then + grep -v '^#' $DIRNAME/share/sphinx/Makefile >> Makefile + fi + + if [ ! -d "_static" ]; then + cp -r $DIRNAME/share/sphinx/_static . + fi + + if [ ! -d "_themes" ]; then + mkdir _themes + git submodule add https://github.com/snide/sphinx_rtd_theme _themes/sphinx_rtd_theme + fi + ) + fi } # Pelican implementation @@ -220,6 +258,18 @@ function templater_jekyll { true } +# Drupal7 implementation +function templater_drupal7 { + echo "TODO: drupal7" + true +} + +# Drupal8 implementation +function templater_drupal8 { + echo "TODO: drupal8" + true +} + # Syntax check if [ -z "$PROJECT" ]; then echo "$BASENAME: create a new project folder and/or setup helper utilities" |