diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2015-06-20 11:09:11 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2015-06-20 11:09:11 -0300 |
commit | 871025a85a331245e12e151364716a1119f241a0 (patch) | |
tree | 7df1f4bc4a9400c2c7996d52288894bcd4626417 /sandbox | |
parent | a29a044d6d6eed23350599e8eeeea53ae11302d5 (diff) | |
download | scripts-871025a85a331245e12e151364716a1119f241a0.tar.gz scripts-871025a85a331245e12e151364716a1119f241a0.tar.bz2 |
Sandbox: be functional
Diffstat (limited to 'sandbox')
-rwxr-xr-x | sandbox | 119 |
1 files changed, 66 insertions, 53 deletions
@@ -12,19 +12,12 @@ REPO="$2" BOOTSTRAP="git://git.sarava.org/puppet-bootstrap.git" TEMPLATES="git://git.sarava.org/templates.git" -# Syntax check -if [ -z "$PROJECT" ]; then - echo "usage: $BASENAME <path> [url]" - exit 1 -fi - -# Clone or initialize -if [ ! -z "$REPO" ]; then - git clone $URL $CODE/$PROJECT -else +function sandbox_init { echo "Initializing $PROJECT..." mkdir -p $CODE/$PROJECT +} +function sandbox_git { ( cd $CODE/$PROJECT touch .gitignore @@ -57,58 +50,78 @@ else git flow init -d fi ) -fi +} +function sandbox_ikiwiki { # Ikiwiki integration -( - if [ ! -d "$HOME/file/templates" ]; then - echo "Please clone $TEMPLATES into $HOME/file/templates" - else - echo "" - echo "Setting up ikiwiki integration..." - cd $CODE/$PROJECT - git checkout develop + ( + if [ ! -d "$HOME/file/templates" ]; then + echo "Please clone $TEMPLATES into $HOME/file/templates" + else + echo "" + echo "Setting up ikiwiki integration..." + cd $CODE/$PROJECT + git checkout develop - cat $HOME/file/templates/ikiwiki/.gitignore >> .gitignore + cat $HOME/file/templates/ikiwiki/.gitignore >> .gitignore - if [ ! -e "index.mdwn" ]; then - cp $HOME/file/templates/ikiwiki/index.mdwn . - fi + if [ ! -e "index.mdwn" ]; then + cp $HOME/file/templates/ikiwiki/index.mdwn . + fi - if [ ! -e "Makefile" ]; then - cp $HOME/file/templates/ikiwiki/Makefile . - elif ! grep -q ^wiki: Makefile; then - grep -v '^#' $HOME/file/templates/ikiwiki/Makefile >> Makefile - fi + if [ ! -e "Makefile" ]; then + cp $HOME/file/templates/ikiwiki/Makefile . + elif ! grep -q ^wiki: Makefile; then + grep -v '^#' $HOME/file/templates/ikiwiki/Makefile >> Makefile + fi - if [ ! -d "templates" ]; then - cp r $HOME/file/templates/ikiwiki/templates . - fi + if [ ! -d "templates" ]; then + cp r $HOME/file/templates/ikiwiki/templates . + fi + + if [ ! -d "bootstrap" ]; then + cp r $HOME/file/bootstrap/ikiwiki/bootstrap . + fi - if [ ! -d "bootstrap" ]; then - cp r $HOME/file/bootstrap/ikiwiki/bootstrap . + git add . + git commit -a -m "Static site generation support using ikiwiki" fi + ) +} - git add . - git commit -a -m "Static site generation support using ikiwiki" - fi -) - -# Vagrant integration -( - echo "" - echo "Setting up vagrant integration..." - cd $CODE/$PROJECT - git checkout develop - echo '.vagrant' >> .gitignore - git commit -a -m "Adds vagrant support" - - # Use the best approach - #git clone $BOOSTRAP $CODE/$PROJECT/puppet - #git submodule add $BOOSTRAP puppet - git remote add puppet $BOOTSTRAP - git subtree add --prefix puppet $BOOTSTRAP master --squash -) +function sandbox_vagrant { + # Vagrant integration + ( + echo "" + echo "Setting up vagrant integration..." + cd $CODE/$PROJECT + git checkout develop + echo '.vagrant' >> .gitignore + git commit -a -m "Adds vagrant support" + + # Use the best approach + #git clone $BOOSTRAP $CODE/$PROJECT/puppet + #git submodule add $BOOSTRAP puppet + git remote add puppet $BOOTSTRAP + git subtree add --prefix puppet $BOOTSTRAP master --squash + ) +} + +# Syntax check +if [ -z "$PROJECT" ]; then + echo "usage: $BASENAME <path> [url]" + exit 1 +fi + +# Clone or initialize +if [ ! -z "$REPO" ]; then + git clone $URL $CODE/$PROJECT +else + sandbox_init + sandbox_git + sandbox_ikiwiki + sandbox_vagrant +fi # Teardown echo "Welcome to your new project :)" |