-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRemoveFailedReleaseHandler.php
32 lines (26 loc) · 1.13 KB
/
RemoveFailedReleaseHandler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
namespace DigipolisGent\Robo\Helpers\EventHandler\DefaultHandler;
use DigipolisGent\Robo\Helpers\EventHandler\AbstractTaskEventHandler;
use DigipolisGent\Robo\Helpers\Traits\RemoteRemoveReleaseTrait;
use DigipolisGent\Robo\Helpers\Util\RemoteConfig;
use DigipolisGent\Robo\Task\Deploy\Ssh\Auth\KeyFile;
use Symfony\Component\EventDispatcher\GenericEvent;
class RemoveFailedReleaseHandler extends AbstractTaskEventHandler
{
use RemoteRemoveReleaseTrait;
use \DigipolisGent\Robo\Task\Deploy\Tasks;
/**
* {@inheritDoc}
*/
public function handle(GenericEvent $event)
{
/** @var RemoteConfig $remoteConfig */
$remoteConfig = $event->getArgument('remoteConfig');
$remoteSettings = $remoteConfig->getRemoteSettings();
$auth = new KeyFile($remoteConfig->getUser(), $remoteConfig->getPrivateKeyFile());
$releaseDir = $event->hasArgument('releaseDir')
? $event->getArgument('releaseDir')
: $remoteSettings['releasesdir'] . '/' . $remoteSettings['time'];
return $this->taskRemoteRemoveRelease($remoteConfig->getHost(), $auth, null, $releaseDir);
}
}