forked from webdevops/php-docker-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-project.sh
executable file
·45 lines (36 loc) · 1.28 KB
/
create-project.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -o pipefail # trace ERR through pipes
set -o errtrace # trace ERR through 'time command' and other functions
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.config.sh"
if [ "$#" -lt 1 ]; then
echo "No project type defined (either cms, neos, symfony or git)"
exit 1
fi
#if app dir exists then backup it with timestamp
[ ! -d "$CODE_DIR" ] || mv "$CODE_DIR" "$CODE_DIR".$(date +%Y%m%d%H%M%S);
mkdir -p -- "$CODE_DIR/"
chmod 777 "$CODE_DIR/"
rm -f -- "$CODE_DIR/.gitkeep"
case "$1" in
###################################
## SYMFONY
###################################
"symfony")
curl -LsS http://symfony.com/installer > /tmp/symfony.$$.phar
execInDir "$CODE_DIR" "php /tmp/symfony.$$.phar new '$CODE_DIR'"
rm -f -- /tmp/symfony.$$.phar
;;
###################################
## GIT
###################################
"git")
if [ "$#" -lt 2 ]; then
echo "Missing git url"
exit 1
fi
git clone --recursive "$2" "$CODE_DIR"
;;
esac
touch -- "$CODE_DIR/.gitkeep"