|
@@ -12,6 +12,7 @@
|
|
|
|
|
|
namespace Composer\Command;
|
|
namespace Composer\Command;
|
|
|
|
|
|
|
|
+use Composer\Util\Silencer;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
@@ -142,7 +143,7 @@ EOT
|
|
? ($this->config->get('home') . '/config.json')
|
|
? ($this->config->get('home') . '/config.json')
|
|
: ($input->getOption('file') ?: trim(getenv('COMPOSER')) ?: 'composer.json');
|
|
: ($input->getOption('file') ?: trim(getenv('COMPOSER')) ?: 'composer.json');
|
|
|
|
|
|
- // create global composer.json if this was invoked using `composer global config`
|
|
|
|
|
|
+ // Create global composer.json if this was invoked using `composer global config`
|
|
if ($configFile === 'composer.json' && !file_exists($configFile) && realpath(getcwd()) === realpath($this->config->get('home'))) {
|
|
if ($configFile === 'composer.json' && !file_exists($configFile) && realpath(getcwd()) === realpath($this->config->get('home'))) {
|
|
file_put_contents($configFile, "{\n}\n");
|
|
file_put_contents($configFile, "{\n}\n");
|
|
}
|
|
}
|
|
@@ -157,17 +158,19 @@ EOT
|
|
$this->authConfigFile = new JsonFile($authConfigFile, null, $io);
|
|
$this->authConfigFile = new JsonFile($authConfigFile, null, $io);
|
|
$this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
|
|
$this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
|
|
|
|
|
|
- // initialize the global file if it's not there
|
|
|
|
|
|
+ // Initialize the global file if it's not there, ignoring any warnings or notices
|
|
|
|
+ Silencer::suppress();
|
|
if ($input->getOption('global') && !$this->configFile->exists()) {
|
|
if ($input->getOption('global') && !$this->configFile->exists()) {
|
|
touch($this->configFile->getPath());
|
|
touch($this->configFile->getPath());
|
|
$this->configFile->write(array('config' => new \ArrayObject));
|
|
$this->configFile->write(array('config' => new \ArrayObject));
|
|
- @chmod($this->configFile->getPath(), 0600);
|
|
|
|
|
|
+ chmod($this->configFile->getPath(), 0600);
|
|
}
|
|
}
|
|
if ($input->getOption('global') && !$this->authConfigFile->exists()) {
|
|
if ($input->getOption('global') && !$this->authConfigFile->exists()) {
|
|
touch($this->authConfigFile->getPath());
|
|
touch($this->authConfigFile->getPath());
|
|
$this->authConfigFile->write(array('http-basic' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject));
|
|
$this->authConfigFile->write(array('http-basic' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject));
|
|
- @chmod($this->authConfigFile->getPath(), 0600);
|
|
|
|
|
|
+ chmod($this->authConfigFile->getPath(), 0600);
|
|
}
|
|
}
|
|
|
|
+ Silencer::restore();
|
|
|
|
|
|
if (!$this->configFile->exists()) {
|
|
if (!$this->configFile->exists()) {
|
|
throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
|
|
throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
|