コード例 #1
0
ファイル: Versioner.php プロジェクト: seferov/deployer-bundle
 /**
  * @return bool
  * @throws \Exception
  */
 public function getCurrentVersion()
 {
     $versions = $this->sshClient->exec(sprintf('head -1 %s', $this->versionsFile));
     if (count($versions)) {
         return $versions[0];
     }
     return false;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     $this->config = $this->getContainer()->getParameter('seferov_deployer_config');
     if (!array_key_exists($this->input->getArgument('server_name'), $this->config['servers'])) {
         throw new \InvalidArgumentException(sprintf('There is no such server named "%s" in the configuration', $this->input->getArgument('server_name')));
     }
     $this->server = $this->config['servers'][$this->input->getArgument('server_name')];
     $this->versionsDir = $this->server['connection']['path'] . '/versions/';
     $this->sshClient = new SshClient();
     $this->sshClient->setOutput($this->output);
     $this->sshClient->connect($this->server['connection']);
     $this->versioner = new Versioner($this->versionsDir, $this->sshClient);
     $this->executeCommand();
 }