|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Conveyor package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Jeroen Fiege <[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 Webcreate\Conveyor\Command; |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
|
15
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
16
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
17
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
18
|
|
|
|
|
19
|
|
|
class UndeployCommand extends AbstractCommand |
|
20
|
|
|
{ |
|
21
|
2 |
|
protected function configure() |
|
22
|
|
|
{ |
|
23
|
2 |
|
$this |
|
24
|
2 |
|
->setName('undeploy') |
|
25
|
2 |
|
->setDescription('Undeploy (use with care!)') |
|
26
|
2 |
|
->addArgument('target', InputArgument::REQUIRED, 'Target or group to undeploy') |
|
27
|
2 |
|
->addOption('force', '-f', InputOption::VALUE_NONE, 'Force undeploy') |
|
28
|
|
|
; |
|
29
|
2 |
|
} |
|
30
|
|
|
|
|
31
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
32
|
|
|
{ |
|
33
|
|
|
$conveyor = $this->getConveyor($input, $output, $this->getHelperSet()); |
|
34
|
|
|
|
|
35
|
|
|
if (!$input->getOption('force')) { |
|
36
|
|
|
$answer = $conveyor->getIO()->askConfirmation( |
|
37
|
|
|
sprintf( |
|
38
|
|
|
'Are you sure you want to undeploy? The remote directory "%s" will be removed! ' . |
|
39
|
|
|
'Data will be lost! (y/N): ', |
|
40
|
|
|
$conveyor->getTransporter($input->getArgument('target'))->getPath() |
|
41
|
|
|
), |
|
42
|
|
|
false |
|
43
|
|
|
); |
|
44
|
|
|
|
|
45
|
|
|
if (!$answer) { |
|
46
|
|
|
return; |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
$options = array(); |
|
51
|
|
|
|
|
52
|
|
|
$conveyor->undeploy($input->getArgument('target'), $options); |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|