Newer
Older

jurgenhaas
committed
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
function truncateCurrentDirectory {
if [[ -f ".env" ]]; then
export $(cat .env | xargs) > /dev/null 2>&1
fi
rm .* > /dev/null 2>&1
}
function restoreEnvFile {
if [[ -n ${PHP_VERSION} ]]; then
echo "PHP_VERSION=${PHP_VERSION}" >>.env
fi
if [[ -n ${COMPOSE_PROJECT_NAME} ]]; then
echo "COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}" >>.env
fi
if [[ -f ".env" ]]; then
env -i $(cat .env | xargs) >.env
fi
}
function create {
truncateCurrentDirectory
composer create-project ${PROJECT} . --no-interaction
restoreEnvFile
}
EXISTING=$(ls -1)
if [[ ! -n "$EXISTING" ]]; then
echo "Lets start a new project here ..."
echo ""
echo "Options to start:"
echo " 1 LakeDrops Drupal 8 project template"
echo " 2 Drupal's community project template"
echo " 3 Existing git repository"
echo ""
echo ""
while true; do
read -p "Choose an option: " OPTION
case ${OPTION} in
1 )
PROJECT="lakedrops/d8-project"
create
break
;;
2 )
PROJECT="drupal-composer/drupal-project:8.x-dev"
create
break
;;
3 )
read -p "Repository URL: " REPOSITORY
if [[ -n "${REPOSITORY}" ]]; then
truncateCurrentDirectory
git clone ${REPOSITORY} .
composer update
restoreEnvFile
break
fi
;;
* )
echo "Please try again."
;;
esac
done
fi
restoreEnvFile
/usr/bin/fish