Example #1
0
 public function install(DriverConfig $config)
 {
     if (is_dir($config->getDirectory())) {
         $command = sprintf('cd "%s" && git pull origin %s', $config->getDirectory(), $config->getBranch());
     } else {
         $command = sprintf('git clone -b %s %s "%s"', $config->getBranch(), $config->getRepository(), $config->getDirectory());
     }
     $process = new Process($command);
     $process->run();
     if (!$process->isSuccessful()) {
         throw new \RuntimeException($process->getErrorOutput());
     }
     return $process->getOutput();
 }