REBELinBLUE\Deployer\Scripts\Runner::run PHP Метод

run() публичный Метод

Runs a script locally.
public run ( callable | null $callback = null ) : integer
$callback callable | null
Результат integer
    public function run($callback = null)
    {
        $command = $this->wrapCommand($this->script);
        $this->process->setCommandLine($command);
        return $this->process->run($callback);
    }

Usage Example

Пример #1
0
 /**
  * Execute the job.
  * @throws \RuntimeException
  * @dispatches UpdateGitReferences
  */
 public function handle()
 {
     $private_key = tempnam(storage_path('app/'), 'sshkey');
     file_put_contents($private_key, $this->project->private_key);
     $wrapper = with(new ScriptParser())->parseFile('tools.SSHWrapperScript', ['private_key' => $private_key]);
     $wrapper_file = tempnam(storage_path('app/'), 'gitssh');
     file_put_contents($wrapper_file, $wrapper);
     $process = new Process('tools.MirrorGitRepository', ['wrapper_file' => $wrapper_file, 'mirror_path' => $this->project->mirrorPath(), 'repository' => $this->project->repository]);
     $process->run();
     unlink($wrapper_file);
     unlink($private_key);
     if (!$process->isSuccessful()) {
         throw new \RuntimeException('Could not mirror repository - ' . $process->getErrorOutput());
     }
     $this->project->last_mirrored = date('Y-m-d H:i:s');
     $this->project->save();
     $this->dispatch(new UpdateGitReferences($this->project));
 }
All Usage Examples Of REBELinBLUE\Deployer\Scripts\Runner::run