/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $serverName = $input->getOption('server'); list($host, $port) = explode(':', $input->getOption('master')); $pure = new Client($port, $host); try { $server = $this->deployer->servers->get($serverName); $environment = isset($this->deployer->environments[$serverName]) ? $this->deployer->environments[$serverName] : new Environment(); $output = new RemoteOutput($output, $pure, $serverName); while ($pure->ping()) { // Get task to do $taskName = $pure->map('tasks_to_do')->get($serverName); if (null !== $taskName) { $task = $this->deployer->tasks->get($taskName); try { $task->run(new Context($server, $environment, $input, $output)); } catch (NonFatalException $e) { $pure->queue('exception')->push([$serverName, get_class($e), $e->getMessage()]); } $pure->map('tasks_to_do')->delete($serverName); } } } catch (\Exception $exception) { $pure->queue('exception')->push([$serverName, get_class($exception), $exception->getMessage()]); } }
public function testPing() { $client = new Client(self::PORT); $this->assertTrue($client->ping()); }