-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wip/support uploading packages update manager changes #197
Draft
LukeTowers
wants to merge
7
commits into
develop
Choose a base branch
from
wip/support-uploading-packages-update-manager-changes
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
95d734a
Added event/extension support to base command
jaxwilko 5d60632
Added support for module service provider instances to be bound to th…
jaxwilko 93882da
Migrated code from winter to storm
jaxwilko 407e842
Added local remember function to avoid system cache
jaxwilko 48eddec
Added base methods for modules to inherit
jaxwilko b1d4f06
Added packager to storm deps
jaxwilko 6b03b16
Added identifier and path logic to module provider
jaxwilko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace Winter\Storm\Foundation\Extension; | ||
|
||
interface WinterExtension | ||
{ | ||
public function getPath(): string; | ||
|
||
public function getVersion(): string; | ||
|
||
public function getIdentifier(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
namespace Winter\Storm\Packager\Commands; | ||
|
||
use Illuminate\Support\Facades\Cache; | ||
use System\Classes\Packager\Composer; | ||
use Winter\Packager\Commands\BaseCommand; | ||
use Winter\Packager\Exceptions\CommandException; | ||
use Winter\Packager\Exceptions\WorkDirException; | ||
|
||
class InfoCommand extends BaseCommand | ||
{ | ||
protected ?string $package = null; | ||
|
||
/** | ||
* Command handler. | ||
* | ||
* @param string|null $package | ||
* @param boolean $dryRun | ||
* @param boolean $dev | ||
* @return void | ||
* @throws CommandException | ||
*/ | ||
public function handle(?string $package = null): void | ||
Check failure on line 24 in src/Packager/Commands/InfoCommand.php GitHub Actions / Code Analysis
Check failure on line 24 in src/Packager/Commands/InfoCommand.php GitHub Actions / Code Analysis
|
||
{ | ||
$this->package = $package; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function arguments(): array | ||
{ | ||
$arguments = [ | ||
'--format' => 'json', | ||
]; | ||
|
||
if (!$this->package) { | ||
return $arguments; | ||
} | ||
|
||
$arguments['package'] = $this->package; | ||
|
||
return $arguments; | ||
} | ||
|
||
/** | ||
* @throws CommandException | ||
* @throws WorkDirException | ||
*/ | ||
public function execute(): array | ||
{ | ||
$output = $this->runComposerCommand(); | ||
$message = implode(PHP_EOL, $output['output']); | ||
|
||
if ($output['code'] !== 0) { | ||
throw new CommandException($message); | ||
} | ||
|
||
$result = json_decode($message, JSON_OBJECT_AS_ARRAY); | ||
|
||
return $this->package | ||
? $result ?? [] | ||
: $result['installed'] ?? []; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getCommandName(): string | ||
{ | ||
return 'info'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
namespace Winter\Storm\Packager\Commands; | ||
|
||
use Illuminate\Support\Facades\Cache; | ||
use Winter\Packager\Commands\BaseCommand; | ||
use Winter\Packager\Exceptions\CommandException; | ||
use Winter\Storm\Packager\Composer; | ||
|
||
class RemoveCommand extends BaseCommand | ||
{ | ||
protected ?string $package = null; | ||
protected bool $dryRun = false; | ||
|
||
/** | ||
* Command handler. | ||
* | ||
* @param string|null $package | ||
* @param boolean $dryRun | ||
* @return void | ||
* @throws CommandException | ||
*/ | ||
public function handle(?string $package = null, bool $dryRun = false): void | ||
{ | ||
if (!$package) { | ||
throw new CommandException('Must provide a package'); | ||
} | ||
|
||
$this->package = $package; | ||
$this->dryRun = $dryRun; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function arguments(): array | ||
{ | ||
$arguments = []; | ||
|
||
if ($this->dryRun) { | ||
$arguments['--dry-run'] = true; | ||
} | ||
|
||
$arguments['packages'] = [$this->package]; | ||
|
||
return $arguments; | ||
} | ||
|
||
public function execute() | ||
{ | ||
$output = $this->runComposerCommand(); | ||
$message = implode(PHP_EOL, $output['output']); | ||
|
||
if ($output['code'] !== 0) { | ||
throw new CommandException($message); | ||
} | ||
|
||
Cache::forget(Composer::COMPOSER_CACHE_KEY); | ||
|
||
return $message; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getCommandName(): string | ||
{ | ||
return 'remove'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
namespace Winter\Storm\Packager\Commands; | ||
|
||
use Illuminate\Support\Facades\Cache; | ||
use Winter\Storm\Packager\Composer; | ||
use Winter\Packager\Commands\BaseCommand; | ||
use Winter\Packager\Exceptions\CommandException; | ||
use Winter\Packager\Exceptions\WorkDirException; | ||
|
||
class RequireCommand extends BaseCommand | ||
{ | ||
protected ?string $package = null; | ||
protected bool $dryRun = false; | ||
protected bool $dev = false; | ||
|
||
/** | ||
* Command handler. | ||
* | ||
* @param string|null $package | ||
* @param boolean $dryRun | ||
* @param boolean $dev | ||
* @return void | ||
* @throws CommandException | ||
*/ | ||
public function handle(?string $package = null, bool $dryRun = false, bool $dev = false): void | ||
{ | ||
if (!$package) { | ||
throw new CommandException('Must provide a package'); | ||
} | ||
|
||
$this->package = $package; | ||
$this->dryRun = $dryRun; | ||
$this->dev = $dev; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function arguments(): array | ||
{ | ||
$arguments = []; | ||
|
||
if ($this->dryRun) { | ||
$arguments['--dry-run'] = true; | ||
} | ||
|
||
if ($this->dev) { | ||
$arguments['--dev'] = true; | ||
} | ||
|
||
$arguments['packages'] = [$this->package]; | ||
|
||
return $arguments; | ||
} | ||
|
||
/** | ||
* @throws CommandException | ||
* @throws WorkDirException | ||
*/ | ||
public function execute(): string | ||
{ | ||
$output = $this->runComposerCommand(); | ||
$message = implode(PHP_EOL, $output['output']); | ||
|
||
if ($output['code'] !== 0) { | ||
throw new CommandException($message); | ||
} | ||
|
||
Cache::forget(Composer::COMPOSER_CACHE_KEY); | ||
|
||
return $message; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getCommandName(): string | ||
{ | ||
return 'require'; | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When merging we should probably release v1 of Packager.