bbnurse: implémenter -cm
This commit is contained in:
parent
6dd7325fd1
commit
caa725c7b4
92
bbnurse
92
bbnurse
|
@ -3,6 +3,97 @@
|
|||
#source /etc/nulib.sh || exit 1
|
||||
source "$(dirname -- "$0")/vendor/nulib/php/load.sh" || exit 1
|
||||
|
||||
function copy_nurse() {
|
||||
:
|
||||
}
|
||||
|
||||
function copy_mature() {
|
||||
local libname libdir path filename class
|
||||
local srcdir srcpath srcpackage
|
||||
local destdir destpath destpackage
|
||||
|
||||
local src="$1"; shift
|
||||
[ -n "$src" ] || die "vous devez spécifier le fichier ou le package arrivant à maturation"
|
||||
|
||||
if [ -f "$src" ]; then
|
||||
# fichier
|
||||
setx src=abspath "$src"
|
||||
[ "${src#$MYDIR/src/}" != "$src" ] || die "la source doit être dans nur-sery/src/"
|
||||
src="${src#$MYDIR/src/}"
|
||||
path="${src%/*}"
|
||||
filename="${src##*/}"
|
||||
class="${filename%.php}"
|
||||
elif [ -d "$src" ]; then
|
||||
# répertoire de package
|
||||
setx src=abspath "$src"
|
||||
[ "$src" == "$MYDIR/src" -o "${src#$MYDIR/src/}" != "$src" ] || die "la source doit être dans nur-sery/src/"
|
||||
srcdir="$src"
|
||||
path="${src#$MYDIR/src}"; path="${path#/}"
|
||||
else
|
||||
# package
|
||||
src="${src//\\\\/\/}"
|
||||
src="${src%/}"
|
||||
[ -d "$MYDIR/src/$src" ] || die "la source doit être un package de nur-sery"
|
||||
srcdir="$MYDIR/src/$src"
|
||||
path="$src"
|
||||
fi
|
||||
if [ -n "$path" ]; then
|
||||
srcpackage="nur/sery/$path"; srcpackage="${srcpackage//\//\\}"
|
||||
destpackage="nulib/$path"; destpackage="${destpackage//\//\\}"
|
||||
else
|
||||
srcpackage='nur\sery'
|
||||
destpackage='nulib'
|
||||
fi
|
||||
|
||||
local dest="${1:-.}"; shift
|
||||
setx dest=abspath "$dest"
|
||||
if [[ "$dest" == */nulib ]]; then
|
||||
libname=nulib
|
||||
libdir="$dest"
|
||||
elif [[ "$dest" == */nulib/* ]]; then
|
||||
libname=nulib
|
||||
libdir="${dest%%/nulib/*}/nulib"
|
||||
else
|
||||
die "seul la maturation vers nulib est supporté"
|
||||
fi
|
||||
|
||||
case "$libname" in
|
||||
nulib)
|
||||
if [ -n "$path" ]; then
|
||||
destdir="$libdir/php/src_${path%%/*}"
|
||||
else
|
||||
destdir="$libdir/php/src_base"
|
||||
fi
|
||||
|
||||
if [ -n "$class" ]; then
|
||||
# Maturation d'un seul fichier
|
||||
die "TODO"
|
||||
else
|
||||
# Maturation de toute un package
|
||||
pwd #XXX
|
||||
einfo "$srcdir --> $destdir"
|
||||
einfo "Maturation de $srcpackage vers $destpackage"
|
||||
setx -a srcs=find "$srcdir" -type f
|
||||
for src in "${srcs[@]}"; do
|
||||
srcname="${src#$srcdir/}"
|
||||
dest="$destdir/$srcname"
|
||||
estep "${src#$srcdir/}"
|
||||
mkdirof "$dest"
|
||||
sed "s|${srcpackage//\\/\\\\}|${destpackage//\\/\\\\}|g" <"$src" >"$dest"
|
||||
done
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function update_nurse() {
|
||||
:
|
||||
}
|
||||
|
||||
function update_mature() {
|
||||
:
|
||||
}
|
||||
|
||||
action=update
|
||||
evolution=mature
|
||||
args=(
|
||||
|
@ -39,3 +130,4 @@ Pour chaque type d'évolution, il y a deux actions possibles:
|
|||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
"${action}_${evolution}" "$@"
|
||||
|
|
Loading…
Reference in New Issue