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