aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-06-20 11:13:55 -0300
committerSilvio Rhatto <rhatto@riseup.net>2015-06-20 11:13:55 -0300
commit45fe4831619a08b09e2fe647fe017dc5af33ae53 (patch)
tree3ae05a86070792c7f53c3723e82470a7abee245c
parent871025a85a331245e12e151364716a1119f241a0 (diff)
downloadscripts-45fe4831619a08b09e2fe647fe017dc5af33ae53.tar.gz
scripts-45fe4831619a08b09e2fe647fe017dc5af33ae53.tar.bz2
Sandbox: ikiwiki: copy .gitignore only if needed
-rw-r--r--TODO.md1
-rwxr-xr-xsandbox13
2 files changed, 10 insertions, 4 deletions
diff --git a/TODO.md b/TODO.md
index b106e26..dd245e4 100644
--- a/TODO.md
+++ b/TODO.md
@@ -2,6 +2,7 @@ TODO
====
* Better sandbox template
+ * Should work for more use cases.
* Should be indepotent.
* Asking whether to setup:
* Vagrant.
diff --git a/sandbox b/sandbox
index 7eda329..88f8fca 100755
--- a/sandbox
+++ b/sandbox
@@ -2,7 +2,6 @@
#
# Setup a new code project.
#
-# TODO: should work for more use cases.
# Parameters
BASENAME="`basename $0`"
@@ -12,11 +11,13 @@ REPO="$2"
BOOTSTRAP="git://git.sarava.org/puppet-bootstrap.git"
TEMPLATES="git://git.sarava.org/templates.git"
+# Initialize project
function sandbox_init {
echo "Initializing $PROJECT..."
mkdir -p $CODE/$PROJECT
}
+# Git integration
function sandbox_git {
(
cd $CODE/$PROJECT
@@ -52,8 +53,8 @@ function sandbox_git {
)
}
-function sandbox_ikiwiki {
# Ikiwiki integration
+function sandbox_ikiwiki {
(
if [ ! -d "$HOME/file/templates" ]; then
echo "Please clone $TEMPLATES into $HOME/file/templates"
@@ -63,7 +64,11 @@ function sandbox_ikiwiki {
cd $CODE/$PROJECT
git checkout develop
- cat $HOME/file/templates/ikiwiki/.gitignore >> .gitignore
+ if [ ! -e ".gitignore" ]; then
+ cp $HOME/file/templates/ikiwiki/.gitignore .
+ elif ! grep -q -f $HOME/file/templates/ikiwiki/.gitignore; then
+ cat $HOME/file/templates/ikiwiki/.gitignore >> .gitignore
+ fi
if [ ! -e "index.mdwn" ]; then
cp $HOME/file/templates/ikiwiki/index.mdwn .
@@ -89,8 +94,8 @@ function sandbox_ikiwiki {
)
}
+# Vagrant integration
function sandbox_vagrant {
- # Vagrant integration
(
echo ""
echo "Setting up vagrant integration..."