diff --git a/bin/runphp b/bin/runphp index a938ba3..81a4f81 100755 --- a/bin/runphp +++ b/bin/runphp @@ -22,7 +22,7 @@ done if [ -z "$PROJDIR" ]; then # s'il n'y a pas de projet, --bs est l'action par défaut - [ $# -gt 0 ] || set -- --bs + [ $# -gt 0 ] || set -- --bs --ue elif [ "$MYNAME" == composer ]; then set -- composer "$@" else diff --git a/runphp/runphp b/runphp/runphp index 815aa8c..6980f2b 100755 --- a/runphp/runphp +++ b/runphp/runphp @@ -183,7 +183,10 @@ elif [ "$1" == --runphp-exec ]; then Bootstrap= shift elif [ "$1" == --runphp-install -o "$1" == --ci ]; then - ComposerInstall=1 + ComposerInstall=ci + shift +elif [ "$1" == --runphp-update -o "$1" == --cu ]; then + ComposerInstall=cu shift fi @@ -200,7 +203,7 @@ if [ -z "$Bootstrap" -a -z "$RUNPHP_STANDALONE" ]; then if [ -n "$ForcedBootstrap" ]; then [ "$RUNPHP_MODE" != docker ] && eecho "== bootstrapping runphp" Bootstrap=1 - ComposerInstall=1 + ComposerInstall=ci fi fi @@ -298,7 +301,10 @@ if [ "$RUNPHP_MODE" != docker ]; then after_source_buildenv fi ensure_image - check_image || Bootstrap=1 + if ! check_image; then + ForcedBootstrap=1 + Bootstrap=1 + fi fi Chdir= @@ -342,7 +348,7 @@ if [ "$RUNPHP_MODE" != docker ]; then runphp: construire l'image docker USAGE - $MYNAME --bootstrap [options...] + $MYNAME --runphp-bootstrap [options...] OPTIONS -c, --config build.env @@ -369,7 +375,8 @@ OPTIONS -z|--timezone) shift; TIMEZONE="$1";; -r|--privareg) shift; PRIVAREG="$1";; -p|--push) Push=1;; - --ci) ComposerInstall=1;; + --ci) ComposerInstall=ci;; + --cu) ComposerInstall=cu;; --no-use-rslave) UseRslave=;; *) die "$1: option non configurée";; esac @@ -420,23 +427,31 @@ OPTIONS fi if [ -z "$RUNPHP_STANDALONE" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then # Forcer l'installation des dépendances si nécessaire - ComposerInstall=1 + [ -n "$ComposerInstall" ] || ComposerInstall=ci fi - [ -z "$ComposerInstall" -o -n "$UnlessExists" ] && exit 0 - else - ## Mode exécution de commande ########################################## - # Ici, on a déterminé qu'il faut lancer une commande + if [ -n "$ForcedBootstrap" ]; then + # si le bootstrap est forcé, ne continuer que s'il y a des arguments + [ $# -eq 0 ] && exit 0 + else + # si le bootstrap a été demandé, ne continuer que s'il faut + # installer les dépendances + [ -z "$ComposerInstall" ] && exit 0 + fi + fi - SOPTS=+w: - LOPTS=help,chdir:,no-use-rslave - args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args" + ## Mode exécution de commande ########################################## + # Ici, on a déterminé qu'il faut lancer une commande - while [ $# -gt 0 ]; do - case "$1" in - --) shift; break;; - --help) - eecho "\ + SOPTS=+w: + LOPTS=help,chdir:,no-use-rslave + args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args" + + while [ $# -gt 0 ]; do + case "$1" in + --) shift; break;; + --help) + eecho "\ runphp: lancer une commande dans un environnement PHP déterminé USAGE @@ -456,19 +471,18 @@ courant est forcé au répertoire du projet composer OPTIONS -w, --chdir CHDIR aller dans le répertoire spécifié avant de lancer la commande" - exit 0 - ;; - -w|--chdir) shift; Chdir="$1";; - --no-use-rslave) UseRslave=;; - *) die "$1: option non configurée";; - esac - shift - done + exit 0 + ;; + -w|--chdir) shift; Chdir="$1";; + --no-use-rslave) UseRslave=;; + *) die "$1: option non configurée";; + esac + shift + done - if [ -z "$RUNPHP_STANDALONE" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then - # Forcer l'installation des dépendances si nécessaire - ComposerInstall=1 - fi + if [ -z "$RUNPHP_STANDALONE" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then + # Forcer l'installation des dépendances si nécessaire + ComposerInstall=ci fi ## Lancer la commande @@ -529,7 +543,7 @@ OPTIONS "$Image" exec "$0" ${Chdir:+-w "$Chdir"} ) - [ -n "$ComposerInstall" ] && set -- ci + [ -n "$ComposerInstall" ] && set -- "$ComposerInstall" "$@" [ -n "$Verbose" ] && eecho "\$ docker ${args[*]} $*" exec docker "${args[@]}" "$@" @@ -568,10 +582,12 @@ else die "no command specified" elif [ "$1" == ci ]; then eecho "== installing composer dependencies" - composer i + shift + composer i "$@" elif [ "$1" == cu ]; then eecho "== upgrading composer dependencies" - composer u + shift + composer u "$@" elif [ "$1" == composer ]; then "$@" else