1
0
Fork 0

Merge pull request #8772 from villfa/fix/8771

Dispatch POST_STATUS_CMD even when there is no changes
pull/8780/head
Jordi Boggiano 2020-04-13 12:41:02 +02:00 committed by GitHub
commit 19902ba6a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 7 deletions

View File

@ -65,20 +65,37 @@ EOT
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
// init repos
$composer = $this->getComposer(); $composer = $this->getComposer();
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output); $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent); $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
// Dispatch pre-status-command
$composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
$exitCode = $this->doExecute($input, $output);
// Dispatch post-status-command
$composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
return $exitCode;
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
private function doExecute(InputInterface $input, OutputInterface $output)
{
// init repos
$composer = $this->getComposer();
$installedRepo = $composer->getRepositoryManager()->getLocalRepository(); $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
$dm = $composer->getDownloadManager(); $dm = $composer->getDownloadManager();
$im = $composer->getInstallationManager(); $im = $composer->getInstallationManager();
// Dispatch pre-status-command
$composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
$errors = array(); $errors = array();
$io = $this->getIO(); $io = $this->getIO();
$unpushedChanges = array(); $unpushedChanges = array();
@ -206,9 +223,6 @@ EOT
$io->writeError('Use --verbose (-v) to see a list of files'); $io->writeError('Use --verbose (-v) to see a list of files');
} }
// Dispatch post-status-command
$composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0); return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
} }
} }