Skip to content
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

fix(download): 修复download插件不存在 #5

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Command/DownloadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ class DownloadCommand extends AbstractCommand
public function __invoke(): int
{
$identifier = $this->input->getArgument('identifier');
[$space, $identifier] = explode('/', $identifier);
$version = $this->input->getArgument('version');
$appStoreService = ApplicationContext::getContainer()->get(AppStoreService::class);
$appStoreService->download($space, $identifier, $version);
$appStoreService->download($identifier, $version);
$this->output->success('Plugin Downloaded Successfully');
return AbstractCommand::SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Service/AppStoreService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function request(string $uri, array $data = []): array;
/**
* Download the specified plug-in to a local directory.
*/
public function download(string $space, string $identifier, string $version): bool;
public function download(string $identifier, string $version): bool;

/**
* Get the details of the specified plugin.
Expand Down
4 changes: 2 additions & 2 deletions src/Service/Impl/AppStoreServiceImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ public function getOtherApp(string $username): array
/**
* Download the specified plug-in to a local directory.
*/
public function download(string $space, string $identifier, string $version): bool
public function download(string $identifier, string $version): bool
{
$localPluginPath = Plugin::PLUGIN_PATH . DIRECTORY_SEPARATOR . $identifier;
if (file_exists($localPluginPath)) {
throw new \RuntimeException(sprintf('The plugin %s already exists', $identifier));
}

$originData = $this->request(__FUNCTION__, [
'identifier' => $space . '/' . $identifier,
'identifier' => $identifier,
'version' => $version,
]);
$downloadResponse = Collection::make($originData);
Expand Down
Loading