1
0
Fork 0

Fail if no repository was found

pull/4422/head
Dennis Birkholz 2015-09-15 18:28:17 +02:00
parent e4435790a4
commit c06edd61e4
1 changed files with 7 additions and 0 deletions

View File

@ -101,12 +101,15 @@ class PathRepository extends ArrayRepository
{ {
parent::initialize(); parent::initialize();
$foundPackage = false;
foreach ($this->getPaths() as $path) { foreach ($this->getPaths() as $path) {
$composerFilePath = $path.'composer.json'; $composerFilePath = $path.'composer.json';
if (!file_exists($composerFilePath)) { if (!file_exists($composerFilePath)) {
continue; continue;
} }
$foundPackage = true;
$json = file_get_contents($composerFilePath); $json = file_get_contents($composerFilePath);
$package = JsonFile::parseJson($json, $composerFilePath); $package = JsonFile::parseJson($json, $composerFilePath);
$package['dist'] = array( $package['dist'] = array(
@ -125,6 +128,10 @@ class PathRepository extends ArrayRepository
$package = $this->loader->load($package); $package = $this->loader->load($package);
$this->addPackage($package); $this->addPackage($package);
} }
if (!$foundPackage) {
throw new \RuntimeException(sprintf('No `composer.json` file found in any path repository in "%s"', $this->url));
}
} }
/** /**