Skip to content
Snippets Groups Projects

Issue #3331663: If the update:lightning command can't find composer.json, the exception should mention the --composer-file option

Merged Issue #3331663: If the update:lightning command can't find composer.json, the exception should mention the --composer-file option

Files

@@ -153,10 +153,10 @@ class LightningCoreCommands extends DrushCommands {
* Lightning components' dependenices to the project's `composer.json`.
*
* @option upgrade Move Lightning components' dependencies to the project's composer.json.
* @option composer-file The absolute path to the project's composer.json.
* @option file The absolute path to the project's composer.json.
* @option commands-only Display the Composer commands to run, instead of modifying composer.json.
*/
public function update(array $options = ['upgrade' => FALSE, 'composer-file' => NULL, 'commands-only' => FALSE]) {
public function update(array $options = ['upgrade' => FALSE, 'file' => NULL, 'commands-only' => FALSE]) {
$io = $this->io();
$io->warning("This command is removed from Lightning Core 6. See https://www.drupal.org/node/3303698 for more information.");
@@ -170,19 +170,19 @@ class LightningCoreCommands extends DrushCommands {
throw new \RuntimeException("Database updates have not yet been run. Please run them and try again.");
}
if ($options['composer-file']) {
$file = $options['composer-file'];
if ($options['file']) {
$file = $options['file'];
}
else {
$file = Drush::bootstrapManager()->getComposerRoot() . DIRECTORY_SEPARATOR . 'composer.json';
}
if (!file_exists($file)) {
throw new \RuntimeException("The composer.json file for the project ($file) does not appear to exist.");
throw new \RuntimeException("The composer.json file for the project ($file) was not found. Please specify its absolute path with the --file option.");
}
// Fall back to read-only mode if composer.json isn't writable.
if (empty($options['commands-only'])) {
$io->writeln("Moving Lightning components' dependencies to $file...");
$io->block("Moving Lightning components' dependencies to $file...");
if (!is_writable($file)) {
$options['commands-only'] = TRUE;
Loading