aboutsummaryrefslogtreecommitdiff
path: root/sandbox
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-06-20 11:09:11 -0300
committerSilvio Rhatto <rhatto@riseup.net>2015-06-20 11:09:11 -0300
commit871025a85a331245e12e151364716a1119f241a0 (patch)
tree7df1f4bc4a9400c2c7996d52288894bcd4626417 /sandbox
parenta29a044d6d6eed23350599e8eeeea53ae11302d5 (diff)
downloadscripts-871025a85a331245e12e151364716a1119f241a0.tar.gz
scripts-871025a85a331245e12e151364716a1119f241a0.tar.bz2
Sandbox: be functional
Diffstat (limited to 'sandbox')
-rwxr-xr-xsandbox119
1 files changed, 66 insertions, 53 deletions
diff --git a/sandbox b/sandbox
index 0ad80e7..7eda329 100755
--- a/sandbox
+++ b/sandbox
@@ -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 :)"