From ae70f66089fa910602931a84bca658581a9bb9e5 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Thu, 20 Jun 2019 15:10:42 +0400 Subject: [PATCH] =?UTF-8?q?synchro=20des=20d=C3=A9pendances=20uniquement?= =?UTF-8?q?=20pour=20le=20type=20composer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dk | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/dk b/dk index 2810d89..c3ba6cd 100755 --- a/dk +++ b/dk @@ -455,20 +455,35 @@ function build_update_apps() { [ -n "$branch" ] || { branch="${var}_BRANCH"; branch="${!branch}"; } [ -n "$branch" ] || branch="$DEFAULT_BRANCH" + # calculer le type maintenant, on en a besoin pour le mode devel + type="${var}_TYPE"; type="${!type}" + dest="$dest/$app" if [ -n "$BUILD_UPDATE_DEVEL" ]; then # synchronisation en mode devel local -a rsync_opts; rsync_opts=(-a --delete --exclude .git/ --delete-excluded) estep "Synchro $devel_srcdir --> $dest" rsync "${rsync_opts[@]}" "$devel_srcdir/" "$dest" || { eend; return 1; } - local -a depdirs; local depdir pname - setx -a depdirs=ls -d "$dest/vendor/"{lib,ur}/* 2>/dev/null - for depdir in "${depdirs[@]}"; do - [ -L "$depdir" ] && rm "$depdir" - pname="${depdir#$dest/vendor/}"; pname="${pname/\//-}" - estep "Synchro $DEFAULT_DEVEL_SRCDIR/$pname --> $depdir" - rsync "${rsync_opts[@]}" --exclude /vendor/ "$DEFAULT_DEVEL_SRCDIR/$pname/" "$depdir" - done + + if [ -z "$type" ]; then + # possible de détecter le type quand on a le projet + # en cas de maj ici, mettre à jour aussi le code ci-dessous + if [ -f "$dest/composer.json" ]; then type=composer + else type=inconnu + fi + fi + + if [ "$type" == composer ]; then + # Synchronisation des dépendances + local -a depdirs; local depdir pname + setx -a depdirs=ls -d "$dest/vendor/"{lib,ur}/* 2>/dev/null + for depdir in "${depdirs[@]}"; do + [ -L "$depdir" ] && rm "$depdir" + pname="${depdir#$dest/vendor/}"; pname="${pname/\//-}" + estep "Synchro $DEFAULT_DEVEL_SRCDIR/$pname --> $depdir" + rsync "${rsync_opts[@]}" --exclude /vendor/ "$DEFAULT_DEVEL_SRCDIR/$pname/" "$depdir" + done + fi else if [ -d "$dest" -a -d "$dest/.git" ]; then # mise à jour @@ -485,14 +500,13 @@ function build_update_apps() { estep "Clonage $url:$branch --> $dest" git clone -o "$origin" -b "$branch" "$url" "$dest" || { eend; return 1; } fi - fi - type="${var}_TYPE"; type="${!type}" - if [ -z "$type" ]; then - if [ -f "$dest/composer.json" ]; then - type=composer - else - type=inconnu + if [ -z "$type" ]; then + # possible de détecter le type quand on a le projet + # en cas de maj ici, mettre à jour aussi le code ci-dessus + if [ -f "$dest/composer.json" ]; then type=composer + else type=inconnu + fi fi fi