This commit is contained in:
Jephté Clain 2019-05-30 22:43:23 +04:00
parent a825f3b931
commit 99d5069b55
1 changed files with 17 additions and 11 deletions

28
dk
View File

@ -253,7 +253,10 @@ function update_apps_func_sqlmig() {
[ -n "$srcdir" ] || srcdir="$dest" [ -n "$srcdir" ] || srcdir="$dest"
[ "${srcdir%/config/sqlmig}" != "$srcdir" ] || srcdir="$srcdir/config/sqlmig" [ "${srcdir%/config/sqlmig}" != "$srcdir" ] || srcdir="$srcdir/config/sqlmig"
[ -d "$srcdir" ] || return 0 if [ ! -d "$srcdir" ]; then
eerror "$srcdir: répertoire introuvable"
return 1
fi
local -a sqlmigs; local sqlmig name local -a sqlmigs; local sqlmig name
array_lsall sqlmigs "$srcdir" array_lsall sqlmigs "$srcdir"
@ -293,25 +296,28 @@ function build_update_apps() {
esac esac
etitle "Mise à jour des dépendances" etitle "Mise à jour des dépendances"
local app type url dest branch after_update after_updates local app var type url dest branch after_update after_updates
for app in "${APPS[@]}"; do for app in "${APPS[@]}"; do
etitle "$app" etitle "$app"
url="${app}_URL"; url="${!url}"
var="${app//-/_}"
url="${var}_URL"; url="${!url}"
[ -n "$url" ] || { [ -n "$url" ] || {
ewarn "$app: vous devez définir l'url" ewarn "$app: vous devez définir l'url"
eend; return 1 eend; return 1
} }
dest="${app}_DEST"; dest="${!dest}" dest="${var}_DEST"; dest="${!dest}"
[ -n "$dest" ] || dest="$app/b" [ -n "$dest" ] || dest="$app/b"
mkdir -p "$dest" || { eend; return 1; } mkdir -p "$dest" || { eend; return 1; }
origin="${app}_${PROFILE}_ORIGIN"; origin="${!origin}" origin="${var}_${PROFILE}_ORIGIN"; origin="${!origin}"
[ -n "$origin" ] || { origin="${app}_ORIGIN"; origin="${!origin}"; } [ -n "$origin" ] || { origin="${var}_ORIGIN"; origin="${!origin}"; }
[ -n "$origin" ] || origin="$DEFAULT_ORIGIN" [ -n "$origin" ] || origin="$DEFAULT_ORIGIN"
branch="${app}_${PROFILE}_BRANCH"; branch="${!branch}" branch="${var}_${PROFILE}_BRANCH"; branch="${!branch}"
[ -n "$branch" ] || { branch="${app}_BRANCH"; branch="${!branch}"; } [ -n "$branch" ] || { branch="${var}_BRANCH"; branch="${!branch}"; }
[ -n "$branch" ] || branch="$DEFAULT_BRANCH" [ -n "$branch" ] || branch="$DEFAULT_BRANCH"
dest="$dest/$app" dest="$dest/$app"
@ -329,7 +335,7 @@ function build_update_apps() {
cd "$cwd" cd "$cwd"
fi fi
type="${app}_TYPE"; type="${!type}" type="${var}_TYPE"; type="${!type}"
if [ -z "$type" ]; then if [ -z "$type" ]; then
if [ -f "$dest/composer.json" ]; then if [ -f "$dest/composer.json" ]; then
type=composer type=composer
@ -338,9 +344,9 @@ function build_update_apps() {
fi fi
fi fi
after_updates="${app}_AFTER_UPDATE" after_updates="${var}_AFTER_UPDATE"
if is_defined "$after_updates"; then if is_defined "$after_updates"; then
after_updates="$after_updates[@]"; after_updates="${!after_updates}" after_updates="$after_updates[@]"; after_updates=("${!after_updates}")
elif [ "$type" == composer ]; then elif [ "$type" == composer ]; then
after_updates=(sqlmig) after_updates=(sqlmig)
else else