Merge remote-tracking branch 'Dzhuneyt/6650-disable-cache-argument'

main
Jordi Boggiano 6 years ago
commit 61bd9f83f1

@ -15,6 +15,7 @@ namespace Composer\Command;
use Composer\Installer;
use Composer\Plugin\CommandEvent;
use Composer\Plugin\PluginEvents;
use Composer\Util\Platform;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
@ -40,6 +41,7 @@ class InstallCommand extends BaseCommand
new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
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-cache', null, InputOption::VALUE_NONE, 'Do not use the cache directory'),
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
@ -93,6 +95,18 @@ EOT
$install = Installer::create($io, $composer);
$config = $composer->getConfig();
if ($input->getOption('no-cache')) {
$io->write('Skipping cache directory');
$config->merge(
array(
'config' => array(
'cache-dir' => Platform::isWindows() ? 'nul' : '/dev/null',
)
)
);
}
list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
$optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');

@ -17,6 +17,7 @@ use Composer\Installer;
use Composer\IO\IOInterface;
use Composer\Plugin\CommandEvent;
use Composer\Plugin\PluginEvents;
use Composer\Util\Platform;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@ -44,6 +45,7 @@ class UpdateCommand extends BaseCommand
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('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
new InputOption('no-cache', null, InputOption::VALUE_NONE, 'Do not use the cache directory'),
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
@ -128,6 +130,18 @@ EOT
$install = Installer::create($io, $composer);
$config = $composer->getConfig();
if ($input->getOption('no-cache')) {
$io->write('Skipping cache directory');
$config->merge(
array(
'config' => array(
'cache-dir' => Platform::isWindows() ? 'nul' : '/dev/null',
)
)
);
}
list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
$optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');

Loading…
Cancel
Save