예제 #1
0
 /**
  * @param string $prefix
  * @param array  $lines
  */
 private function pipeLinesWithPrefix($prefix, array $lines)
 {
     foreach ($lines as $line) {
         $line = trim($line);
         if (!empty($line)) {
             $this->userInteraction->write($prefix . ' ' . $line);
         }
     }
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     if ($this->processRunner->run($this->getVersionCommand(), false)->isSuccessful()) {
         $this->userInteraction->write(sprintf('"%s" is already installed', $this->getName()));
     } else {
         $this->userInteraction->write(sprintf('Installing "%s"', $this->getName()));
         $this->processRunner->run($this->getInstallCommand());
         $this->userInteraction->write(sprintf('"%s" successfully installed', $this->getName()));
     }
 }
 /**
  * @return callable
  */
 private function getRunningProcessCallback()
 {
     return function ($type, $buffer) {
         $lines = explode("\n", $buffer);
         $prefix = Process::ERR === $type ? '<error>ERR</error> ' : '<question>OUT</question> ';
         foreach ($lines as $line) {
             $line = trim($line);
             if (!empty($line)) {
                 $this->userInteraction->write($prefix . $line);
             }
         }
     };
 }
예제 #4
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->userInteraction->writeTitle("Pulling image aacebedo/dnsdock");
     $this->userInteraction->write("Check docker machine is running");
     if (!$this->machine->isRunning()) {
         $this->userInteraction->write("Starting machine");
         $this->machine->start();
     }
     $this->userInteraction->write("Setting environment variables");
     $this->processRunner->run($this->machine->getEnvironmentDeclaration());
     $this->userInteraction->write("Pulling image aacebedo/dnsdock, this could take a while when run for the first time");
     $this->processRunner->run('docker pull aacebedo/dnsdock:latest-amd64');
 }
 /**
  * {@inheritdoc}
  */
 public function execute(ChainContext $context)
 {
     try {
         $this->process->execute($context);
     } catch (ProcessFailedException $e) {
         $processOutput = $e->getProcess()->getOutput();
         if (strpos($processOutput, 'Agreeing to the Xcode/iOS license requires admin privileges, please re-run') !== false) {
             $this->userInteraction->writeTitle('You need to agree Xcode license.');
             $this->userInteraction->write('Run `xcode-select --install` to fix the problem and run this command again.');
             throw $e;
         }
     }
 }
예제 #6
0
파일: PhpSsh.php 프로젝트: inviqa/dock-cli
 /**
  * @param $package
  */
 protected function installHomebrewPackage($package)
 {
     // Check if the package is known
     if (!$this->hasHomebrewPackage($package)) {
         $this->userInteraction->write(sprintf('Package "%s" not found, tapping default PHP brews', $package));
         $this->processRunner->run('brew tap homebrew/dupes');
         $this->processRunner->run('brew tap homebrew/versions');
         $this->processRunner->run('brew tap homebrew/homebrew-php');
     }
     $this->processRunner->run('brew install ' . $package);
 }