runphp fait aussi wrapper
This commit is contained in:
parent
599d646372
commit
3e642b84bc
14
bin/._pman-composer_local_deps.php
Executable file
14
bin/._pman-composer_local_deps.php
Executable file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
require __DIR__ . "/../php/vendor/autoload.php";
|
||||
|
||||
use nulib\tools\pman\ComposerFile;
|
||||
use nulib\tools\pman\ComposerPmanFile;
|
||||
use nulib\ValueException;
|
||||
|
||||
$composer = new ComposerFile();
|
||||
|
||||
$deps = $composer->getLocalDeps();
|
||||
foreach ($deps as $dep => $path) {
|
||||
echo "$path\n";
|
||||
}
|
22
bin/._pman-composer_select_profile.php
Executable file
22
bin/._pman-composer_select_profile.php
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
require __DIR__ . "/../php/vendor/autoload.php";
|
||||
|
||||
use nulib\tools\pman\ComposerFile;
|
||||
use nulib\tools\pman\ComposerPmanFile;
|
||||
use nulib\ValueException;
|
||||
|
||||
$composer = new ComposerFile();
|
||||
$config = new ComposerPmanFile();
|
||||
|
||||
if ($argc <= 1) {
|
||||
throw new ValueException("Il faut spécifier le profil à sélectionner");
|
||||
}
|
||||
$profile = $argv[1];
|
||||
|
||||
$composer->selectProfile($profile, $config);
|
||||
if (getenv("PMAN_COMPOSER_DEBUG")) {
|
||||
$composer->print();
|
||||
} else {
|
||||
$composer->write();
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
require __DIR__ . "/../php/vendor/autoload.php";
|
||||
|
||||
use nulib\tools\pman\ComposerFile;
|
||||
use nulib\tools\pman\ComposerPmanFile;
|
||||
use nulib\ValueException;
|
||||
|
||||
$composer = new ComposerFile();
|
||||
|
||||
$deps = $composer->getLocalDeps();
|
||||
foreach ($deps as $dep => $path) {
|
||||
echo "$path\n";
|
||||
}
|
1
bin/_pman-composer_local_deps.php
Symbolic link
1
bin/_pman-composer_local_deps.php
Symbolic link
@ -0,0 +1 @@
|
||||
runphp
|
@ -1,22 +0,0 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
require __DIR__ . "/../php/vendor/autoload.php";
|
||||
|
||||
use nulib\tools\pman\ComposerFile;
|
||||
use nulib\tools\pman\ComposerPmanFile;
|
||||
use nulib\ValueException;
|
||||
|
||||
$composer = new ComposerFile();
|
||||
$config = new ComposerPmanFile();
|
||||
|
||||
if ($argc <= 1) {
|
||||
throw new ValueException("Il faut spécifier le profil à sélectionner");
|
||||
}
|
||||
$profile = $argv[1];
|
||||
|
||||
$composer->selectProfile($profile, $config);
|
||||
if (getenv("PMAN_COMPOSER_DEBUG")) {
|
||||
$composer->print();
|
||||
} else {
|
||||
$composer->write();
|
||||
}
|
1
bin/_pman-composer_select_profile.php
Symbolic link
1
bin/_pman-composer_select_profile.php
Symbolic link
@ -0,0 +1 @@
|
||||
runphp
|
21
bin/runphp
21
bin/runphp
@ -20,14 +20,25 @@ while true; do
|
||||
cd ..
|
||||
done
|
||||
|
||||
if [ -z "$PROJDIR" ]; then
|
||||
# s'il n'y a pas de projet, --bs est l'action par défaut
|
||||
[ $# -gt 0 ] || set -- --bs --ue
|
||||
elif [ "$MYNAME" == composer ]; then
|
||||
export RUNPHP_MOUNT=
|
||||
if [ "$MYNAME" == composer ]; then
|
||||
set -- composer "$@"
|
||||
elif [[ "$MYNAME" == *.php ]]; then
|
||||
# frontend pour une commande php
|
||||
set -- php "$MYDIR/.$MYNAME" "$@"
|
||||
# s'assurer que NULIBDIR est monté
|
||||
RUNPHP_MOUNT="$NULIBDIR"
|
||||
elif [ $# -eq 0 ]; then
|
||||
# s'il n'y a pas de projet, --bs est l'action par défaut
|
||||
[ -n "$PROJDIR" ] || set -- --bs --ue
|
||||
else
|
||||
case "$1" in
|
||||
*.php|*.phar) set -- php "$@";;
|
||||
*.php|*.phar)
|
||||
set -- php "$@"
|
||||
# s'assurer que le répertoire du script est monté
|
||||
setx RUNPHP_MOUNT=dirname "$1"
|
||||
setx RUNPHP_MOUNT=abspath "$RUNPHP_MOUNT"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
@ -537,26 +537,34 @@ OPTIONS
|
||||
|
||||
# monter le répertoire qui contient $PROJDIR
|
||||
mount_composer=
|
||||
mount_runphp=1
|
||||
mount_standalone=1
|
||||
mount_mount=1
|
||||
if [ -z "$PROJDIR" -o "${PROJDIR#$HOME/}" != "$PROJDIR" -o "$PROJDIR" == "$HOME" ]; then
|
||||
# bind mount $HOME
|
||||
args+=(-v "$HOME:$HOME${UseRslave:+:rslave}")
|
||||
[ -n "$RUNPHP_STANDALONE" ] &&
|
||||
[ "${RUNPHP_STANDALONE#$HOME/}" != "$RUNPHP_STANDALONE" ] &&
|
||||
mount_runphp=
|
||||
if [ -n "$RUNPHP_STANDALONE" -a "${RUNPHP_STANDALONE#$HOME/}" != "$RUNPHP_STANDALONE" ]; then
|
||||
mount_standalone=
|
||||
fi
|
||||
if [ -n "$RUNPHP_MOUNT" -a "${RUNPHP_MOUNT#$HOME/}" != "$RUNPHP_MOUNT" ]; then
|
||||
mount_mount=
|
||||
fi
|
||||
elif [ -n "$PROJDIR" ]; then
|
||||
# bind mount uniquement le répertoire du projet
|
||||
args+=(-v "$PROJDIR:$PROJDIR${UseRslave:+:rslave}")
|
||||
mount_composer=1
|
||||
[ "$RUNPHP_STANDALONE" == "$PROJDIR" ] && mount_runphp=
|
||||
[ "$RUNPHP_STANDALONE" == "$PROJDIR" ] && mount_standalone=
|
||||
[ "$RUNPHP_MOUNT" == "$PROJDIR" ] && mount_mount=
|
||||
fi
|
||||
if [ -n "$mount_composer" -a -d "$HOME/.composer" ]; then
|
||||
# monter la configuration de composer
|
||||
args+=(-v "$HOME/.composer:$HOME/.composer")
|
||||
fi
|
||||
if [ -n "$RUNPHP_STANDALONE" -a -n "$mount_runphp" ]; then
|
||||
if [ -n "$RUNPHP_STANDALONE" -a -n "$mount_standalone" ]; then
|
||||
args+=(-v "$RUNPHP_STANDALONE:$RUNPHP_STANDALONE")
|
||||
fi
|
||||
if [ -n "$RUNPHP_MOUNT" -a -n "$mount_mount" ]; then
|
||||
args+=(-v "$RUNPHP_MOUNT:$RUNPHP_MOUNT")
|
||||
fi
|
||||
args+=(-w "$(pwd)")
|
||||
|
||||
# lancer avec l'utilisateur courant
|
||||
|
Loading…
x
Reference in New Issue
Block a user