Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LakeDropsDrupalDev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Docker
LakeDropsDrupalDev
Commits
e552a6f1
Commit
e552a6f1
authored
5 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
customer/bison/core#14 Make variable checks more explicit and cleanup code
parent
08671cf6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
start.sh
+16
-7
16 additions, 7 deletions
start.sh
with
16 additions
and
7 deletions
start.sh
+
16
−
7
View file @
e552a6f1
...
...
@@ -2,6 +2,8 @@
function
readEnv
{
if
[[
-f
".env"
]]
;
then
# shellcheck disable=SC2046
# shellcheck disable=SC2002
export
$(
cat
.env | xargs
)
>
/dev/null 2>&1
fi
}
...
...
@@ -19,6 +21,9 @@ function restoreEnvFile {
echo
"COMPOSE_PROJECT_NAME=
${
COMPOSE_PROJECT_NAME
}
"
>>
.env
fi
if
[[
-f
".env"
]]
;
then
# shellcheck disable=SC2046
# shellcheck disable=SC2094
# shellcheck disable=SC2002
env
-i
$(
cat
.env | xargs
)
>
.env
fi
}
...
...
@@ -29,9 +34,9 @@ function create {
fi
truncateCurrentDirectory
if
[[
-n
${
REPOSITORY
}
]]
;
then
composer create-project
${
PROJECT
}
.
--no-interaction
--repository
${
REPOSITORY
}
composer create-project
"
${
PROJECT
}
"
.
--no-interaction
--repository
"
${
REPOSITORY
}
"
else
composer create-project
${
PROJECT
}
.
--no-interaction
composer create-project
"
${
PROJECT
}
"
.
--no-interaction
fi
restoreEnvFile
...
...
@@ -51,26 +56,26 @@ function create {
fi
# Dump database
if
[[
-n
${
L3D_DUMP_DB
}
]]
;
then
if
[[
$
L3D_DUMP_DB
-eq
1
]]
;
then
git ignore
"/*.sql"
drush sql:dump
--result-file
../db.sql
fi
# Cleanup
if
[[
-n
${
L3D_CLEANUP
}
]]
;
then
if
[[
$
L3D_CLEANUP
-eq
1
]]
;
then
docker-compose stop
docker-compose
rm
--force
fi
fi
fi
if
[[
-n
${
L3D_EXIT
}
]]
;
then
if
[[
$
L3D_EXIT
-eq
1
]]
;
then
exit
fi
}
function
clone
{
truncateCurrentDirectory
git clone
${
REPOSITORY
}
.
git clone
"
${
REPOSITORY
}
"
.
composer update
restoreEnvFile
}
...
...
@@ -88,6 +93,7 @@ function initialSetup {
echo
""
while
true
;
do
# shellcheck disable=SC2162
read
-p
"Choose an option: "
OPTION
case
${
OPTION
}
in
0
)
...
...
@@ -108,13 +114,16 @@ function initialSetup {
;;
3
)
# shellcheck disable=SC2162
read
-p
"Custom project template: "
PROJECT
# shellcheck disable=SC2162
read
-p
"Repository URL (optional): "
REPOSITORY
create
break
;;
4
)
# shellcheck disable=SC2162
read
-p
"Repository URL: "
REPOSITORY
if
[[
-n
"
${
REPOSITORY
}
"
]]
;
then
clone
...
...
@@ -131,7 +140,7 @@ function initialSetup {
readEnv
EXISTING
=
$(
ls
-1
)
if
[[
!
-n
"
$EXISTING
"
]]
;
then
if
[[
-z
"
$EXISTING
"
]]
;
then
if
[[
-n
${
PROJECT
}
]]
;
then
create
elif
[[
-n
${
REPOSITORY
}
]]
;
then
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment