Only create the root file empty and error out on missing local files
parent
5cb9a6ead7
commit
a4e5f000d5
|
@ -99,13 +99,15 @@ EOT
|
||||||
: $input->getOption('file');
|
: $input->getOption('file');
|
||||||
|
|
||||||
$this->configFile = new JsonFile($this->configFile);
|
$this->configFile = new JsonFile($this->configFile);
|
||||||
if (!$this->configFile->exists()) {
|
|
||||||
|
// initialize the global file if it's not there
|
||||||
|
if ($input->getOption('global') && !$this->configFile->exists()) {
|
||||||
touch($this->configFile->getPath());
|
touch($this->configFile->getPath());
|
||||||
// If you read an empty file, Composer throws an error
|
$this->configFile->write(array('config' => new \ArrayObject));
|
||||||
// Toss some of the defaults in there
|
}
|
||||||
$defaults = Config::$defaultConfig;
|
|
||||||
$defaults['repositories'] = Config::$defaultRepositories;
|
if (!$this->configFile->exists()) {
|
||||||
$this->configFile->write($defaults);
|
throw new \RuntimeException('No composer.json found in the current directory');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue