diff --git a/php/cli/SteamTrainApp.php b/php/cli/_SteamTrainApp.php similarity index 97% rename from php/cli/SteamTrainApp.php rename to php/cli/_SteamTrainApp.php index 6406cbf..7113daf 100644 --- a/php/cli/SteamTrainApp.php +++ b/php/cli/_SteamTrainApp.php @@ -7,7 +7,7 @@ use nulib\output\msg; use nulib\php\time\DateTime; use nulib\text\words; -class SteamTrainApp extends Application { +class _SteamTrainApp extends Application { const PROJDIR = __DIR__.'/../..'; const TITLE = "Train à vapeur"; const USE_LOGFILE = true; diff --git a/runphp/phpwrapper-.launcher.php b/runphp/phpwrapper-.launcher.php index adabe3d..0fb509c 100644 --- a/runphp/phpwrapper-.launcher.php +++ b/runphp/phpwrapper-.launcher.php @@ -1,12 +1,12 @@ # TODO Faire une copie de ce script dans un répertoire de l'application web -# (dans le répertoire cli_config/ par défaut) et modifier les paramètres si nécessaire +# (dans le répertoire cli/config/ par défaut) et modifier les paramètres si nécessaire #------------------------------------------------------------------------------- __DIR__.'/..', + "projdir" => __DIR__.'/@@CLI2PROJ@@', "appcode" => \app\config\bootstrap::APPCODE, ]; -require __DIR__.'/../vendor/nulib/base/php/src/app/cli/include-launcher.php'; +require __DIR__.'/@@CLI2PROJ@@/vendor/nulib/base/php/src/app/cli/include-launcher.php'; diff --git a/runphp/phpwrapper-_bg_launcher.php b/runphp/phpwrapper-_bg_launcher.php index 5b9a74b..13affdc 100644 --- a/runphp/phpwrapper-_bg_launcher.php +++ b/runphp/phpwrapper-_bg_launcher.php @@ -2,17 +2,17 @@ # (dans le répertoire sbin/ par défaut) et modifier les paramètres si nécessaire #------------------------------------------------------------------------------- __DIR__.'/..', + "projdir" => __DIR__.'/@@SBIN2PROJ@@', "appcode" => \app\config\bootstrap::APPCODE, ]); BgLauncherApp::run(); diff --git a/runphp/phpwrapper-_wrapper.sh b/runphp/phpwrapper-_wrapper.sh index 05569e8..5320701 100644 --- a/runphp/phpwrapper-_wrapper.sh +++ b/runphp/phpwrapper-_wrapper.sh @@ -1,5 +1,5 @@ # TODO Faire une copie de ce script dans un répertoire de l'application web -# (dans le répertoire cli_config/ par défaut) et modifier les paramétres si nécessaire +# (dans le répertoire cli/config/ par défaut) et modifier les paramétres si nécessaire #------------------------------------------------------------------------------- #!/bin/bash # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 @@ -7,7 +7,7 @@ # Tous les chemins suivants sont relatifs au répertoire qui contient ce script # Chemin relatif de la racine du projet -PROJPATH=.. +PROJPATH=@@CLI2PROJ@@ # Chemin relatif vers le lanceur PHP LAUNCHERPATH=.launcher.php @@ -100,10 +100,9 @@ if [ "$RUNPHP_MODE" == host ]; then args+=( --workdir "$cwd" "$COMPOSE_SERVICE" - exec "$MYNAME" + exec "$0" "$@" ) - cd "$PROJDIR" exec "${args[@]}" fi diff --git a/runphp/update-runphp.sh b/runphp/update-runphp.sh index b4555f5..2975e6b 100755 --- a/runphp/update-runphp.sh +++ b/runphp/update-runphp.sh @@ -157,19 +157,31 @@ if [ -n "$projdir" ]; then fi sbin_path=sbin - cli_path=cli_config + sbin2proj=.. + cli_path=cli/config + cli2proj=../.. if [ "$install_phpwrappers" == auto ]; then if [ ! -f "$PROJDIR/$COMPOSERDIR/composer.json" ]; then # ce doit être un projet PHP install_phpwrappers= + elif [ -d "$projdir/cli/config" ]; then + install_phpwrappers=1 + sbin_path=sbin + sbin2proj=.. + cli_path=cli/config + cli2proj=../.. elif [ -d "$projdir/cli_config" ]; then install_phpwrappers=1 sbin_path=sbin + sbin2proj=.. cli_path=cli_config + cli2proj=../.. elif [ -d "$projdir/_cli" ]; then install_phpwrappers=1 sbin_path=sbin + sbin2proj=.. cli_path=_cli + cli2proj=../.. else install_phpwrappers= fi @@ -193,7 +205,9 @@ if [ -n "$projdir" ]; then mkdir -p "$destdir" tail -n+4 "$MYDIR/$phpwrapper" | sed " s|/@@SBIN@@/|/$sbin_path/| +s|@@SBIN2PROJ@@|$sbin2proj| s|/@@CLI@@/|/$cli_path/| +s|@@CLI2PROJ@@|$cli2proj| " >"$destdir/$destname" [ -n "$mode" ] && chmod "$mode" "$destdir/$destname" done