Skip to content

Commit

Permalink
Merge pull request #50 from spryker/bugfix/sc-1850/spaces-are-not-sup…
Browse files Browse the repository at this point in the history
…ported-in-project-path

SC-1850: Directory spaces is not supported
  • Loading branch information
alexanderM91 authored Nov 12, 2019
2 parents 19009fa + 2c736c8 commit 982b960
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bin/boot-deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ DEPLOYMENT_DIR=${DEPLOYMENT_DIR:-''}
# ------------------
function validateParameters()
{
[ -z ${PROJECT_NAME} ] && error "PROJECT_NAME is not set."
[ -z ${PROJECT_YAML} ] && error "PROJECT_YAML is not set."
[ -z ${SOURCE_DIR} ] && error "SOURCE_DIR is not set."
[ -z ${DEPLOYMENT_DIR} ] && error "DEPLOYMENT_DIR is not set."
[ -z "${PROJECT_NAME}" ] && error "PROJECT_NAME is not set."
[ -z "${PROJECT_YAML}" ] && error "PROJECT_YAML is not set."
[ -z "${SOURCE_DIR}" ] && error "SOURCE_DIR is not set."
[ -z "${DEPLOYMENT_DIR}" ] && error "DEPLOYMENT_DIR is not set."

[ ! -f ${PROJECT_YAML} ] && error "File \"${PROJECT_YAML}\" is not accessible."
[ ! -d ${SOURCE_DIR} ] && error "Directory \"${SOURCE_DIR}\" is not accessible."
[ ! -d ${DEPLOYMENT_DIR} ] && error "Directory \"${DEPLOYMENT_DIR}\" is not accessible."
[ ! -f "${PROJECT_YAML}" ] && error "File \"${PROJECT_YAML}\" is not accessible."
[ ! -d "${SOURCE_DIR}" ] && error "Directory \"${SOURCE_DIR}\" is not accessible."
[ ! -d "${DEPLOYMENT_DIR}" ] && error "Directory \"${DEPLOYMENT_DIR}\" is not accessible."

return ${__TRUE}
}
Expand All @@ -46,7 +46,7 @@ function bootDeployment()
cp -rf ${SOURCE_DIR}/bin ${DEPLOYMENT_DIR}/bin
cp -rf ${SOURCE_DIR}/context ${DEPLOYMENT_DIR}/context
cp -rf ${SOURCE_DIR}/images ${DEPLOYMENT_DIR}/images
cp ${PROJECT_YAML} ${DEPLOYMENT_DIR}/project.yml
cp "${PROJECT_YAML}" ${DEPLOYMENT_DIR}/project.yml

USER_UID=1000
USER_GID=1000
Expand Down
21 changes: 21 additions & 0 deletions bin/check-directories.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e

pushd ${BASH_SOURCE%/*} > /dev/null
. ./constants.sh
. ./console.sh
popd > /dev/null

function checkDirectories()
{
local projectDirectoryPath="${1:-$( pwd )}"

if [ "${projectDirectoryPath}" != "${projectDirectoryPath%[[:space:]]*}" ];
then
error "${WARN}The SDK does not support spaces in the path. Please, move your project accordingly.${NC}"
exit 1
fi
}

export -f checkDirectories
1 change: 1 addition & 0 deletions ci/check_boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ deployment/default/project.yml
deployment/default/bin/boot-deployment.sh
deployment/default/bin/check-docker.sh
deployment/default/bin/check-docker-compose.sh
deployment/default/bin/check-directories.sh
deployment/default/bin/console.sh
deployment/default/bin/constants.sh
deployment/default/bin/database
Expand Down
8 changes: 8 additions & 0 deletions sdk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e
pushd ${BASH_SOURCE%/*} > /dev/null
. bin/constants.sh
. bin/console.sh
. bin/check-directories.sh
popd > /dev/null

PROJECT_NAME=default
Expand All @@ -17,6 +18,11 @@ do
;;
p)
PROJECT_NAME=$OPTARG
if [ "${PROJECT_NAME}" != "${PROJECT_NAME%[[:space:]]*}" ];
then
error "${WARN}The project name cannot contain spaces.${NC}"
exit 1
fi
;;
esac
done
Expand All @@ -37,6 +43,8 @@ function showHelp()
echo -e " $0 bootstrap && $0 up"
}

checkDirectories

case $1 in
boot|bootstrap)
[ -f ${DEPLOY_SCRIPT} ] && SPRYKER_SELF_SCRIPT=$0 ${DEPLOY_SCRIPT} down > /dev/null 2>&1 && sleep 2 || true
Expand Down

0 comments on commit 982b960

Please sign in to comment.