Exemple #1
0
 function it_should_be_able_to_create_process_arguments_based_on_taskname(ExternalCommand $externalCommandLocator)
 {
     $externalCommandLocator->locate('grumphp')->willReturn('/usr/bin/grumphp');
     $arguments = $this->createArgumentsForCommand('grumphp');
     $arguments->shouldHaveType('GrumPHP\\Collection\\ProcessArgumentsCollection');
     $arguments[0]->shouldBe('/usr/bin/grumphp');
     $arguments->count()->shouldBe(1);
 }
Exemple #2
0
 /**
  * Run the GrumPHP console to (de)init the git hooks
  *
  * @param $command
  */
 protected function runGrumPhpCommand($command)
 {
     $config = $this->composer->getConfig();
     $commandLocator = new ExternalCommand($config->get('bin-dir'), new ExecutableFinder());
     $executable = $commandLocator->locate('grumphp');
     $builder = new ProcessBuilder(array($executable, $command, '--no-interaction'));
     $process = $builder->getProcess();
     // Check executable which is running:
     if ($this->io->isVeryVerbose()) {
         $this->io->write('Running process : ' . $process->getCommandLine());
     }
     $process->run();
     if (!$process->isSuccessful()) {
         $this->io->write('<fg=red>GrumPHP can not sniff your commits. Did you specify the correct git-dir?</fg=red>');
         $this->io->write('<fg=red>' . $process->getErrorOutput() . '</fg=red>');
         return;
     }
     $this->io->write('<fg=yellow>' . $process->getOutput() . '</fg=yellow>');
 }
Exemple #3
0
 /**
  * @param string $command
  *
  * @return string
  */
 private function getCommandLocation($command)
 {
     return $this->externalCommandLocator->locate($command);
 }
Exemple #4
0
 /**
  * Search a command in the bin folder
  * Note: the command locator is not injected because it needs the relative bin path
  *
  * @param $command
  * @param $forceUnix
  *
  * @return string
  */
 public function getBinCommand($command, $forceUnix = false)
 {
     $commandLocator = new ExternalCommand($this->getBinDir(), new ExecutableFinder());
     return $commandLocator->locate($command, $forceUnix);
 }
Exemple #5
0
 /**
  * Search a command in the bin folder
  * Note: the command locator is not injected because it needs the relative bin path
  *
  * @param $command
  * @param $forceUnix
  *
  * @return string
  */
 public function getBinCommand($command, $forceUnix = false)
 {
     return $this->externalCommandLocator->locate($command, $forceUnix);
 }