mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Added improvements to composer commands
This commit is contained in:
parent
5d5dca2e4b
commit
a65a6260d1
@ -3,6 +3,7 @@
|
||||
namespace System\Classes\Packager;
|
||||
|
||||
use System\Classes\Packager\Commands\RemoveCommand;
|
||||
use System\Classes\Packager\Commands\SearchCommand;
|
||||
use System\Classes\Packager\Commands\ShowCommand;
|
||||
use System\Classes\Packager\Commands\UpdateCommand;
|
||||
use System\Classes\Packager\Commands\RequireCommand;
|
||||
@ -34,10 +35,11 @@ class Composer
|
||||
static::$composer = new PackagerComposer();
|
||||
static::$composer->setWorkDir(base_path());
|
||||
|
||||
static::$composer->setCommand('show', new ShowCommand(static::$composer));
|
||||
static::$composer->setCommand('update', new UpdateCommand(static::$composer));
|
||||
static::$composer->setCommand('remove', new RemoveCommand(static::$composer));
|
||||
static::$composer->setCommand('require', new RequireCommand(static::$composer));
|
||||
static::$composer->setCommand('search', new SearchCommand(static::$composer));
|
||||
static::$composer->setCommand('show', new ShowCommand(static::$composer));
|
||||
static::$composer->setCommand('update', new UpdateCommand(static::$composer));
|
||||
|
||||
return static::$composer;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace System\Classes\Packager\Commands;
|
||||
|
||||
use Cache;
|
||||
use System\Classes\Packager\ComposerFactory;
|
||||
use System\Classes\Packager\Composer;
|
||||
use Winter\Packager\Commands\BaseCommand;
|
||||
use Winter\Packager\Exceptions\CommandException;
|
||||
|
||||
@ -55,7 +55,7 @@ class RemoveCommand extends BaseCommand
|
||||
throw new CommandException($message);
|
||||
}
|
||||
|
||||
Cache::forget(ComposerFactory::COMPOSER_CACHE_KEY);
|
||||
Cache::forget(Composer::COMPOSER_CACHE_KEY);
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace System\Classes\Packager\Commands;
|
||||
|
||||
use Cache;
|
||||
use System\Classes\Packager\ComposerFactory;
|
||||
use System\Classes\Packager\Composer;
|
||||
use Winter\Packager\Commands\BaseCommand;
|
||||
use Winter\Packager\Exceptions\CommandException;
|
||||
|
||||
@ -62,7 +62,7 @@ class RequireCommand extends BaseCommand
|
||||
throw new CommandException($message);
|
||||
}
|
||||
|
||||
Cache::forget(ComposerFactory::COMPOSER_CACHE_KEY);
|
||||
Cache::forget(Composer::COMPOSER_CACHE_KEY);
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
23
modules/system/classes/packager/commands/SearchCommand.php
Normal file
23
modules/system/classes/packager/commands/SearchCommand.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace System\Classes\Packager\Commands;
|
||||
|
||||
use Cache;
|
||||
use Winter\Packager\Commands\Search;
|
||||
use Winter\Packager\Exceptions\CommandException;
|
||||
|
||||
class SearchCommand extends Search
|
||||
{
|
||||
public function execute()
|
||||
{
|
||||
$output = $this->runComposerCommand();
|
||||
|
||||
if ($output['code'] !== 0) {
|
||||
throw new CommandException(implode(PHP_EOL, $output['output']));
|
||||
}
|
||||
|
||||
$this->results = json_decode(implode(PHP_EOL, $output['output']), true) ?? [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
namespace System\Classes\Packager\Commands;
|
||||
|
||||
use Cache;
|
||||
use System\Classes\Packager\ComposerFactory;
|
||||
use System\Classes\Packager\Composer;
|
||||
use Winter\Packager\Commands\Update;
|
||||
|
||||
class UpdateCommand extends Update
|
||||
@ -82,7 +82,7 @@ class UpdateCommand extends Update
|
||||
|
||||
public function execute()
|
||||
{
|
||||
Cache::forget(ComposerFactory::COMPOSER_CACHE_KEY);
|
||||
Cache::forget(Composer::COMPOSER_CACHE_KEY);
|
||||
return parent::execute();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user