diff --git a/LICENSE b/LICENSE index 82fedfb..17b19ba 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2013-2019 TechFuze +Copyright (c) 2013-2021 TechFuze Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/bin/fuzeworks b/bin/fuzeworks index 1015564..14c6007 100644 --- a/bin/fuzeworks +++ b/bin/fuzeworks @@ -66,7 +66,7 @@ foreach ($autoloaders as $file) $arguments = getopt('', ['bootstrap:']); if (!isset($arguments['bootstrap']) || empty($arguments['bootstrap'])) { - fwrite(STDERR, "Could not load supervisor. No bootstrap provided.\n"); + fwrite(STDERR, "Could not load fuzeworks. No bootstrap provided.\n"); die(1); } @@ -74,7 +74,7 @@ if (!isset($arguments['bootstrap']) || empty($arguments['bootstrap'])) $bootstrap = $arguments['bootstrap']; if (!file_exists($bootstrap)) { - fwrite(STDERR, "Could not load supervisor. Provided bootstrap doesn't exist."); + fwrite(STDERR, "Could not load fuzeworks. Provided bootstrap doesn't exist."); die(1); } @@ -85,7 +85,7 @@ $container = require($bootstrap); // Check if container is a Factory if (!$container instanceof Factory) { - fwrite(STDERR, "Could not load supervisor. Provided bootstrap is not a valid bootstrap."); + fwrite(STDERR, "Could not load fuzeworks. Provided bootstrap is not a valid bootstrap."); die(1); } diff --git a/composer.json b/composer.json index 367ed89..d06df64 100644 --- a/composer.json +++ b/composer.json @@ -14,11 +14,10 @@ ], "require": { "php": ">=7.4.0", - "fuzeworks/mvcr": "~1.3.1", + "fuzeworks/mvcr": "~1.3.2", "fuzeworks/core": "~1.2.0" }, "require-dev": { - "phpunit/phpunit": "^9", "fuzeworks/tracycomponent": "~1.2.0" }, "autoload": { diff --git a/src/FuzeWorks/CLI/CLIComponent.php b/src/FuzeWorks/CLI/CLIComponent.php index f979d6c..450a432 100644 --- a/src/FuzeWorks/CLI/CLIComponent.php +++ b/src/FuzeWorks/CLI/CLIComponent.php @@ -77,13 +77,6 @@ class CLIComponent implements iComponent // Add dependencies $configurator->addComponent(new MVCRComponent()); - // Add fallback configuration directory - $configurator->addDirectory( - dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Config', - 'config', - Priority::LOWEST - ); - // If the component will handle a request, set the logger to output for CLI if (self::$willHandleRequest) $configurator->call('logger', 'setLoggerTemplate', null, 'logger_cli'); @@ -122,6 +115,7 @@ class CLIComponent implements iComponent /** @var Models $models */ /** @var Views $views */ /** @var Controllers $controllers */ + $router = Factory::getInstance('router'); $input = Factory::getInstance('cliInput'); $models = Factory::getInstance('models'); $views = Factory::getInstance('views'); @@ -133,6 +127,9 @@ class CLIComponent implements iComponent $views->addComponentPath($srcPath . DS . 'Views', Priority::LOW); $controllers->addComponentPath($srcPath . DS . 'Controllers', Priority::LOW); + // Add the default route + $router->addRoute('(?P.*?)(| (?P.*?)(| (?P.*?)))', ['category' => 'cli', 'viewType' => 'cli']); + // Load the commandProcessor $processor = new CommandProcessor(); Events::addListener([$processor, 'routerCallViewEventListener'], 'routerCallViewEvent', Priority::HIGHEST); diff --git a/src/FuzeWorks/CLI/CommandProcessor.php b/src/FuzeWorks/CLI/CommandProcessor.php index bb93066..e0236ee 100644 --- a/src/FuzeWorks/CLI/CommandProcessor.php +++ b/src/FuzeWorks/CLI/CommandProcessor.php @@ -91,13 +91,7 @@ class CommandProcessor $logCount = count(Logger::$logs); try { - $this->router->route( - $commandString, [3 => - [ - '(?P.*?)(| (?P.*?)(| (?P.*?)))' => ['viewType' => 'cli'] - ] - ] - ); + $this->router->route($commandString, 'cli'); } catch (NotFoundException $e) { $this->output->warningOut("Requested command '$parts[0]' was not found."); } catch (RouterException $e) { @@ -115,19 +109,6 @@ class CommandProcessor $this->parseLogs($logs, $verbose); } - /** - * The callable that is used to pick the correct view and controller - * - * @internal - * @param array $matches - * @param array $routeData - * @param string $route - */ - public function cliCallable(array $matches, array $routeData, string $route) - { - dump($this->options); - } - /** * Processes a commandString and extracts options from it *