1
0
Fork 0

Add info about conf file loading to debug output

pull/2932/merge
Jordi Boggiano 2014-05-31 16:50:33 +02:00
parent 615402c861
commit 959cc4d63c
3 changed files with 17 additions and 5 deletions

View File

@ -103,7 +103,7 @@ EOT
throw new \RuntimeException('--file and --global can not be combined');
}
$this->config = Factory::createConfig();
$this->config = Factory::createConfig($this->getIO());
// Get the local composer.json, global config.json, or if the user
// passed in a file to use

View File

@ -83,7 +83,7 @@ class Factory
/**
* @return Config
*/
public static function createConfig()
public static function createConfig(IOInterface $io = null)
{
// determine home and cache dirs
$home = self::getHomeDir();
@ -109,6 +109,9 @@ class Factory
// load global config
$file = new JsonFile($home.'/config.json');
if ($file->exists()) {
if ($io && $io->isDebug()) {
$io->write('Loading config file ' . $file->getPath());
}
$config->merge($file->read());
}
$config->setConfigSource(new JsonConfigSource($file));
@ -116,6 +119,9 @@ class Factory
// load global auth file
$file = new JsonFile($config->get('home').'/auth.json');
if ($file->exists()) {
if ($io && $io->isDebug()) {
$io->write('Loading config file ' . $file->getPath());
}
$config->merge(array('config' => $file->read()));
}
$config->setAuthConfigSource(new JsonConfigSource($file, true));
@ -173,7 +179,7 @@ class Factory
$repos = array();
if (!$config) {
$config = static::createConfig();
$config = static::createConfig($io);
}
if (!$rm) {
if (!$io) {
@ -237,11 +243,17 @@ class Factory
}
// Load config and override with local config/auth config
$config = static::createConfig();
$config = static::createConfig($io);
$config->merge($localConfig);
if (isset($composerFile)) {
if ($io && $io->isDebug()) {
$io->write('Loading config file ' . $composerFile);
}
$localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json');
if ($localAuthFile->exists()) {
if ($io && $io->isDebug()) {
$io->write('Loading config file ' . $localAuthFile->getPath());
}
$config->merge(array('config' => $localAuthFile->read()));
$config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
}

View File

@ -21,7 +21,7 @@ use Composer\IO\IOInterface;
class FactoryMock extends Factory
{
public static function createConfig()
public static function createConfig(IOInterface $io = null)
{
$config = new Config();