modifs.mineures sans commentaires
This commit is contained in:
parent
b6d20261e2
commit
7be840f2cc
42
bbnurse
42
bbnurse
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
#source /etc/nulib.sh || exit 1
|
||||
source "$(dirname -- "$0")/vendor/nulib/php/load.sh" || exit 1
|
||||
source /etc/nulib.sh || exit 1
|
||||
#source "$(dirname -- "$0")/vendor/nulib/php/load.sh" || exit 1
|
||||
|
||||
function copy_nurse() {
|
||||
:
|
||||
|
@ -20,9 +20,16 @@ function copy_mature() {
|
|||
setx src=abspath "$src"
|
||||
[ "${src#$MYDIR/src/}" != "$src" ] || die "la source doit être dans nur-sery/src/"
|
||||
src="${src#$MYDIR/src/}"
|
||||
if [[ "$src" == */* ]]; then
|
||||
path="${src%/*}"
|
||||
filename="${src##*/}"
|
||||
else
|
||||
path=
|
||||
filename="$src"
|
||||
fi
|
||||
class="${filename%.php}"
|
||||
srcdir="$MYDIR/src"
|
||||
src="$srcdir/$src"
|
||||
elif [ -d "$src" ]; then
|
||||
# répertoire de package
|
||||
setx src=abspath "$src"
|
||||
|
@ -48,14 +55,13 @@ function copy_mature() {
|
|||
destpackage='nulib'
|
||||
fi
|
||||
|
||||
local dest="${1:-.}"; shift
|
||||
setx dest=abspath "$dest"
|
||||
if [[ "$dest" == */nulib ]]; then
|
||||
setx Dest=abspath "$Dest"
|
||||
if [[ "$Dest" == */nulib ]]; then
|
||||
libname=nulib
|
||||
libdir="$dest"
|
||||
elif [[ "$dest" == */nulib/* ]]; then
|
||||
libdir="$Dest"
|
||||
elif [[ "$Dest" == */nulib/* ]]; then
|
||||
libname=nulib
|
||||
libdir="${dest%%/nulib/*}/nulib"
|
||||
libdir="${Dest%%/nulib/*}/nulib"
|
||||
else
|
||||
die "seul la maturation vers nulib est supporté"
|
||||
fi
|
||||
|
@ -75,7 +81,12 @@ function copy_mature() {
|
|||
|
||||
if [ -n "$class" ]; then
|
||||
# Maturation d'un seul fichier
|
||||
die "TODO"
|
||||
etitle "Maturation de $srcpackage vers $destpackage"
|
||||
srcname="${src#$srcdir/}"
|
||||
dest="$destdir/$srcname"
|
||||
estep "$srcname"
|
||||
mkdirof "$dest"
|
||||
sed "s|${nurserypackage//\\/\\\\}|${nulibpackage//\\/\\\\}|g" <"$src" >"$dest"
|
||||
else
|
||||
# Maturation de toute un package
|
||||
etitle "Maturation de $srcpackage vers $destpackage"
|
||||
|
@ -84,7 +95,7 @@ function copy_mature() {
|
|||
for src in "${srcs[@]}"; do
|
||||
srcname="${src#$srcdir/}"
|
||||
dest="$destdir/$srcname"
|
||||
estep "${src#$srcdir/}"
|
||||
estep "$srcname"
|
||||
mkdirof "$dest"
|
||||
sed "s|${nurserypackage//\\/\\\\}|${nulibpackage//\\/\\\\}|g" <"$src" >"$dest"
|
||||
done
|
||||
|
@ -113,14 +124,17 @@ function update_mature() {
|
|||
:
|
||||
}
|
||||
|
||||
action=update
|
||||
action=copy
|
||||
evolution=mature
|
||||
Dest=
|
||||
args=(
|
||||
"Gérer la maturation d'une classe ou d'un package"
|
||||
"
|
||||
-cm SRC [-d DEST]
|
||||
-cn SRC
|
||||
-cm SRC [DEST]
|
||||
-u[n|m] package|Class [DEST]
|
||||
-u[n|m] package|Class [-d DEST]
|
||||
|
||||
IMPORTANT: pour l'instant, seule la copie à maturation (-cm) est implémentée
|
||||
|
||||
Il y a deux types d'évolutions possibles:
|
||||
* mettre en nurserie (-n)
|
||||
|
@ -142,6 +156,7 @@ Pour chaque type d'évolution, il y a deux actions possibles:
|
|||
la version mature à maturation
|
||||
L'argument est un 'package' ou un 'sous\\package' (dont le nom commence par
|
||||
une minuscule) ou une 'Classe' (dont le nom commence par une majuscule)"
|
||||
-d:,--dest Dest= "Spécifier la destination"
|
||||
-c,--copy action=copy "Copier de/vers un projet nulib-*"
|
||||
-u,--update action=update "Mettre à jour un projet. C'est l'option par défaut"
|
||||
-i,-n,--nurse evolution=nurse "Mettre en nurserie"
|
||||
|
@ -149,4 +164,5 @@ Pour chaque type d'évolution, il y a deux actions possibles:
|
|||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
[ -n "$Dest" ] || Dest=.
|
||||
"${action}_${evolution}" "$@"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
namespace nur\b\io;
|
||||
|
||||
use nur\sery\file\base\FileReader;
|
||||
use nur\v\http;
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,7 @@ namespace nur\ref;
|
|||
|
||||
use nur\data\types\Metadata;
|
||||
use nur\md;
|
||||
use nur\sery\os\file\file;
|
||||
|
||||
/**
|
||||
* Class ref_type: référence des types utilisables dans les schémas
|
||||
|
@ -104,7 +105,7 @@ class ref_type {
|
|||
/** comme {@link CONTENT} mais nullable */
|
||||
const NCONTENT = "?".self::CONTENT;
|
||||
|
||||
/** comme {@link FILE} mais nullable */
|
||||
/** comme {@link \nur\sery\FILE} mais nullable */
|
||||
const NFILE = "?".self::FILE;
|
||||
|
||||
/** comme {@link DATETIME} mais nullable */
|
||||
|
|
|
@ -79,6 +79,15 @@ class cv {
|
|||
|
||||
#############################################################################
|
||||
|
||||
/** échanger les deux valeurs */
|
||||
static final function swap(&$a, &$b): void {
|
||||
$tmp = $a;
|
||||
$a = $b;
|
||||
$b = $tmp;
|
||||
}
|
||||
|
||||
#############################################################################
|
||||
|
||||
/** mettre à jour $dest avec $value si $cond($value) est vrai */
|
||||
static final function set_if(&$dest, $value, callable $cond) {
|
||||
if ($cond($value)) $dest = $value;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
namespace nur\sery\os;
|
||||
namespace nur\sery;
|
||||
|
||||
use nur\sery\os\file\FileReader;
|
||||
use nur\sery\os\file\FileWriter;
|
||||
use nur\sery\os\file\MemoryStream;
|
||||
use nur\sery\os\file\SharedFile;
|
||||
use nur\sery\os\file\TempStream;
|
||||
use nur\sery\os\file\TmpfileWriter;
|
||||
use nur\sery\file\base\FileReader;
|
||||
use nur\sery\file\base\FileWriter;
|
||||
use nur\sery\file\base\MemoryStream;
|
||||
use nur\sery\file\base\SharedFile;
|
||||
use nur\sery\file\base\TempStream;
|
||||
use nur\sery\file\base\TmpfileWriter;
|
||||
|
||||
/**
|
||||
* Class file: outils pour gérer les fichiers
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
namespace nur\sery\file;
|
||||
|
||||
use nur\sery\os\EOFException;
|
||||
use nur\sery\os\IOException;
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
namespace nur\sery\file;
|
||||
|
||||
use nur\sery\os\IOException;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
namespace nur\sery\file;
|
||||
|
||||
use Iterator;
|
||||
use nur\sery\os\IOException;
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
|
||||
use nur\sery\os\IOException;
|
||||
namespace nur\sery\file\base;
|
||||
|
||||
/**
|
||||
* Class FileReader: un fichier accédé en lecture
|
|
@ -1,9 +1,8 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
namespace nur\sery\file\base;
|
||||
|
||||
use nur\sery\os\IOException;
|
||||
use nur\sery\os\sh;
|
||||
use nur\sery\web\http;
|
||||
|
||||
/**
|
||||
* Class FileWriter: un fichier accédé en lecture/écriture
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
|
||||
use nur\sery\os\IOException;
|
||||
namespace nur\sery\file\base;
|
||||
|
||||
/**
|
||||
* Class MemoryStream: un flux qui peut être lu ou écrit, et qui reste
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
namespace nur\sery\file\base;
|
||||
|
||||
use nur\sery\ValueException;
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
namespace nur\sery\file\base;
|
||||
|
||||
use nur\sery\file\csv\csv_flavours;
|
||||
use nur\sery\file\IReader;
|
||||
use nur\sery\file\IWriter;
|
||||
use nur\sery\NoMoreDataException;
|
||||
use nur\sery\os\csv\csv_flavours;
|
||||
use nur\sery\os\EOFException;
|
||||
use nur\sery\os\IOException;
|
||||
use nur\sery\php\iter\AbstractIterator;
|
|
@ -1,18 +1,19 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
namespace nur\sery\file\base;
|
||||
|
||||
use nur\A;
|
||||
use nur\b\io\IOException;
|
||||
use nur\sery\file\_IFile;
|
||||
use nur\sery\os\IOException;
|
||||
|
||||
trait TStreamFilter {
|
||||
private $filters = null;
|
||||
|
||||
function appendFilter(string $filterName, ?int $readWrite=null, $params=null): void {
|
||||
A::append($this->filters, [$filterName, $readWrite, $params]);
|
||||
$this->filters[] = [$filterName, $readWrite, $params];
|
||||
}
|
||||
|
||||
function prependFilter(string $filterName, ?int $readWrite=null, $params=null): void {
|
||||
A::prepend($this->filters, [$filterName, $readWrite, $params]);
|
||||
if ($this->filters === null) $this->filters = [];
|
||||
array_unshift($this->filters, [$filterName, $readWrite, $params]);
|
||||
}
|
||||
|
||||
function setEncodingFilter(string $from, string $to): void {
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
namespace nur\sery\file\base;
|
||||
|
||||
/**
|
||||
* Class TempStream: un flux qui peut être lu ou écrit, et qui reste en mémoire,
|
|
@ -1,9 +1,8 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
namespace nur\sery\file\base;
|
||||
|
||||
use nur\sery\os\IOException;
|
||||
use nur\sery\os\path;
|
||||
use nur\sery\web\http;
|
||||
|
||||
/**
|
||||
* Class TmpfileWriter: un fichier temporaire accédé en lecture/écriture
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
namespace nur\sery\file\base;
|
||||
|
||||
use nur\sery\os\IOException;
|
||||
use nur\sery\web\http;
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
namespace nur\sery\os\csv;
|
||||
namespace nur\sery\file\csv;
|
||||
|
||||
use nur\A;
|
||||
use nur\ref\ref_csv;
|
||||
use nur\sery\cl;
|
||||
use nur\sery\ref\os\csv\ref_csv;
|
||||
|
||||
class csv_flavours {
|
||||
const MAP = [
|
||||
|
@ -41,6 +41,6 @@ class csv_flavours {
|
|||
}
|
||||
|
||||
static final function get_encoding(string $flavour): ?string {
|
||||
return A::get(self::ENCODINGS, $flavour);
|
||||
return cl::get(self::ENCODINGS, $flavour);
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@ namespace nur\sery\output\std;
|
|||
|
||||
use Exception;
|
||||
use nur\sery\cl;
|
||||
use nur\sery\os\file\Stream;
|
||||
use nur\sery\file\base\Stream;
|
||||
use nur\sery\php\content\content;
|
||||
use nur\sery\php\content\IContent;
|
||||
use nur\sery\php\content\IPrintable;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
namespace nur\sery;
|
||||
|
||||
use nur\base;
|
||||
|
||||
/**
|
||||
* Class str: gestion des chaines de caractère "simples"
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
namespace nur\sery\os\file;
|
||||
namespace nur\sery\file\base;
|
||||
|
||||
use nur\sery\file\base\FileReader;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FileReaderTest extends TestCase {
|
|
@ -2,7 +2,7 @@
|
|||
namespace nur\sery\php\time;
|
||||
|
||||
use DateTimeZone;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use nulib\tests\TestCase;
|
||||
|
||||
class DateTest extends TestCase {
|
||||
protected static function dt(string $datetime): Date {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace nur\sery\php\time;
|
||||
|
||||
use DateTimeZone;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use nulib\tests\TestCase;
|
||||
|
||||
class DateTimeTest extends TestCase {
|
||||
protected static function dt(string $datetime): DateTime {
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
namespace nur\sery\php\time;
|
||||
|
||||
use DateTimeZone;
|
||||
use nur\sery\php\time\DateTime;
|
||||
use nur\sery\php\time\Delay;
|
||||
use nur\t\TestCase;
|
||||
use nulib\tests\TestCase;
|
||||
|
||||
class DelayTest extends TestCase {
|
||||
protected static function dt(string $datetime): DateTime {
|
||||
|
|
Loading…
Reference in New Issue