General refactoring

This commit is contained in:
2020-05-30 16:00:49 +02:00
parent 1e3f6f05ec
commit 07cf718ad9
17 changed files with 162 additions and 145 deletions
+6 -7
View File
@@ -1,14 +1,15 @@
#!/usr/bin/env bash
########################################################################
# 2014-09-07 Lukas Bestle mail@lukasbestle.com
# Copyright 2014 Lukas Bestle <project-projectr@lukasbestle.com>
# License MIT
########################################################################
# Creates a project directory, bootstraps it with a basic directory
# structure and optionally prepares it for deployments.
#
# Usage: project_add <project> [<origin>]
#
# <project> Path to the project
# <origin> Repository URL and branch name (<url>[#<branch>])
# <project> Path to the project
# <origin> Repository URL and branch name (<url>[#<branch>])
########################################################################
project="$1"
@@ -29,7 +30,7 @@ fi
# Create project directory
echo -e "\033[1mCreating project at \033[34m$project\033[0;1m...\033[0m"
if ! (mkdir "$project" && mkdir "$project/data" && touch "$project/.project"); then
echo -e "\033[31mCould not create directory structure at \033[34m$project\033[31m.\033[0m" >&2
echo -e " => \033[31mCould not create directory structure at \033[34m$project\033[31m.\033[0m" >&2
exit 1
fi
echo -e " => \033[32mSuccess.\033[0m"
@@ -49,10 +50,8 @@ if [[ -n "$origin" ]]; then
else
echo -e "\033[1mInitializing local project directory at \033[34m$project/current\033[0;1m...\033[0m"
if ! mkdir "$project/current"; then
echo -e "\033[31mCould not create local project directory.\033[0m" >&2
echo -e " => \033[31mCould not create local project directory.\033[0m" >&2
exit 1
fi
echo -e " => \033[32mSuccess.\033[0m"
exit 0
fi