1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of tenside/core. |
5
|
|
|
* |
6
|
|
|
* (c) Christian Schiffler <[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
|
|
|
* This project is provided in good faith and hope to be usable by anyone. |
12
|
|
|
* |
13
|
|
|
* @package tenside/core |
14
|
|
|
* @author Christian Schiffler <[email protected]> |
15
|
|
|
* @copyright 2015 Christian Schiffler <[email protected]> |
16
|
|
|
* @license https://github.com/tenside/core/blob/master/LICENSE MIT |
17
|
|
|
* @link https://github.com/tenside/core |
18
|
|
|
* @filesource |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace Tenside\Core\Task\Composer; |
22
|
|
|
|
23
|
|
|
use Symfony\Component\Console\Input\ArrayInput; |
24
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
25
|
|
|
use Tenside\Core\Task\Composer\WrappedCommand\DumpAutoloadCommand; |
26
|
|
|
use Tenside\Core\Util\RuntimeHelper; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* This class holds the information for a dumpautoload task (composer dumpautoload). |
30
|
|
|
*/ |
31
|
|
|
class DumpAutoloadTask extends AbstractComposerCommandTask |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* The home path of tenside. |
35
|
|
|
*/ |
36
|
|
|
const SETTING_HOME = 'home'; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Constant for the optimize option. |
40
|
|
|
*/ |
41
|
|
|
const SETTING_OPTIMIZE = 'optimize'; |
42
|
|
|
|
43
|
|
|
/** * |
44
|
|
|
* {@inheritdoc} |
45
|
|
|
*/ |
46
|
|
|
public function getType() |
47
|
|
|
{ |
48
|
|
|
return 'dumpautoload'; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* {@inheritDoc} |
53
|
|
|
*/ |
54
|
|
|
protected function prepareCommand() |
55
|
|
|
{ |
56
|
|
|
RuntimeHelper::setupHome((string) $this->file->get(self::SETTING_HOME)); |
57
|
|
|
|
58
|
|
|
return $this->attachComposerFactory(new DumpAutoloadCommand()); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Prepare the input interface for the command. |
63
|
|
|
* |
64
|
|
|
* @return InputInterface |
65
|
|
|
*/ |
66
|
|
|
protected function prepareInput() |
67
|
|
|
{ |
68
|
|
|
$arguments = [ |
69
|
|
|
'--optimize' => (bool) $this->file->get(self::SETTING_OPTIMIZE), |
70
|
|
|
'--no-dev' => true, |
71
|
|
|
]; |
72
|
|
|
|
73
|
|
|
$input = new ArrayInput($arguments); |
74
|
|
|
$input->setInteractive(false); |
75
|
|
|
|
76
|
|
|
return $input; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|