/
InstallCommand.php
72 lines (61 loc) · 2.25 KB
/
InstallCommand.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* This file is part of the Zephir.
*
* (c) Zephir Team <team@zephir-lang.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Zephir\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Zephir\Command\InstallCommand
*
* Installs the extension in the extension directory.
*
* @package Zephir\Command
*/
class InstallCommand extends ContainerAwareCommand implements DevelopmentModeAwareInterface
{
use DevelopmentModeAwareTrait;
protected function configure()
{
$this
->setName('install')
->setDescription('Installs the extension in the extension directory (may require root password)')
->addOption('dev', null, InputOption::VALUE_NONE, 'Install the extension in development mode')
->addOption('no-dev', null, InputOption::VALUE_NONE, 'Install the extension in production mode')
->setHelp($this->getDevelopmentModeHelp());
}
protected function execute(InputInterface $input, OutputInterface $output)
{
// TODO: Move all the stuff from the compiler
$this->compiler->install(
$this->isDevelopmentModeEnabled($input)
);
return 0;
}
/**
* {@inheritdoc}
*
* @return string
*/
public function getDevelopmentModeHelp()
{
return <<<EOT
Installs the extension in the extension directory.
Note: The command may require root password on Linux/Unit systems.
Using "--dev" option will try installing the extension in development mode
(debug symbols and no optimizations). An extension compiled with debugging symbols means
you can run a program or library through a debugger and the debugger's output will be user
friendlier. These debugging symbols also enlarge the program or library significantly.
Note: Zephir development mode will be enabled silently if your PHP binary was compiled in
a debug configuration.
In some cases, we would like to get production ready extension even if the PHP binary was
compiled in a debug configuration. Use "--no-dev" option to achieve this behavior.
EOT;
}
}