diff --git a/start.sh b/start.sh index 63f0bdb975ed9d9a294f559421ef7e08ec2d8523..45e34a55dd1d5215ae529a059ee46f41211f6e6e 100755 --- a/start.sh +++ b/start.sh @@ -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