1
0
Fork 0

Repository options must be replicated on package when dist file is under

repository base dir
pull/2189/head
Luís Otávio Cobucci Oblonczyk 2013-08-19 04:40:54 -03:00
parent 8630aab93f
commit 0b77a59af6
1 changed files with 21 additions and 0 deletions

View File

@ -13,6 +13,7 @@
namespace Composer\Repository; namespace Composer\Repository;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Package;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
@ -204,10 +205,19 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
$package = $package->getAliasOf(); $package = $package->getAliasOf();
} }
$package->setRepository($this); $package->setRepository($this);
$this->configurePackageOptions($package);
return $package; return $package;
} }
protected function configurePackageOptions(PackageInterface $package)
{
if ($package instanceof Package
&& strpos($package->getDistUrl(), $this->baseUrl) === 0) {
$package->setOptions($this->options);
}
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -376,6 +386,17 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
} }
} }
/**
* Adds a new package to the repository
*
* @param PackageInterface $package
*/
public function addPackage(PackageInterface $package)
{
parent::addPackage($package);
$this->configurePackageOptions($package);
}
protected function loadRootServerFile() protected function loadRootServerFile()
{ {
if (null !== $this->rootData) { if (null !== $this->rootData) {