1
0
Fork 0

Allows repositories to implement ConfigurableRepositoryInterface and thus provide getRepoConfigmethod

pull/4638/head
Lukáš Homza 2015-11-23 23:18:24 +01:00
parent 9e9c1917e1
commit 5b748eda6c
6 changed files with 60 additions and 5 deletions

View File

@ -20,12 +20,13 @@ use Composer\Package\Loader\LoaderInterface;
/**
* @author Serge Smertin <serg.smertin@gmail.com>
*/
class ArtifactRepository extends ArrayRepository
class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
{
/** @var LoaderInterface */
protected $loader;
protected $lookup;
protected $repoConfig;
public function __construct(array $repoConfig, IOInterface $io)
{
@ -36,6 +37,12 @@ class ArtifactRepository extends ArrayRepository
$this->loader = new ArrayLoader();
$this->lookup = $repoConfig['url'];
$this->io = $io;
$this->repoConfig = $repoConfig;
}
public function getRepoConfig()
{
return $this->repoConfig;
}
protected function initialize()

View File

@ -31,9 +31,10 @@ use Composer\Semver\Constraint\Constraint;
/**
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class ComposerRepository extends ArrayRepository
class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
{
protected $config;
protected $repoConfig;
protected $options;
protected $url;
protected $baseUrl;
@ -90,6 +91,12 @@ class ComposerRepository extends ArrayRepository
$this->loader = new ArrayLoader();
$this->rfs = new RemoteFilesystem($this->io, $this->config, $this->options);
$this->eventDispatcher = $eventDispatcher;
$this->repoConfig = $repoConfig;
}
public function getRepoConfig()
{
return $this->repoConfig;
}
public function setRootAliases(array $rootAliases)

View File

@ -0,0 +1,23 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Repository;
/**
* Configurable repository interface.
*
* @author Lukas Homza <lukashomz@gmail.com>
*/
interface ConfigurableRepositoryInterface
{
public function getRepoConfig();
}

View File

@ -49,7 +49,7 @@ use Composer\Util\ProcessExecutor;
* @author Samuel Roze <samuel.roze@gmail.com>
* @author Johann Reinke <johann.reinke@gmail.com>
*/
class PathRepository extends ArrayRepository
class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
{
/**
* @var ArrayLoader
@ -66,6 +66,11 @@ class PathRepository extends ArrayRepository
*/
private $url;
/**
* @var array
*/
private $repoConfig;
/**
* @var ProcessExecutor
*/
@ -88,10 +93,16 @@ class PathRepository extends ArrayRepository
$this->url = $repoConfig['url'];
$this->process = new ProcessExecutor($io);
$this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
$this->repoConfig = $repoConfig;
parent::__construct();
}
public function getRepoConfig()
{
return $this->repoConfig;
}
/**
* Initializes path repository.
*

View File

@ -32,12 +32,13 @@ use Composer\Config;
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class PearRepository extends ArrayRepository
class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
{
private $url;
private $io;
private $rfs;
private $versionParser;
private $repoConfig;
/** @var string vendor makes additional alias for each channel as {prefix}/{packagename}. It allows smoother
* package transition to composer-like repositories.
@ -60,6 +61,12 @@ class PearRepository extends ArrayRepository
$this->rfs = $rfs ?: new RemoteFilesystem($this->io, $config);
$this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
$this->versionParser = new VersionParser();
$this->repoConfig = $repoConfig;
}
public function getRepoConfig()
{
return $this->repoConfig;
}
protected function initialize()

View File

@ -26,7 +26,7 @@ use Composer\Config;
/**
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class VcsRepository extends ArrayRepository
class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
{
protected $url;
protected $packageName;