mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Per request from Jordi Boggiano (Seldaek) making Config 2nd parameter in supports()
This commit is contained in:
parent
93ebfd54b1
commit
e5045ce215
11 changed files with 13 additions and 13 deletions
|
@ -141,7 +141,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public static function supports(IOInterface $io, $url, Config $config, $deep = false)
|
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
||||||
{
|
{
|
||||||
if (!preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
|
if (!preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -212,7 +212,7 @@ class GitDriver extends VcsDriver
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public static function supports(IOInterface $io, $url, Config $config, $deep = false)
|
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
||||||
{
|
{
|
||||||
if (preg_match('#(^git://|\.git$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
|
if (preg_match('#(^git://|\.git$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -232,7 +232,7 @@ class GitHubDriver extends VcsDriver
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public static function supports(IOInterface $io, $url, Config $config, $deep = false)
|
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
||||||
{
|
{
|
||||||
if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git)?$#', $url, $matches)) {
|
if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git)?$#', $url, $matches)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -151,7 +151,7 @@ class HgBitbucketDriver extends VcsDriver
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public static function supports(IOInterface $io, $url, Config $config, $deep = false)
|
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
||||||
{
|
{
|
||||||
if (!preg_match('#^https://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
|
if (!preg_match('#^https://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -190,7 +190,7 @@ class HgDriver extends VcsDriver
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public static function supports(IOInterface $io, $url, Config $config, $deep = false)
|
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
||||||
{
|
{
|
||||||
if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
|
if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -159,7 +159,7 @@ class PerforceDriver extends VcsDriver
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public static function supports(IOInterface $io, $url, Config $config, $deep = false)
|
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
||||||
{
|
{
|
||||||
if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
|
if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
|
||||||
return Perforce::checkServerExists($url, new ProcessExecutor);
|
return Perforce::checkServerExists($url, new ProcessExecutor);
|
||||||
|
|
|
@ -242,7 +242,7 @@ class SvnDriver extends VcsDriver
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public static function supports(IOInterface $io, $url, Config $config, $deep = false)
|
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
||||||
{
|
{
|
||||||
$url = self::normalizeUrl($url);
|
$url = self::normalizeUrl($url);
|
||||||
if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
|
if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
|
||||||
|
|
|
@ -92,10 +92,10 @@ interface VcsDriverInterface
|
||||||
* Checks if this driver can handle a given url
|
* Checks if this driver can handle a given url
|
||||||
*
|
*
|
||||||
* @param IOInterface $io IO instance
|
* @param IOInterface $io IO instance
|
||||||
* @param string $url URL to validate/check
|
|
||||||
* @param Config $config current $config
|
* @param Config $config current $config
|
||||||
|
* @param string $url URL to validate/check
|
||||||
* @param bool $deep unless true, only shallow checks (url matching typically) should be done
|
* @param bool $deep unless true, only shallow checks (url matching typically) should be done
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function supports(IOInterface $io, $url, Config $config, $deep = false);
|
public static function supports(IOInterface $io, Config $config, $url, $deep = false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ class VcsRepository extends ArrayRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->drivers as $driver) {
|
foreach ($this->drivers as $driver) {
|
||||||
if ($driver::supports($this->io, $this->url, $this->config)) {
|
if ($driver::supports($this->io, $this->config, $this->url)) {
|
||||||
$driver = new $driver($this->repoConfig, $this->io, $this->config);
|
$driver = new $driver($this->repoConfig, $this->io, $this->config);
|
||||||
$driver->initialize();
|
$driver->initialize();
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class VcsRepository extends ArrayRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->drivers as $driver) {
|
foreach ($this->drivers as $driver) {
|
||||||
if ($driver::supports($this->io, $this->url, $this->config, true)) {
|
if ($driver::supports($this->io, $this->config, $this->url, true)) {
|
||||||
$driver = new $driver($this->repoConfig, $this->io, $this->config);
|
$driver = new $driver($this->repoConfig, $this->io, $this->config);
|
||||||
$driver->initialize();
|
$driver->initialize();
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,6 @@ class PerforceDriverTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testSupportsReturnsFalseNoDeepCheck()
|
public function testSupportsReturnsFalseNoDeepCheck()
|
||||||
{
|
{
|
||||||
$this->expectOutputString('');
|
$this->expectOutputString('');
|
||||||
$this->assertFalse(PerforceDriver::supports($this->io, 'existing.url', $this->config));
|
$this->assertFalse(PerforceDriver::supports($this->io, $this->config, 'existing.url'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ class SvnDriverTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testSupport($url, $assertion)
|
public function testSupport($url, $assertion)
|
||||||
{
|
{
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
$result = SvnDriver::supports($this->getMock('Composer\IO\IOInterface'), $url, $config);
|
$result = SvnDriver::supports($this->getMock('Composer\IO\IOInterface'), $config, $url);
|
||||||
$this->assertEquals($assertion, $result);
|
$this->assertEquals($assertion, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue