예제 #1
0
 /**
  * Run a command in the git repository
  *
  * Accepts a shell command to run
  *
  * @param   string  $command command to run
  * @param   string  $repository
  * @param   bool    $force
  * @return  string
  * @throws  \GitApi\GitRuntimeException for any caught exception
  */
 public function run($command, $repository = null, $force = false)
 {
     list($stdout, $status, $stderr) = parent::run($command, $repository);
     if (!empty($stderr)) {
         throw new GitRuntimeException($stderr);
     }
     return $stdout;
 }
예제 #2
0
 public static function getFileLinesCount($path)
 {
     $docbook = FrontController::getInstance();
     $wc_cmd = Command::getCommandPath('wc');
     $command = $wc_cmd . ' -l ' . $path;
     list($stdout, $status, $stderr) = $docbook->getTerminal()->run($command, $path);
     $parts = explode(' ', trim($stdout));
     $lines = array_shift($parts);
     return !empty($lines) ? $lines : 0;
 }