Passed
Branch master (3fb2a1)
by Andrés
02:45
created

PrepareTask   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 21
ccs 9
cts 9
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 9 1
A getName() 0 3 1
A getDescription() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Magallanes package.
5
 *
6
 * (c) Andrés Montañez <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Mage\Task\BuiltIn\Deploy\Release;
13
14
use Symfony\Component\Process\Process;
15
use Mage\Task\AbstractTask;
16
17
/**
18
 * Release Task - Create the Release Directory
19
 *
20
 * @author Andrés Montañez <[email protected]>
21
 */
22
class PrepareTask extends AbstractTask
23
{
24 48
    public function getName(): string
25
    {
26 48
        return 'deploy/release/prepare';
27
    }
28
29 16
    public function getDescription(): string
30
    {
31 16
        return '[Release] Preparing Release';
32
    }
33
34 16
    public function execute(): bool
35
    {
36 16
        $hostPath = rtrim($this->runtime->getEnvOption('host_path'), '/');
37
38 16
        $cmdMakeDir = sprintf('mkdir -p %s/releases/%s', $hostPath, $this->runtime->getReleaseId());
39
40
        /** @var Process $process */
41 16
        $process = $this->runtime->runRemoteCommand($cmdMakeDir, false);
42 16
        return $process->isSuccessful();
43
    }
44
}
45