aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-10-25 19:03:14 -0200
committerSilvio Rhatto <rhatto@riseup.net>2017-10-25 19:03:14 -0200
commit1fea0eaa3613c904a6ac61da5e79137e73633fc5 (patch)
tree492e0500cc898a149089f2b60d8a6486a956a599 /project
parentbb9f5038bc7b6e622b2bf17ed0a6b8ceb5f11aee (diff)
downloadscripts-1fea0eaa3613c904a6ac61da5e79137e73633fc5.tar.gz
scripts-1fea0eaa3613c904a6ac61da5e79137e73633fc5.tar.bz2
More project enhancements
Diffstat (limited to 'project')
-rwxr-xr-xproject125
1 files changed, 73 insertions, 52 deletions
diff --git a/project b/project
index 3b4bb91..1d596c2 100755
--- a/project
+++ b/project
@@ -26,6 +26,12 @@ function __project_ask {
fi
}
+# Return list of implementations
+function __project_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_//'
+}
+
# Checkout to develop branch if available
function __project_checkout_develop {
(
@@ -45,7 +51,7 @@ function __project_init {
fi
}
-# Git integration
+# Git implementation
function project_git {
if [ ! -d "$PROJECT/.git" ]; then
(
@@ -75,7 +81,7 @@ function project_git {
fi
}
-# Setup git-flow integration
+# Setup git-flow implementation
function project_gitflow {
if ! grep -q '^\[gitflow' $PROJECT/.git/config; then
(
@@ -94,16 +100,61 @@ function project_gitflow {
fi
}
-# Ikiwiki integration
+# Vagrant implementation
+function project_vagrant {
+ if [ ! -e "$PROJECT/Vagrantfile" ]; then
+ (
+ echo ""
+ echo "Setting up vagrant implementation..."
+ cd $PROJECT
+ #__project_checkout_develop
+ vagrant init
+ echo '.vagrant' >> .gitignore
+ git commit -a -m "Adds vagrant support"
+ )
+ fi
+}
+
+# KVMX implementation
+function project_kvmx {
+ if [ ! -e "$PROJECT/kvmxfile" ]; then
+ (
+ echo ""
+ echo "Setting up vagrant implementation..."
+ cd $PROJECT
+ kvmx init
+ git commit -a -m "Adds kvmx support"
+ )
+ fi
+}
+
+# Puppet implementation
+function project_puppet {
+ if [ ! -d "$PROJECT/puppet" ]; then
+ (
+ echo ""
+ echo "Setting up puppet implementation..."
+ cd $PROJECT
+
+ # Use the best approach
+ #git clone $BOOSTRAP $PROJECT/puppet
+ #git submodule add $BOOSTRAP puppet
+ git remote add puppet $BOOTSTRAP
+ git subtree add --prefix puppet $BOOTSTRAP master --squash
+ )
+ fi
+}
+
+# Ikiwiki implementation
function project_ikiwiki {
(
if [ ! -d "$HOME/file/templates" ]; then
echo "Please clone $TEMPLATES into $HOME/file/templates"
else
echo ""
- echo "Setting up ikiwiki integration..."
+ echo "Setting up ikiwiki implementation..."
cd $PROJECT
- __project_checkout_develop
+ #__project_checkout_develop
if [ ! -e ".gitignore" ]; then
cp $HOME/file/templates/ikiwiki/.gitignore .
@@ -139,59 +190,32 @@ function project_ikiwiki {
)
}
-# Vagrant integration
-function project_vagrant {
- if [ ! -e "$PROJECT/Vagrantfile" ]; then
- (
- echo ""
- echo "Setting up vagrant integration..."
- cd $PROJECT
- __project_checkout_develop
- vagrant init
- echo '.vagrant' >> .gitignore
- git commit -a -m "Adds vagrant support"
- )
- fi
+# Sphinx implementation
+function project_sphinx {
+ echo "TODO: sphinx"
+ true
}
-# KVMX integration
-function project_kvmx {
- if [ ! -e "$PROJECT/kvmxfile" ]; then
- (
- echo ""
- echo "Setting up vagrant integration..."
- cd $PROJECT
- kvmx init
- git commit -a -m "Adds kvmx support"
- )
- fi
+# Pelican implementation
+function project_pelican {
+ echo "TODO: pelican"
+ true
}
-# Puppet integration
-function project_puppet {
- if [ ! -d "$PROJECT/puppet" ]; then
- (
- echo ""
- echo "Setting up puppet integration..."
- cd $PROJECT
-
- # Use the best approach
- #git clone $BOOSTRAP $PROJECT/puppet
- #git submodule add $BOOSTRAP puppet
- git remote add puppet $BOOTSTRAP
- git subtree add --prefix puppet $BOOTSTRAP master --squash
- )
- fi
+# Hugo implementation
+function project_hugo {
+ echo "TODO: hugo"
+ true
}
# Syntax check
if [ -z "$PROJECT" ]; then
- echo "$BASENAME: create a new project folder and setup helper utilities"
+ echo "$BASENAME: create a new project folder and/or setup helper utilities"
echo ""
echo "usage: $BASENAME <path> [<module1> ... <moduleN>]"
echo "available modules:"
echo ""
- grep "^function project_" $PROGRAM | cut -d ' ' -f 2 | sed -e 's/project_//' | sort | xargs -L 6 | column -t -c 6 | sed -e 's/^/\t/'
+ __project_implementations | xargs -L 6 | column -t -c 6 | sed -e 's/^/\t/'
echo ""
exit 1
fi
@@ -201,12 +225,9 @@ __project_init
# Setup modules
if [ ! -z "$MODULES" ]; then
- __project_ask git
- __project_ask gitflow
- __project_ask ikiwiki
- __project_ask kvmx
- __project_ask puppet
- __project_ask vagrant
+ for project in `__project_implementations`; do
+ __project_ask $project
+ done
else
for module in $MODULES; do
project_$module