Browse Source

fix: support running in directory having name containing uppercase

The direct parent could be used to make the default project name,
and uppercase are not supported for container names.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
cache-relation
Valentin Lab 5 years ago
parent
commit
cb3c784c66
  1. 12
      bin/compose-core

12
bin/compose-core

@ -3045,15 +3045,19 @@ export -f _save
get_default_project_name() { get_default_project_name() {
if [ "$DEFAULT_PROJECT_NAME" ]; then
local normalized_path compose_yml_location name
if [ -n "$DEFAULT_PROJECT_NAME" ]; then
echo "$DEFAULT_PROJECT_NAME" echo "$DEFAULT_PROJECT_NAME"
return 0 return 0
fi fi
compose_yml_location="$(get_compose_yml_location)" || return 1 compose_yml_location="$(get_compose_yml_location)" || return 1
if [ "$compose_yml_location" ]; then
if [ -n "$compose_yml_location" ]; then
if normalized_path=$(readlink -f "$compose_yml_location"); then if normalized_path=$(readlink -f "$compose_yml_location"); then
name="$(basename "$(dirname "$normalized_path")")"
echo "${name%%-deploy}"
name="${normalized_path%/*}" ## dirname
name="${name##*/}" ## basename
name="${name%%-deploy}" ## remove any '-deploy'
name="${name,,}" ## lowercase
e "$name"
return 0 return 0
fi fi
fi fi

Loading…
Cancel
Save