mirror of
https://github.com/composer/composer
synced 2025-05-11 09:32:55 +00:00
commit
242c58c789
64 changed files with 1435 additions and 465 deletions
|
@ -44,6 +44,7 @@ use Composer\Package\Version\VersionParser;
|
|||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @author Tobias Munk <schmunk@usrbin.de>
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
*/
|
||||
class CreateProjectCommand extends Command
|
||||
{
|
||||
|
@ -62,7 +63,8 @@ class CreateProjectCommand extends Command
|
|||
new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'Pick a different repository url to look for the package.'),
|
||||
new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
|
||||
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
|
||||
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'Whether to disable custom installers.'),
|
||||
new InputOption('no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'),
|
||||
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
|
||||
new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
|
||||
new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
|
||||
new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deletion vcs folder.'),
|
||||
|
@ -116,6 +118,11 @@ EOT
|
|||
$preferDist = $input->getOption('prefer-dist');
|
||||
}
|
||||
|
||||
if ($input->getOption('no-custom-installers')) {
|
||||
$output->writeln('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
|
||||
$input->setOption('no-plugins', true);
|
||||
}
|
||||
|
||||
return $this->installProject(
|
||||
$this->getIO(),
|
||||
$config,
|
||||
|
@ -127,24 +134,24 @@ EOT
|
|||
$preferDist,
|
||||
!$input->getOption('no-dev'),
|
||||
$input->getOption('repository-url'),
|
||||
$input->getOption('no-custom-installers'),
|
||||
$input->getOption('no-plugins'),
|
||||
$input->getOption('no-scripts'),
|
||||
$input->getOption('keep-vcs'),
|
||||
$input->getOption('no-progress')
|
||||
);
|
||||
}
|
||||
|
||||
public function installProject(IOInterface $io, $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositoryUrl = null, $disableCustomInstallers = false, $noScripts = false, $keepVcs = false, $noProgress = false)
|
||||
public function installProject(IOInterface $io, $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositoryUrl = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false)
|
||||
{
|
||||
$oldCwd = getcwd();
|
||||
|
||||
if ($packageName !== null) {
|
||||
$installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repositoryUrl, $disableCustomInstallers, $noScripts, $keepVcs, $noProgress);
|
||||
$installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repositoryUrl, $disablePlugins, $noScripts, $keepVcs, $noProgress);
|
||||
} else {
|
||||
$installedFromVcs = false;
|
||||
}
|
||||
|
||||
$composer = Factory::create($io);
|
||||
$composer = Factory::create($io, null, $disablePlugins);
|
||||
|
||||
if ($noScripts === false) {
|
||||
// dispatch event
|
||||
|
@ -158,8 +165,8 @@ EOT
|
|||
->setDevMode($installDevPackages)
|
||||
->setRunScripts( ! $noScripts);
|
||||
|
||||
if ($disableCustomInstallers) {
|
||||
$installer->disableCustomInstallers();
|
||||
if ($disablePlugins) {
|
||||
$installer->disablePlugins();
|
||||
}
|
||||
|
||||
if (!$installer->run()) {
|
||||
|
@ -226,7 +233,7 @@ EOT
|
|||
return 0;
|
||||
}
|
||||
|
||||
protected function installRootPackage(IOInterface $io, $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositoryUrl = null, $disableCustomInstallers = false, $noScripts = false, $keepVcs = false, $noProgress = false)
|
||||
protected function installRootPackage(IOInterface $io, $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositoryUrl = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false)
|
||||
{
|
||||
$stability = strtolower($stability);
|
||||
if ($stability === 'rc') {
|
||||
|
@ -285,8 +292,8 @@ EOT
|
|||
|
||||
$io->write('<info>Installing ' . $package->getName() . ' (' . VersionParser::formatVersion($package, false) . ')</info>');
|
||||
|
||||
if ($disableCustomInstallers) {
|
||||
$io->write('<info>Custom installers have been disabled.</info>');
|
||||
if ($disablePlugins) {
|
||||
$io->write('<info>Plugins have been disabled.</info>');
|
||||
}
|
||||
|
||||
if (0 === strpos($package->getPrettyVersion(), 'dev-') && in_array($package->getSourceType(), array('git', 'hg'))) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue