1
0
Fork 0

Show warning if the svn binary is missing

pull/1120/merge
Jordi Boggiano 2012-10-03 11:13:17 +02:00
parent c7a13893c7
commit 4998bab944
2 changed files with 8 additions and 1 deletions

View File

@ -270,6 +270,10 @@ class SvnDriver extends VcsDriver
try { try {
return $this->util->execute($command, $url); return $this->util->execute($command, $url);
} catch (\RuntimeException $e) { } catch (\RuntimeException $e) {
if (0 !== $this->process->execute('svn --version', $ignoredOutput)) {
throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
}
throw new \RuntimeException( throw new \RuntimeException(
'Repository '.$this->url.' could not be processed, '.$e->getMessage() 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
); );

View File

@ -32,12 +32,15 @@ class SvnDriverTest extends \PHPUnit_Framework_TestCase
$output .= " rejected Basic challenge (http://corp.svn.local/)"; $output .= " rejected Basic challenge (http://corp.svn.local/)";
$process = $this->getMock('Composer\Util\ProcessExecutor'); $process = $this->getMock('Composer\Util\ProcessExecutor');
$process->expects($this->once()) $process->expects($this->at(1))
->method('execute') ->method('execute')
->will($this->returnValue(1)); ->will($this->returnValue(1));
$process->expects($this->once()) $process->expects($this->once())
->method('getErrorOutput') ->method('getErrorOutput')
->will($this->returnValue($output)); ->will($this->returnValue($output));
$process->expects($this->at(2))
->method('execute')
->will($this->returnValue(0));
$config = new Config(); $config = new Config();
$config->merge(array( $config->merge(array(