コード例 #1
0
 /**
  * Get the full path to the Drush executable.
  *
  * @return string
  */
 public function getDrushExecutable()
 {
     if (getenv('PLATFORMSH_CLI_DRUSH')) {
         return getenv('PLATFORMSH_CLI_DRUSH');
     }
     return $this->shellHelper->resolveCommand('drush');
 }
コード例 #2
0
 /**
  * Get the full path to the Drush executable.
  *
  * @return string
  *   The absolute path to the executable, or 'drush' if the path is not
  *   known.
  */
 protected function getDrushExecutable()
 {
     if ($this->config->has('local.drush_executable')) {
         return $this->config->get('local.drush_executable');
     }
     return $this->shellHelper->resolveCommand('drush');
 }
コード例 #3
0
 /**
  * @return string
  */
 protected function getTarExecutable()
 {
     $candidates = ['tar', 'tar.exe', 'bsdtar.exe'];
     foreach ($candidates as $command) {
         if ($this->shellHelper->commandExists($command)) {
             return $command;
         }
     }
     throw new \RuntimeException("Tar command not found");
 }
コード例 #4
0
ファイル: GitHelper.php プロジェクト: ecolinet/platformsh-cli
 /**
  * Execute a Git command.
  *
  * @param string[]     $args
  *   Command arguments (everything after 'git').
  * @param string|false $dir
  *   The path to a Git repository. Set to false if the command should not
  *   run inside a repository.
  * @param bool         $mustRun
  *   Enable exceptions if the Git command fails.
  * @param bool         $quiet
  *   Suppress command output.
  *
  * @throws \RuntimeException If the repository directory is invalid.
  *
  * @return string|bool
  */
 public function execute(array $args, $dir = null, $mustRun = false, $quiet = true)
 {
     // If enabled, set the working directory to the repository.
     if ($dir !== false) {
         $dir = $dir ?: $this->repositoryDir;
     }
     // Run the command.
     array_unshift($args, 'git');
     return $this->shellHelper->execute($args, $dir, $mustRun, $quiet);
 }
コード例 #5
0
 /**
  * @inheritdoc
  */
 public function setOutput(OutputInterface $output)
 {
     $this->output = $output;
     $this->shellHelper->setOutput($output);
 }
コード例 #6
0
 /**
  * Execute a Drush command.
  *
  * @param string[] $args
  *   Command arguments (everything after 'drush').
  * @param string   $dir
  *   The working directory.
  * @param bool     $mustRun
  *   Enable exceptions if the command fails.
  * @param bool     $quiet
  *   Suppress command output.
  *
  * @return string|bool
  */
 public function execute(array $args, $dir = null, $mustRun = false, $quiet = true)
 {
     array_unshift($args, $this->getDrushExecutable());
     return $this->shellHelper->execute($args, $dir, $mustRun, $quiet);
 }