Beispiel #1
0
 /**
  * Constructor.
  *
  * @param string           $url     Url of the repository
  * @param AdapterInterface $adapter adapter
  * @param string|null      $cwd     current working directory
  */
 public function __construct($url, AdapterInterface $adapter = null, $cwd = null)
 {
     if (null === $adapter) {
         $cli = new Cli();
         $cli->setTimeout(600);
         $adapter = new CliAdapter('/usr/bin/git', $cli, new CliParser());
     }
     parent::__construct($url, $adapter);
     $this->setCwd($cwd);
     $this->setHead(new Reference('master'));
 }
Beispiel #2
0
 /**
  * (non-PHPdoc)
  * @see Webcreate\Vcs\Common\Adapter.AdapterInterface::execute()
  *
  * @return mixed
  */
 public function execute($command, array $arguments = array(), $cwd = null)
 {
     $bincommand = $this->bin . ' ' . $command;
     $arguments += $this->getGlobalArguments();
     $commandline = $this->cli->prepare($bincommand, $arguments);
     if ($this->cli->execute($commandline, null, $cwd) != 0) {
         throw new ProcessFailedException($this->cli->getProcess());
     }
     return $this->parse($command, $arguments, $this->cli->getOutput());
 }
Beispiel #3
0
 /**
  * Executes a svnadmin command
  *
  * @param  string                 $command
  * @param  array                  $arguments
  * @throws ProcessFailedException
  * @throws \RuntimeException
  * @return string
  */
 protected function exec($command, array $arguments = array())
 {
     $command = $this->bin . ' ' . $command;
     $commandline = $this->cli->prepare($command, $arguments);
     if ($this->cli->execute($commandline) != 0) {
         throw new ProcessFailedException($this->cli->getProcess());
     } elseif ($message = $this->cli->getErrorOutput()) {
         throw new \RuntimeException($message);
     }
     return $this->cli->getOutput();
 }
Beispiel #4
0
 /**
  * @dataProvider prepareProvider
  */
 public function testPerpare($command, $arguments, $expected)
 {
     $cli = new Cli();
     $commandline = $cli->prepare($command, $arguments);
     $this->assertEquals($expected, $commandline);
 }