dk: support de COMPOSER_ACTION et sqlmig NOFIX
This commit is contained in:
parent
74cf35b47c
commit
5fe5137328
37
dk
37
dk
|
@ -182,10 +182,18 @@ VARIABLES de update-apps.conf
|
|||
- si le chemin est absolu ou relatif, lancer la commande telle quelle
|
||||
- s'il n'y a pas de chemin, alors ce doit être le nom d'une fonction
|
||||
existante auquel on enlève le préfixe update_apps_func_
|
||||
COMPOSER_ACTION
|
||||
vaut 'install' par défaut. Indique ce qu'il faut faire pour un projet de
|
||||
type 'composer' après avoir lancé les commandes de AFTER_UPDATE. Les
|
||||
directives supporées sont 'install', 'update' et 'none'
|
||||
|
||||
FONCTIONS de update-apps.conf
|
||||
sqlmig [DESTDIR [SRCDIR]]
|
||||
sqlmig [DESTDIR [SRCDIR [NOFIX]]]
|
||||
Copier les définitions des bases de données au format sqlmig de
|
||||
SRCDIR/config/sqlmig vers DESTDIR/config/mariadb/sqlmig"
|
||||
SRCDIR/config/sqlmig vers DESTDIR/config/mariadb/sqlmig
|
||||
Si SRCDIR ne se termine pas par '/config/sqlmig' ou si DESTDIR ne se
|
||||
termine pas par '/config/mariadb/sqlmig', rajouter ces suffixes
|
||||
automatiquement, sauf si une valeur NOFIX est spécifiée."
|
||||
}
|
||||
|
||||
function get_version() {
|
||||
|
@ -391,12 +399,14 @@ function build_set_options() {
|
|||
}
|
||||
|
||||
function update_apps_func_sqlmig() {
|
||||
local destdir="$1" srcdir="$2"
|
||||
local destdir="$1" srcdir="$2" nofix="$3"
|
||||
[ -n "$destdir" ] || destdir=db
|
||||
[ "${destdir%/config/mariadb/sqlmig}" != "$destdir" ] || destdir="$destdir/config/mariadb/sqlmig"
|
||||
|
||||
[ -n "$srcdir" ] || srcdir="$dest"
|
||||
|
||||
if [ -z "$nofix" ]; then
|
||||
[ "${destdir%/config/mariadb/sqlmig}" != "$destdir" ] || destdir="$destdir/config/mariadb/sqlmig"
|
||||
[ "${srcdir%/config/sqlmig}" != "$srcdir" ] || srcdir="$srcdir/config/sqlmig"
|
||||
fi
|
||||
|
||||
if [ ! -d "$srcdir" ]; then
|
||||
eerror "$srcdir: répertoire introuvable"
|
||||
|
@ -430,6 +440,7 @@ function build_update_apps() {
|
|||
[ -z "$DEFAULT_BRANCH" -a "$PROFILE" == prod ] && DEFAULT_BRANCH=develop #master
|
||||
[ -z "$DEFAULT_BRANCH" ] && DEFAULT_BRANCH=develop
|
||||
DEFAULT_DEVEL_SRCDIR="$HOME/wop/php"
|
||||
DEFAULT_COMPOSER_ACTION=install
|
||||
APPS=()
|
||||
[ -f update-apps.conf ] && source ./update-apps.conf
|
||||
[ ${#APPS[*]} -gt 0 ] || return 0
|
||||
|
@ -442,7 +453,7 @@ function build_update_apps() {
|
|||
esac
|
||||
|
||||
etitle "Mise à jour des dépendances"
|
||||
local app var type url devel_srcdir dest branch after_update after_updates
|
||||
local app var type url devel_srcdir dest branch after_update after_updates composer_action
|
||||
for app in "${APPS[@]}"; do
|
||||
etitle "$app"
|
||||
|
||||
|
@ -535,12 +546,24 @@ function build_update_apps() {
|
|||
|
||||
estep "Type de dépôt: $type"
|
||||
if [ "$type" == composer ]; then
|
||||
composer_action="${var}_${PROFILE}_COMPOSER_ACTION"; composer_action="${!composer_action}"
|
||||
[ -n "$composer_action" ] || { composer_action="${var}_COMPOSER_ACTION"; composer_action="${!composer_action}"; }
|
||||
[ -n "$composer_action" ] || composer_action="$DEFAULT_COMPOSER_ACTION"
|
||||
|
||||
composer=/usr/bin/composer
|
||||
[ -x "$dest/composer.phar" ] && composer="$dest/composer.phar"
|
||||
|
||||
if [ -z "$BUILD_UPDATE_DEVEL" ]; then
|
||||
case "${composer_action:-install}" in
|
||||
i|install) composer_action=install;;
|
||||
u|update) composer_action=update;;
|
||||
none|nop) composer_action=;;
|
||||
*) ewarn "$composer_action: action invalide"; composer_action=;;
|
||||
esac
|
||||
if [ -n "$composer_action" ]; then
|
||||
estep "Installation des dépendances composer"
|
||||
"$composer" -d"$dest" install ${PRODUCTION:+--no-dev -o} || { eend; return 1; }
|
||||
"$composer" -d"$dest" "$composer_action" ${PRODUCTION:+--no-dev -o} || { eend; return 1; }
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue