scripts pour gérer projets composer
This commit is contained in:
parent
c66eee117e
commit
3971dca710
|
@ -0,0 +1,55 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: se connecter à la base MySQL
|
||||
|
||||
USAGE
|
||||
$scriptname [DATABASE]
|
||||
|
||||
OPTIONS
|
||||
-h, -s, --service SERVICE
|
||||
Spécifier le nom du service. La valeur par défaut est db"
|
||||
}
|
||||
|
||||
service=db
|
||||
args=(
|
||||
--help '$exit_with display_help'
|
||||
-h:,-s:,--service: service=
|
||||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
[ -n "$service" ] || die "Vous devez spécifier le nom du service"
|
||||
|
||||
found=
|
||||
first=1
|
||||
while true; do
|
||||
if [ -f composer.json ]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
first=
|
||||
cd ..
|
||||
if [ "$(pwd)" == "$HOME" ]; then
|
||||
die "Cette commande ne peut être lancée que depuis un projet Composer"
|
||||
fi
|
||||
done
|
||||
if [ -z "$first" ]; then
|
||||
enote "Le répertoire du projet est $(ppath . ~)"
|
||||
fi
|
||||
|
||||
[ -f bin/conndev.php ] || die "Impossible de trouver le script compagnon conndev.php"
|
||||
|
||||
###
|
||||
|
||||
setx cid=docker-compose ps -q "$service" 2>/dev/null || die "$service: service introuvable"
|
||||
|
||||
setx ip=docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$cid"
|
||||
edebug "$service: $ip"
|
||||
|
||||
mysqlcmd="$(php bin/conndev.php -- "$ip" "$@")"
|
||||
edebug "mysqlcmd: $mysqlcmd"
|
||||
|
||||
eval "$mysqlcmd"
|
|
@ -46,6 +46,8 @@ if [ -z "$first" ]; then
|
|||
enote "Le répertoire du projet est $(ppath . ~)"
|
||||
fi
|
||||
|
||||
###
|
||||
|
||||
setx cid=docker-compose ps -q "$service" 2>/dev/null || die "$service: service introuvable"
|
||||
|
||||
cmd=("$@")
|
||||
|
|
|
@ -45,6 +45,8 @@ if [ -z "$first" ]; then
|
|||
enote "Le répertoire du projet est $(ppath . ~)"
|
||||
fi
|
||||
|
||||
###
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
setx -a ms=list_dirs vendor "ur/*" "lib/*"
|
||||
set -- "${ms[@]}"
|
||||
|
|
Loading…
Reference in New Issue