1
0
Fork 0

Merge pull request #518 from Seldaek/pear_autoload

Pear autoload support
pull/520/merge
Nils Adermann 2012-04-01 14:02:24 -07:00
commit 8916a51b61
2 changed files with 22 additions and 4 deletions

View File

@ -6,6 +6,7 @@
* Added support for private GitHub and SVN repositories (use --no-interaction for CI) * Added support for private GitHub and SVN repositories (use --no-interaction for CI)
* Added "file" downloader type to download plain files * Added "file" downloader type to download plain files
* Added support for authentication with svn repositories * Added support for authentication with svn repositories
* Added autoload support for PEAR repositories
* Improved clones from GitHub which now automatically select between git/https/http protocols * Improved clones from GitHub which now automatically select between git/https/http protocols
* Improved `validate` command to give more feedback * Improved `validate` command to give more feedback
* Improved the `search` & `show` commands output * Improved the `search` & `show` commands output

View File

@ -120,6 +120,9 @@ class PearRepository extends ArrayRepository
'type' => 'library', 'type' => 'library',
'dist' => array('type' => 'pear', 'url' => $this->url.'/get/'.$packageName.'-'.$pearVersion.".tgz"), 'dist' => array('type' => 'pear', 'url' => $this->url.'/get/'.$packageName.'-'.$pearVersion.".tgz"),
'version' => $pearVersion, 'version' => $pearVersion,
'autoload' => array(
'classmap' => array(''),
),
); );
try { try {
@ -135,7 +138,13 @@ class PearRepository extends ArrayRepository
try { try {
$this->addPackage($loader->load($packageData)); $this->addPackage($loader->load($packageData));
if ($this->io->isVerbose()) {
$this->io->write('Loaded '.$packageData['name'].' '.$packageData['version']);
}
} catch (\UnexpectedValueException $e) { } catch (\UnexpectedValueException $e) {
if ($this->io->isVerbose()) {
$this->io->write('Could not load '.$packageData['name'].' '.$packageData['version'].': '.$e->getMessage());
}
continue; continue;
} }
} }
@ -241,7 +250,10 @@ class PearRepository extends ArrayRepository
$fullName = 'pear-'.$this->channel.'/'.$packageName; $fullName = 'pear-'.$this->channel.'/'.$packageName;
$packageData = array( $packageData = array(
'name' => $fullName, 'name' => $fullName,
'type' => 'library' 'type' => 'library',
'autoload' => array(
'classmap' => array(''),
),
); );
$packageKeys = array('l' => 'license', 'd' => 'description'); $packageKeys = array('l' => 'license', 'd' => 'description');
foreach ($packageKeys as $pear => $composer) { foreach ($packageKeys as $pear => $composer) {
@ -279,11 +291,16 @@ class PearRepository extends ArrayRepository
$releaseData += $depsData[$version]; $releaseData += $depsData[$version];
} }
$package = $packageData + $releaseData;
try { try {
$this->addPackage( $this->addPackage($loader->load($package));
$loader->load($packageData + $releaseData) if ($this->io->isVerbose()) {
); $this->io->write('Loaded '.$package['name'].' '.$package['version']);
}
} catch (\UnexpectedValueException $e) { } catch (\UnexpectedValueException $e) {
if ($this->io->isVerbose()) {
$this->io->write('Could not load '.$package['name'].' '.$package['version'].': '.$e->getMessage());
}
continue; continue;
} }
} }