Esempio n. 1
0
 public function cleanOldReleases(\Plumber\Event\DeployEvent $event)
 {
     $options = $event->getOptions();
     $server = $event->getServer();
     $this->ssh->connect($server->getHost(), $server->getPort());
     $this->ssh->authenticate($server->getUser(), $server->getPublicKey(), $server->getPrivateKey());
     $this->removeOldReleases($server, $options['releases_to_keep']);
     $this->ssh->disconnect();
 }
Esempio n. 2
0
 /**
  * Connect through SSH to a remote server and execute some commands.
  *
  * @param ServerInterface $server The server where to execute the commands
  * @param array $commands The commands to execute
  * @return boolean 
  */
 public function execute(\Plumber\Event\DeployEvent $event)
 {
     $server = $event->getServer();
     $options = $event->getOptions();
     $log = $event->getLogger();
     $commands = $options['commands'];
     if (!empty($options['dry_run'])) {
         return true;
     }
     foreach ($commands as $command) {
         $log->addNotice("\nExecuting the following command:\n{$command}\n" . $server->executeCommand('cd ' . $server->getReleasesFolder() . $options['timestamp_folder'] . ' && ' . $command), array('server' => $server->getHost()));
     }
     return true;
 }