Rename options to transport-options, refs #2189
parent
31092843fd
commit
32cd883daa
|
@ -118,7 +118,7 @@ class FileDownloader implements DownloaderInterface
|
||||||
$retries = 3;
|
$retries = 3;
|
||||||
while ($retries--) {
|
while ($retries--) {
|
||||||
try {
|
try {
|
||||||
$rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getOptions());
|
$rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
|
||||||
break;
|
break;
|
||||||
} catch (TransportException $e) {
|
} catch (TransportException $e) {
|
||||||
// if we got an http response with a proper code, then requesting again will probably not help, abort
|
// if we got an http response with a proper code, then requesting again will probably not help, abort
|
||||||
|
|
|
@ -49,7 +49,7 @@ abstract class BasePackage implements PackageInterface
|
||||||
|
|
||||||
protected $repository;
|
protected $repository;
|
||||||
protected $id;
|
protected $id;
|
||||||
protected $options;
|
protected $transportOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All descendants' constructors should call this parent constructor
|
* All descendants' constructors should call this parent constructor
|
||||||
|
@ -61,7 +61,7 @@ abstract class BasePackage implements PackageInterface
|
||||||
$this->prettyName = $name;
|
$this->prettyName = $name;
|
||||||
$this->name = strtolower($name);
|
$this->name = strtolower($name);
|
||||||
$this->id = -1;
|
$this->id = -1;
|
||||||
$this->options = array();
|
$this->transportOptions = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,17 +138,19 @@ abstract class BasePackage implements PackageInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public function getOptions()
|
public function getTransportOptions()
|
||||||
{
|
{
|
||||||
return $this->options;
|
return $this->transportOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* Configures the list of options to download package dist files
|
||||||
|
*
|
||||||
|
* @param array $options
|
||||||
*/
|
*/
|
||||||
public function setOptions(array $options)
|
public function setTransportOptions(array $options)
|
||||||
{
|
{
|
||||||
$this->options = $options;
|
$this->transportOptions = $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -108,8 +108,8 @@ class ArrayDumper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($package->getOptions()) > 0) {
|
if (count($package->getTransportOptions()) > 0) {
|
||||||
$data['options'] = $package->getOptions();
|
$data['transport-options'] = $package->getTransportOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|
|
@ -199,8 +199,8 @@ class ArrayLoader implements LoaderInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->loadOptions && isset($config['options'])) {
|
if ($this->loadOptions && isset($config['transport-options'])) {
|
||||||
$package->setOptions($config['options']);
|
$package->setTransportOptions($config['transport-options']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $package;
|
return $package;
|
||||||
|
|
|
@ -230,7 +230,7 @@ class ValidatingArrayLoader implements LoaderInterface
|
||||||
// TODO validate package repositories' packages using this recursively
|
// TODO validate package repositories' packages using this recursively
|
||||||
|
|
||||||
$this->validateFlatArray('include-path');
|
$this->validateFlatArray('include-path');
|
||||||
$this->validateArray('options');
|
$this->validateArray('transport-options');
|
||||||
|
|
||||||
// branch alias validation
|
// branch alias validation
|
||||||
if (isset($this->config['extra']['branch-alias'])) {
|
if (isset($this->config['extra']['branch-alias'])) {
|
||||||
|
|
|
@ -314,17 +314,10 @@ interface PackageInterface
|
||||||
*/
|
*/
|
||||||
public function getArchiveExcludes();
|
public function getArchiveExcludes();
|
||||||
|
|
||||||
/**
|
|
||||||
* Configures the list of options to download package dist files
|
|
||||||
*
|
|
||||||
* @param array $options
|
|
||||||
*/
|
|
||||||
public function setOptions(array $options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of options to download package dist files
|
* Returns a list of options to download package dist files
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getOptions();
|
public function getTransportOptions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
|
||||||
{
|
{
|
||||||
if ($package instanceof Package
|
if ($package instanceof Package
|
||||||
&& strpos($package->getDistUrl(), $this->baseUrl) === 0) {
|
&& strpos($package->getDistUrl(), $this->baseUrl) === 0) {
|
||||||
$package->setOptions($this->options);
|
$package->setTransportOptions($this->options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
->will($this->returnValue('http://example.com/script.js'))
|
->will($this->returnValue('http://example.com/script.js'))
|
||||||
;
|
;
|
||||||
$packageMock->expects($this->atLeastOnce())
|
$packageMock->expects($this->atLeastOnce())
|
||||||
->method('getOptions')
|
->method('getTransportOptions')
|
||||||
->will($this->returnValue(array()))
|
->will($this->returnValue(array()))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
->will($this->returnValue('http://example.com/script.js'))
|
->will($this->returnValue('http://example.com/script.js'))
|
||||||
;
|
;
|
||||||
$packageMock->expects($this->atLeastOnce())
|
$packageMock->expects($this->atLeastOnce())
|
||||||
->method('getOptions')
|
->method('getTransportOptions')
|
||||||
->will($this->returnValue(array()))
|
->will($this->returnValue(array()))
|
||||||
;
|
;
|
||||||
$packageMock->expects($this->any())
|
$packageMock->expects($this->any())
|
||||||
|
|
|
@ -31,7 +31,7 @@ class ZipDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
->will($this->returnValue('file://'.__FILE__))
|
->will($this->returnValue('file://'.__FILE__))
|
||||||
;
|
;
|
||||||
$packageMock->expects($this->atLeastOnce())
|
$packageMock->expects($this->atLeastOnce())
|
||||||
->method('getOptions')
|
->method('getTransportOptions')
|
||||||
->will($this->returnValue(array()))
|
->will($this->returnValue(array()))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -196,8 +196,9 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
||||||
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'options',
|
'transport-options',
|
||||||
array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
|
array('ssl' => array('local_cert' => '/opt/certs/test.pem')),
|
||||||
|
'transportOptions'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
'archive' => array(
|
'archive' => array(
|
||||||
'exclude' => array('/foo/bar', 'baz', '!/foo/bar/baz'),
|
'exclude' => array('/foo/bar', 'baz', '!/foo/bar/baz'),
|
||||||
),
|
),
|
||||||
'options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
|
'transport-options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
|
||||||
);
|
);
|
||||||
|
|
||||||
$package = $this->loader->load($config);
|
$package = $this->loader->load($config);
|
||||||
|
|
|
@ -146,7 +146,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
'bin/foo',
|
'bin/foo',
|
||||||
'bin/bar',
|
'bin/bar',
|
||||||
),
|
),
|
||||||
'options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
|
'transport-options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array( // test as array
|
array( // test as array
|
||||||
|
@ -267,10 +267,10 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'name' => 'foo/bar',
|
'name' => 'foo/bar',
|
||||||
'options' => 'test',
|
'transport-options' => 'test',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'options : should be an array, string given'
|
'transport-options : should be an array, string given'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue