Import latest app updates from streamline

An updated set of source files and initialization was provided by streamline to
address issues observed during initial testing. These files have been updated in
order to generate a new set of app images.
This commit is contained in:
2024-04-11 11:16:51 -07:00
parent cb4c6b4c1a
commit 4a89356390
10435 changed files with 107737 additions and 1220538 deletions
@@ -1,148 +0,0 @@
<?php
namespace Nwidart\Modules\Commands;
use Illuminate\Console\Command;
use Nwidart\Modules\Json;
use Nwidart\Modules\Process\Installer;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
class InstallCommand extends Command
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'module:install';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Install the specified module by given package name (vendor/name).';
/**
* Create a new command instance.
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle(): int
{
if (is_null($this->argument('name'))) {
return $this->installFromFile();
}
$this->install(
$this->argument('name'),
$this->argument('version'),
$this->option('type'),
$this->option('tree')
);
return 0;
}
/**
* Install modules from modules.json file.
*/
protected function installFromFile(): int
{
if (!file_exists($path = base_path('modules.json'))) {
$this->error("File 'modules.json' does not exist in your project root.");
return E_ERROR;
}
$modules = Json::make($path);
$dependencies = $modules->get('require', []);
foreach ($dependencies as $module) {
$module = collect($module);
$this->install(
$module->get('name'),
$module->get('version'),
$module->get('type')
);
}
return 0;
}
/**
* Install the specified module.
*
* @param string $name
* @param string $version
* @param string $type
* @param bool $tree
*/
protected function install($name, $version = 'dev-master', $type = 'composer', $tree = false)
{
$installer = new Installer(
$name,
$version,
$type ?: $this->option('type'),
$tree ?: $this->option('tree')
);
$installer->setRepository($this->laravel['modules']);
$installer->setConsole($this);
if ($timeout = $this->option('timeout')) {
$installer->setTimeout($timeout);
}
if ($path = $this->option('path')) {
$installer->setPath($path);
}
$installer->run();
if (!$this->option('no-update')) {
$this->call('module:update', [
'module' => $installer->getModuleName(),
]);
}
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return [
['name', InputArgument::OPTIONAL, 'The name of module will be installed.'],
['version', InputArgument::OPTIONAL, 'The version of module will be installed.'],
];
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return [
['timeout', null, InputOption::VALUE_OPTIONAL, 'The process timeout.', null],
['path', null, InputOption::VALUE_OPTIONAL, 'The installation path.', null],
['type', null, InputOption::VALUE_OPTIONAL, 'The type of installation.', null],
['tree', null, InputOption::VALUE_NONE, 'Install the module as a git subtree', null],
['no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.', null],
];
}
}