Move all logic within try/catch to prevent an incorrect version from blowing up the whole package
parent
28941f169b
commit
c454d93a20
|
@ -34,7 +34,7 @@ class VcsRepository extends ArrayRepository
|
|||
protected $versionParser;
|
||||
protected $type;
|
||||
|
||||
public function __construct(array $repoConfig, IOInterface $io, Config $config = null, array $drivers = null)
|
||||
public function __construct(array $repoConfig, IOInterface $io, Config $config, array $drivers = null)
|
||||
{
|
||||
$this->drivers = $drivers ?: array(
|
||||
'github' => 'Composer\Repository\Vcs\GitHubDriver',
|
||||
|
@ -104,7 +104,7 @@ class VcsRepository extends ArrayRepository
|
|||
}
|
||||
|
||||
foreach ($driver->getTags() as $tag => $identifier) {
|
||||
$msg = 'Get composer info for <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
|
||||
$msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
|
||||
if ($verbose) {
|
||||
$this->io->write($msg);
|
||||
} else {
|
||||
|
@ -125,12 +125,6 @@ class VcsRepository extends ArrayRepository
|
|||
}
|
||||
continue;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
if ($verbose) {
|
||||
$this->io->write('Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// manually versioned package
|
||||
if (isset($data['version'])) {
|
||||
|
@ -158,12 +152,18 @@ class VcsRepository extends ArrayRepository
|
|||
}
|
||||
|
||||
$this->addPackage($loader->load($this->preProcess($driver, $data, $identifier)));
|
||||
} catch (\Exception $e) {
|
||||
if ($verbose) {
|
||||
$this->io->write('Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$this->io->overwrite('', false);
|
||||
|
||||
foreach ($driver->getBranches() as $branch => $identifier) {
|
||||
$msg = 'Get composer info for <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
|
||||
$msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
|
||||
if ($verbose) {
|
||||
$this->io->write($msg);
|
||||
} else {
|
||||
|
@ -184,15 +184,6 @@ class VcsRepository extends ArrayRepository
|
|||
}
|
||||
continue;
|
||||
}
|
||||
} catch (TransportException $e) {
|
||||
if ($verbose) {
|
||||
$this->io->write('Skipped branch '.$branch.', no composer file was found');
|
||||
}
|
||||
continue;
|
||||
} catch (\Exception $e) {
|
||||
$this->io->write('Skipped branch '.$branch.', '.$e->getMessage());
|
||||
continue;
|
||||
}
|
||||
|
||||
// branches are always auto-versionned, read value from branch name
|
||||
$data['version'] = $branch;
|
||||
|
@ -210,6 +201,15 @@ class VcsRepository extends ArrayRepository
|
|||
}
|
||||
|
||||
$this->addPackage($loader->load($this->preProcess($driver, $data, $identifier)));
|
||||
} catch (TransportException $e) {
|
||||
if ($verbose) {
|
||||
$this->io->write('Skipped branch '.$branch.', no composer file was found');
|
||||
}
|
||||
continue;
|
||||
} catch (\Exception $e) {
|
||||
$this->io->write('Skipped branch '.$branch.', '.$e->getMessage());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$this->io->overwrite('', false);
|
||||
|
|
Loading…
Reference in New Issue