From 87b0396f99ad4106dc31d80b9ae9222a55feb0f6 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Fri, 30 May 2025 22:38:04 +0400 Subject: [PATCH 1/8] Init changelog & version 0.6.0p82 --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 7b47c2a..82031dd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,5 @@ +## Release 0.6.0p82 du 30/05/2025-22:37 + ## Release 0.6.0p74 du 30/05/2025-22:35 29/05/2025 Renommer le répertoire de nulib à nulib-base et le package de nulib/php à nulib/base From a319baec05c4022edc07f738a9f4cbad3e486b82 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Fri, 30 May 2025 22:40:31 +0400 Subject: [PATCH 2/8] cosmetic --- composer.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/composer.json b/composer.json index 5a6a8da..a4830a9 100644 --- a/composer.json +++ b/composer.json @@ -44,8 +44,6 @@ "config": { "vendor-dir": "php/vendor" }, - "scripts": { - }, "authors": [ { "name": "Jephte Clain", From 341a9ba05a35505aab0bfcd9ab21bdca2486d275 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 2 Jun 2025 06:22:07 +0400 Subject: [PATCH 3/8] =?UTF-8?q?=C3=A9largir=20la=20plage=20de=20remplaceme?= =?UTF-8?q?nt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a4830a9..ad4668a 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } }, "replace": { - "nulib/php": "<0.6.0" + "nulib/php": "*" }, "require": { "symfony/yaml": "^5.0", From be6b7371e5fda494fb77796ca6a447a9d56e1b41 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 3 Jun 2025 06:06:09 +0400 Subject: [PATCH 4/8] ajout file::try_ext --- php/src/file.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/php/src/file.php b/php/src/file.php index feaa12c..6b2e65c 100644 --- a/php/src/file.php +++ b/php/src/file.php @@ -7,6 +7,7 @@ use nulib\file\MemoryStream; use nulib\file\SharedFile; use nulib\file\TempStream; use nulib\file\TmpfileWriter; +use nulib\os\path; /** * Class file: outils pour gérer les fichiers @@ -17,6 +18,30 @@ class file { return $file; } + /** + * si le fichier $file existe, le retourner. + * sinon, essayer avec l'une des extensions spécifiées, jusqu'à ce qu'un + * fichier soit trouvé. + * si aucun fichier n'est trouvé, retourner null + * + * par exemple, si le fichier "file.yaml" n'existe pas et que le fichier + * "file.yml" existe, alors file::try("file.yaml", ".yml") + * retourne "file.yml" + * + * @param string|array $exts + * @param string|array $replace_ext + */ + static function try_ext(string $file, $exts=null, $replace_ext=null): ?string { + if (file_exists($file)) return $file; + if ($exts !== null) { + foreach (cl::with($exts) as $ext) { + $tmpfile = path::ensure_ext($file, $ext, $replace_ext); + if (file_exists($tmpfile)) return $tmpfile; + } + } + return null; + } + static function reader($input, ?callable $func=null): FileReader { $file = new FileReader(self::fix_dash($input)); if ($func !== null) { From 278ffc7db10ab3f1629fd45399ec08f64b39bf72 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 3 Jun 2025 06:25:52 +0400 Subject: [PATCH 5/8] modifs.mineures sans commentaires --- php/src/file.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/php/src/file.php b/php/src/file.php index 6b2e65c..6bd1928 100644 --- a/php/src/file.php +++ b/php/src/file.php @@ -28,12 +28,16 @@ class file { * "file.yml" existe, alors file::try("file.yaml", ".yml") * retourne "file.yml" * + * par défaut, $replace_ext est initialisé à l'extension de $file. utiliser [] + * pour désactiver cette fonctionnalité + * * @param string|array $exts * @param string|array $replace_ext */ static function try_ext(string $file, $exts=null, $replace_ext=null): ?string { if (file_exists($file)) return $file; if ($exts !== null) { + $replace_ext ??= path::ext($file); foreach (cl::with($exts) as $ext) { $tmpfile = path::ensure_ext($file, $ext, $replace_ext); if (file_exists($tmpfile)) return $tmpfile; From 51ce95e1778312c3e2b9e6d09a5ebd7a6b66d948 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 3 Jun 2025 10:19:32 +0400 Subject: [PATCH 6/8] maj doc --- README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ddd0939..642d838 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,28 @@ ## Release Exemple: release de la version 0.6.0 + +Ouvrir deux consoles +* console "74" avec le checkout de la version php7.4 +* console "82" avec le checkout de la version php8.2 + ~~~sh +## dans les deux consoles + version=0.6.0 -## branche dev74 +## console 74 + git checkout dev74 prel -v$version _merge82 -## branche dev82 +## console 82 + +pu + git checkout dev82 prel -C @@ -22,10 +33,19 @@ prel -C commit="$(git log --grep="Init changelog . version ${version}p82" --format=%H)" && echo "commit=$commit" +## console 74 + +# reprendre la valeur affichée par la précédente commande +commit=XXX + git checkout dev74 git cherry-pick "$commit" pp -a + +## console 82 + +pu ~~~ -*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary \ No newline at end of file From 745e0f2bec3f73320a2f0f6fa7702baa796ac54c Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 3 Jun 2025 10:21:19 +0400 Subject: [PATCH 7/8] Init changelog & version 0.6.1p74 --- CHANGES.md | 6 ++++++ VERSION.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 82031dd..dd5ff1e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +## Release 0.6.1p74 du 03/06/2025-10:21 + +* `51ce95e` maj doc +* `be6b737` ajout file::try_ext +* `341a9ba` élargir la plage de remplacement + ## Release 0.6.0p82 du 30/05/2025-22:37 ## Release 0.6.0p74 du 30/05/2025-22:35 diff --git a/VERSION.txt b/VERSION.txt index a918a2a..ee6cdce 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.6.0 +0.6.1 From 8080dfae5acc4a8bbefa2438d015c5a3e6da07e9 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 3 Jun 2025 10:22:15 +0400 Subject: [PATCH 8/8] Init changelog & version 0.6.1p82 --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index dd5ff1e..a8633fc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,5 @@ +## Release 0.6.1p82 du 03/06/2025-10:22 + ## Release 0.6.1p74 du 03/06/2025-10:21 * `51ce95e` maj doc