TEMPLATES="https://git.fluxo.info/templates.git"
# Read a parameter from user
-function __project_ask {
+function __templater_ask {
local input
local function="$1"
local default="n"
read -rep "Setup $function? (defaults to $default): " input
if [ "$input" == "y" ]; then
- project_$function
+ templater_$function
fi
}
# Return list of implementations
-function __project_implementations {
+function __templater_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_//'
+ grep "^function templater_" $PROGRAM | cut -d ' ' -f 2 | sed -e 's/templater_//'
}
# Checkout to develop branch if available
-function __project_checkout_develop {
+function __templater_checkout_develop {
(
cd $PROJECT
}
# Initialize project
-function __project_init {
+function __templater_init {
if [ ! -d "$PROJECT" ]; then
echo "Initializing $PROJECT..."
mkdir -p $PROJECT
}
# Git implementation
-function project_git {
+function templater_git {
if [ ! -d "$PROJECT/.git" ]; then
(
cd $PROJECT
}
# Setup git-flow implementation
-function project_gitflow {
+function templater_gitflow {
if ! grep -q '^\[gitflow' $PROJECT/.git/config; then
(
cd $PROJECT
}
# Vagrant implementation
-function project_vagrant {
+function templater_vagrant {
if [ ! -e "$PROJECT/Vagrantfile" ]; then
(
echo ""
echo "Setting up vagrant implementation..."
cd $PROJECT
- #__project_checkout_develop
+ #__templater_checkout_develop
vagrant init
echo '.vagrant' >> .gitignore
git commit -a -m "Adds vagrant support"
}
# KVMX implementation
-function project_kvmx {
+function templater_kvmx {
if [ ! -e "$PROJECT/kvmxfile" ]; then
(
echo ""
}
# Puppet implementation
-function project_puppet {
+function templater_puppet {
if [ ! -d "$PROJECT/puppet" ]; then
(
echo ""
}
# Ikiwiki implementation
-function project_ikiwiki {
+function templater_ikiwiki {
(
if [ ! -d "$HOME/file/templates" ]; then
echo "Please clone $TEMPLATES into $HOME/file/templates"
echo ""
echo "Setting up ikiwiki implementation..."
cd $PROJECT
- #__project_checkout_develop
+ #__templater_checkout_develop
if [ ! -e ".gitignore" ]; then
cp $HOME/file/templates/ikiwiki/.gitignore .
}
# Sphinx implementation
-function project_sphinx {
+function templater_sphinx {
echo "TODO: sphinx"
true
}
# Pelican implementation
-function project_pelican {
+function templater_pelican {
echo "TODO: pelican"
true
}
# Hugo implementation
-function project_hugo {
+function templater_hugo {
echo "TODO: hugo"
true
}
echo "usage: $BASENAME <path> [<module1> ... <moduleN>]"
echo "available modules:"
echo ""
- __project_implementations | xargs -L 6 | column -t -c 6 | sed -e 's/^/\t/'
+ __templater_implementations | xargs -L 6 | column -t -c 6 | sed -e 's/^/\t/'
echo ""
exit 1
fi
# Initialize
-__project_init
+__templater_init
# Setup modules
if [ ! -z "$MODULES" ]; then
- for project in `__project_implementations`; do
- __project_ask $project
+ for project in `__templater_implementations`; do
+ __templater_ask $project
done
else
for module in $MODULES; do
- project_$module
+ templater_$module
done
fi