Merge pull request #4638 from realshadow/configurable_repository
Allows repositories to implement ConfigurableRepositoryInterfacepull/4647/head
commit
45a3db8877
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue