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 $versionParser;
|
||||||
protected $type;
|
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(
|
$this->drivers = $drivers ?: array(
|
||||||
'github' => 'Composer\Repository\Vcs\GitHubDriver',
|
'github' => 'Composer\Repository\Vcs\GitHubDriver',
|
||||||
|
@ -104,7 +104,7 @@ class VcsRepository extends ArrayRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($driver->getTags() as $tag => $identifier) {
|
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) {
|
if ($verbose) {
|
||||||
$this->io->write($msg);
|
$this->io->write($msg);
|
||||||
} else {
|
} else {
|
||||||
|
@ -125,12 +125,6 @@ class VcsRepository extends ArrayRepository
|
||||||
}
|
}
|
||||||
continue;
|
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
|
// manually versioned package
|
||||||
if (isset($data['version'])) {
|
if (isset($data['version'])) {
|
||||||
|
@ -158,12 +152,18 @@ class VcsRepository extends ArrayRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addPackage($loader->load($this->preProcess($driver, $data, $identifier)));
|
$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);
|
$this->io->overwrite('', false);
|
||||||
|
|
||||||
foreach ($driver->getBranches() as $branch => $identifier) {
|
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) {
|
if ($verbose) {
|
||||||
$this->io->write($msg);
|
$this->io->write($msg);
|
||||||
} else {
|
} else {
|
||||||
|
@ -184,15 +184,6 @@ class VcsRepository extends ArrayRepository
|
||||||
}
|
}
|
||||||
continue;
|
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
|
// branches are always auto-versionned, read value from branch name
|
||||||
$data['version'] = $branch;
|
$data['version'] = $branch;
|
||||||
|
@ -210,6 +201,15 @@ class VcsRepository extends ArrayRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addPackage($loader->load($this->preProcess($driver, $data, $identifier)));
|
$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);
|
$this->io->overwrite('', false);
|
||||||
|
|
Loading…
Reference in New Issue