modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-09-30 08:41:47 +04:00
parent bbec334f44
commit a099261b58
14 changed files with 29 additions and 84 deletions

View File

@ -12,7 +12,7 @@ use nur\path;
use nur\sery\app\launcher; use nur\sery\app\launcher;
use nur\sery\app\RunFile; use nur\sery\app\RunFile;
use nur\sery\cl; use nur\sery\cl;
use nur\sery\app\app; use nur\sery\app;
use nur\sery\output\log as nlog; use nur\sery\output\log as nlog;
use nur\sery\output\msg as nmsg; use nur\sery\output\msg as nmsg;
use nur\sery\output\console as nconsole; use nur\sery\output\console as nconsole;

View File

@ -1,15 +1,12 @@
<?php <?php
namespace nur\sery\app; namespace nur\sery;
use nur\sery\A;
use nur\sery\app\cli\Application; use nur\sery\app\cli\Application;
use nur\sery\cl; use nur\sery\app\LockFile;
use nur\sery\ExitError; use nur\sery\app\RunFile;
use nur\sery\os\path; use nur\sery\os\path;
use nur\sery\os\sh; use nur\sery\os\sh;
use nur\sery\php\func; use nur\sery\php\func;
use nur\sery\str;
use nur\sery\ValueException;
class app { class app {
private static function isa_Application($app): bool { private static function isa_Application($app): bool {

View File

@ -2,6 +2,7 @@
namespace nur\sery\app; namespace nur\sery\app;
use nur\sery\A; use nur\sery\A;
use nur\sery\app;
use nur\sery\cl; use nur\sery\cl;
use nur\sery\file\SharedFile; use nur\sery\file\SharedFile;
use nur\sery\os\path; use nur\sery\os\path;

View File

@ -4,7 +4,7 @@
# - NULIB_APP_app_params : paramètres du projet # - NULIB_APP_app_params : paramètres du projet
use nur\sery\os\path; use nur\sery\os\path;
use nur\sery\app\app; use nur\sery\app;
if ($argc <= 1) die("invalid arguments"); if ($argc <= 1) die("invalid arguments");

View File

@ -7,7 +7,7 @@ require __DIR__.'/../vendor/autoload.php';
# (par défaut c'est le répertoire bin/) et modifier les paramètres si nécessaire # (par défaut c'est le répertoire bin/) et modifier les paramètres si nécessaire
use nur\sery\tools\BgLauncherApp; use nur\sery\tools\BgLauncherApp;
use nur\sery\app\app; use nur\sery\app;
# chemin vers le lanceur PHP # chemin vers le lanceur PHP
const NULIB_APP_app_launcher = __DIR__.'/../_cli/_launcher.php'; const NULIB_APP_app_launcher = __DIR__.'/../_cli/_launcher.php';

View File

@ -4,7 +4,7 @@ namespace nur\sery\os;
use nur\sery\cl; use nur\sery\cl;
use nur\sery\ExitError; use nur\sery\ExitError;
use nur\sery\StateException; use nur\sery\StateException;
use nur\sery\app\app; use nur\sery\app;
class sh { class sh {
static final function _quote(string $value): string { static final function _quote(string $value): string {

View File

@ -7,7 +7,7 @@ use nur\sery\os\path;
use nur\sery\os\proc\Cmd; use nur\sery\os\proc\Cmd;
use nur\sery\os\sh; use nur\sery\os\sh;
use nur\sery\output\msg; use nur\sery\output\msg;
use nur\sery\app\app; use nur\sery\app;
use nur\sery\app\cli\Application; use nur\sery\app\cli\Application;
use nur\sery\app\RunFile; use nur\sery\app\RunFile;

View File

@ -4,7 +4,7 @@ namespace nur\sery\tools;
use nur\sery\output\msg; use nur\sery\output\msg;
use nur\sery\php\time\DateTime; use nur\sery\php\time\DateTime;
use nur\sery\text\words; use nur\sery\text\words;
use nur\sery\app\app; use nur\sery\app;
use nur\sery\app\cli\Application; use nur\sery\app\cli\Application;
class SteamTrainApp extends Application { class SteamTrainApp extends Application {

View File

@ -1,20 +0,0 @@
<?php
namespace nur\sery\app;
use nur\cli\Application;
use nur\sery\output\msg;
class LongTaskApp extends Application {
const APPCODE = "long-task";
const USE_LOGFILE = true;
const USE_RUNFILE = true;
const USE_RUNLOCK = true;
function main() {
$step = 100;
while (--$step > 0) {
msg::print("step $step");
sleep(1);
}
}
}

View File

@ -1,6 +1,6 @@
<?php <?php
namespace nur\sery\wip\app; namespace nur\sery\app;
use nulib\tests\TestCase; use nulib\tests\TestCase;
use nur\sery\app\args; use nur\sery\app\args;

View File

@ -1,20 +0,0 @@
<?php
namespace nur\sery\app;
use nulib\tests\TestCase;
class launcherTest extends TestCase {
function testVerifix_args() {
self::assertSame([], launcher::verifix_args([]));
self::assertSame(["a"], launcher::verifix_args(["a"]));
self::assertSame(["a", "--b"], launcher::verifix_args(["a", "--b"]));
self::assertSame([], launcher::verifix_args(["a" => false]));
self::assertSame(["--a"], launcher::verifix_args(["a" => true]));
self::assertSame(["--a", "value"], launcher::verifix_args(["a" => "value"]));
self::assertSame(["--a", "52"], launcher::verifix_args(["a" => 52]));
self::assertSame(["--aa-bb", "value"], launcher::verifix_args(["aaBb" => "value"]));
self::assertSame(["--aa-bb", "value"], launcher::verifix_args(["aa-Bb" => "value"]));
self::assertSame(["--aa-bb", "value"], launcher::verifix_args(["aa_Bb" => "value"]));
self::assertSame(["---aa-bb", "value"], launcher::verifix_args(["_aa_Bb" => "value"]));
}
}

View File

@ -1,12 +1,12 @@
<?php <?php
namespace nur\sery\wip\app { namespace nur\sery {
use nulib\tests\TestCase; use nulib\tests\TestCase;
use nur\sery\wip\app\impl\config; use nur\sery\impl\config;
use nur\sery\wip\app\impl\myapp; use nur\sery\impl\myapp;
use nur\sery\wip\app\impl\MyApplication1; use nur\sery\impl\MyApplication1;
use nur\sery\wip\app\impl\MyApplication2; use nur\sery\impl\MyApplication2;
class app2Test extends TestCase { class appTest extends TestCase {
function testWith() { function testWith() {
$projdir = config::get_projdir(); $projdir = config::get_projdir();
$cwd = getcwd(); $cwd = getcwd();
@ -26,6 +26,7 @@ namespace nur\sery\wip\app {
"vardir" => "$projdir/devel/var", "vardir" => "$projdir/devel/var",
"logdir" => "$projdir/devel/log", "logdir" => "$projdir/devel/log",
"profile" => "devel", "profile" => "devel",
"appgroup" => null,
"name" => "my-application1", "name" => "my-application1",
"title" => null, "title" => null,
], $app1->getParams()); ], $app1->getParams());
@ -44,6 +45,7 @@ namespace nur\sery\wip\app {
"vardir" => "$projdir/devel/var", "vardir" => "$projdir/devel/var",
"logdir" => "$projdir/devel/log", "logdir" => "$projdir/devel/log",
"profile" => "devel", "profile" => "devel",
"appgroup" => null,
"name" => "my-application2", "name" => "my-application2",
"title" => null, "title" => null,
], $app2->getParams()); ], $app2->getParams());
@ -68,6 +70,7 @@ namespace nur\sery\wip\app {
"vardir" => "$projdir/devel/var", "vardir" => "$projdir/devel/var",
"logdir" => "$projdir/devel/log", "logdir" => "$projdir/devel/log",
"profile" => "devel", "profile" => "devel",
"appgroup" => null,
"name" => "my-application1", "name" => "my-application1",
"title" => null, "title" => null,
], myapp::get()->getParams()); ], myapp::get()->getParams());
@ -86,6 +89,7 @@ namespace nur\sery\wip\app {
"vardir" => "$projdir/devel/var", "vardir" => "$projdir/devel/var",
"logdir" => "$projdir/devel/log", "logdir" => "$projdir/devel/log",
"profile" => "devel", "profile" => "devel",
"appgroup" => null,
"name" => "my-application2", "name" => "my-application2",
"title" => null, "title" => null,
], myapp::get()->getParams()); ], myapp::get()->getParams());
@ -93,13 +97,14 @@ namespace nur\sery\wip\app {
} }
} }
namespace nur\sery\wip\app\impl { namespace nur\sery\impl {
use nur\cli\Application2;
use nur\sery\app\cli\Application;
use nur\sery\os\path; use nur\sery\os\path;
use nur\sery\app\app; use nur\sery\app;
class config { class config {
const PROJDIR = __DIR__.'/../../..'; const PROJDIR = __DIR__.'/..';
static function get_projdir(): string { static function get_projdir(): string {
return path::abspath(self::PROJDIR); return path::abspath(self::PROJDIR);
@ -112,13 +117,13 @@ namespace nur\sery\wip\app\impl {
} }
} }
class MyApplication1 extends Application2 { class MyApplication1 extends Application {
const PROJDIR = config::PROJDIR; const PROJDIR = config::PROJDIR;
function main() { function main() {
} }
} }
class MyApplication2 extends Application2 { class MyApplication2 extends Application {
const PROJDIR = null; const PROJDIR = null;
function main() { function main() {

View File

@ -1,18 +0,0 @@
<?php
namespace nur\sery\wip\app;
use nulib\tests\TestCase;
use nur\sery\app\app;
class appTest extends TestCase {
function testVerifix_name() {
$name = 'my\package\MyApplication';
$verifix_name = function($name) {
self::verifix_name($name);
return $name;
};
$app = new app(null);
self::assertSame("my-application", $verifix_name->call($app, "$name"));
}
}

View File

@ -5,7 +5,7 @@ use Exception;
use nur\cli\ArgsException; use nur\cli\ArgsException;
use nur\cli\ArgsParser; use nur\cli\ArgsParser;
use nur\config; use nur\config;
use nur\sery\app\app; use nur\sery\app;
use nur\sery\app\RunFile; use nur\sery\app\RunFile;
use nur\sery\ExitError; use nur\sery\ExitError;
use nur\sery\output\console; use nur\sery\output\console;