1
0
Fork 0

Merge branch '2.0'

pull/9848/head
Jordi Boggiano 2021-04-20 22:03:18 +02:00
commit 1fd70de32d
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
3 changed files with 16 additions and 14 deletions

View File

@ -155,7 +155,7 @@ Close your current terminal. Test usage with a new terminal:
```sh ```sh
C:\Users\username>composer -V C:\Users\username>composer -V
Composer version 1.0.0 2016-01-10 20:34:53 Composer version 2.0.12 2021-04-01 10:14:59
``` ```
## Using Composer ## Using Composer

View File

@ -178,15 +178,15 @@ Depending on the [script types](#event-names) you will get various event
subclasses containing various getters with relevant data and associated subclasses containing various getters with relevant data and associated
objects: objects:
- Base class: [`Composer\EventDispatcher\Event`](https://getcomposer.org/apidoc/master/Composer/EventDispatcher/Event.html) - Base class: [`Composer\EventDispatcher\Event`](https://github.com/composer/composer/blob/master/src/Composer/EventDispatcher/Event.php)
- Command Events: [`Composer\Script\Event`](https://getcomposer.org/apidoc/master/Composer/Script/Event.html) - Command Events: [`Composer\Script\Event`](https://github.com/composer/composer/blob/master/src/Composer/Script/Event.php)
- Installer Events: [`Composer\Installer\InstallerEvent`](https://getcomposer.org/apidoc/master/Composer/Installer/InstallerEvent.html) - Installer Events: [`Composer\Installer\InstallerEvent`](https://github.com/composer/composer/blob/master/src/Composer/Installer/InstallerEvent.php)
- Package Events: [`Composer\Installer\PackageEvent`](https://getcomposer.org/apidoc/master/Composer/Installer/PackageEvent.html) - Package Events: [`Composer\Installer\PackageEvent`](https://github.com/composer/composer/blob/master/src/Composer/Installer/PackageEvent.php)
- Plugin Events: - Plugin Events:
- init: [`Composer\EventDispatcher\Event`](https://getcomposer.org/apidoc/master/Composer/EventDispatcher/Event.html) - init: [`Composer\EventDispatcher\Event`](https://github.com/composer/composer/blob/master/src/Composer/EventDispatcher/Event.php)
- command: [`Composer\Plugin\CommandEvent`](https://getcomposer.org/apidoc/master/Composer/Plugin/CommandEvent.html) - command: [`Composer\Plugin\CommandEvent`](https://github.com/composer/composer/blob/master/src/Composer/Plugin/CommandEvent.php)
- pre-file-download: [`Composer\Plugin\PreFileDownloadEvent`](https://getcomposer.org/apidoc/master/Composer/Plugin/PreFileDownloadEvent.html) - pre-file-download: [`Composer\Plugin\PreFileDownloadEvent`](https://github.com/composer/composer/blob/master/src/Composer/Plugin/PreFileDownloadEvent.php)
- post-file-download: [`Composer\Plugin\PostFileDownloadEvent`](https://getcomposer.org/apidoc/master/Composer/Plugin/PostFileDownloadEvent.html) - post-file-download: [`Composer\Plugin\PostFileDownloadEvent`](https://github.com/composer/composer/blob/master/src/Composer/Plugin/PostFileDownloadEvent.php)
## Running scripts manually ## Running scripts manually

View File

@ -186,7 +186,7 @@ EOT
$question = 'Would you like to install dependencies now [<comment>yes</comment>]? '; $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question)) { if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question)) {
$this->installDependencies($output); $this->updateDependencies($output);
} }
// --autoload - Show post-install configuration info // --autoload - Show post-install configuration info
@ -963,13 +963,14 @@ EOT
return array_keys(array_slice($similarPackages, 0, 5)); return array_keys(array_slice($similarPackages, 0, 5));
} }
private function installDependencies($output) private function updateDependencies($output)
{ {
try { try {
$installCommand = $this->getApplication()->find('install'); $updateCommand = $this->getApplication()->find('update');
$installCommand->run(new ArrayInput(array()), $output); $this->getApplication()->resetComposer();
$updateCommand->run(new ArrayInput(array()), $output);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.'); $this->getIO()->writeError('Could not update dependencies. Run `composer update` to see more information.');
} }
} }
@ -977,6 +978,7 @@ EOT
{ {
try { try {
$command = $this->getApplication()->find('dump-autoload'); $command = $this->getApplication()->find('dump-autoload');
$this->getApplication()->resetComposer();
$command->run(new ArrayInput(array()), $output); $command->run(new ArrayInput(array()), $output);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->getIO()->writeError('Could not run dump-autoload.'); $this->getIO()->writeError('Could not run dump-autoload.');