75 lines
1.5 KiB
Bash
Executable File
75 lines
1.5 KiB
Bash
Executable File
#!/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: mettre à jour un module ur/* ou lib/* sans utiliser composer
|
|
|
|
ça permet de faire du développement plus rapidement sans utiliser les dépôts de
|
|
type path
|
|
|
|
USAGE
|
|
$scriptname modules...
|
|
|
|
OPTIONS
|
|
-n, --fake
|
|
Afficher simplement ce qui serait fait
|
|
-q, --quiet
|
|
Ne pas lancer rsync en mode verbose"
|
|
}
|
|
|
|
fake=
|
|
verbose=1
|
|
args=(
|
|
--help '$exit_with display_help'
|
|
-n,--fake fake=1
|
|
-q,--quiet verbose=
|
|
)
|
|
parse_args "$@"; set -- "${args[@]}"
|
|
|
|
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
|
|
|
|
if [ $# -eq 0 ]; then
|
|
setx -a ms=list_dirs vendor "ur/*" "lib/*"
|
|
set -- "${ms[@]}"
|
|
fi
|
|
|
|
for m in "$@"; do
|
|
m="${m//\//-}"
|
|
case "$m" in
|
|
ur-*|lib-*) ;;
|
|
*) m="ur-$m";;
|
|
esac
|
|
p="${m//-/\/}"
|
|
|
|
[ -L "vendor/$p" ] && continue
|
|
|
|
etitle "$m"
|
|
[ -d "../$m" ] || die "$m: module introuvable"
|
|
rsync_args=(
|
|
-a ${fake:+-n} ${verbose:+-v}
|
|
--delete
|
|
-f "- /.git/"
|
|
-f "- /vendor/"
|
|
"../$m/" "vendor/$p"
|
|
)
|
|
rsync "${rsync_args[@]}"
|
|
eend
|
|
done
|