Add hint in create-project when it fails due to a missing allow-plugins in project, refs #10928
parent
0e59fbb46e
commit
336a0d20c6
|
@ -26,6 +26,7 @@ use Composer\DependencyResolver\Operation\InstallOperation;
|
|||
use Composer\Package\Version\VersionSelector;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Pcre\Preg;
|
||||
use Composer\Plugin\PluginBlockedException;
|
||||
use Composer\Repository\RepositoryFactory;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
|
@ -268,10 +269,16 @@ EOT
|
|||
$installer->disablePlugins();
|
||||
}
|
||||
|
||||
try {
|
||||
$status = $installer->run();
|
||||
if (0 !== $status) {
|
||||
return $status;
|
||||
}
|
||||
} catch (PluginBlockedException $e) {
|
||||
$io->writeError('<error>Hint: To allow running the config command recommended below before dependencies are installed, run create-project with --no-install.</error>');
|
||||
$io->writeError('<error>You can then cd into '.getcwd().', configure allow-plugins, and finally run a composer install to complete the process.</error>');
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$hasVcs = $installedFromVcs;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Plugin;
|
||||
|
||||
use UnexpectedValueException;
|
||||
|
||||
class PluginBlockedException extends UnexpectedValueException
|
||||
{
|
||||
}
|
|
@ -765,7 +765,7 @@ class PluginManager
|
|||
}
|
||||
}
|
||||
|
||||
throw new \UnexpectedValueException(
|
||||
throw new PluginBlockedException(
|
||||
$package.($isGlobalPlugin ? ' (installed globally)' : '').' contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe.'.PHP_EOL.
|
||||
'You can run "composer '.($isGlobalPlugin ? 'global ' : '').'config --no-plugins allow-plugins.'.$package.' [true|false]" to enable it (true) or disable it explicitly and suppress this exception (false)'.PHP_EOL.
|
||||
'See https://getcomposer.org/allow-plugins'
|
||||
|
|
Loading…
Reference in New Issue