Skip to content
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

Commit 04b69e3

Browse files
committed
minor #104 Better use of Console component features (javiereguiluz)
This PR was merged into the 1.0-dev branch. Discussion ---------- Better use of Console component features Commits ------- 3ef4823 Better use Console component features
2 parents ed84f7a + 3ef4823 commit 04b69e3

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/Symfony/Installer/NewCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,18 @@ protected function configure()
6060
;
6161
}
6262

63-
protected function execute(InputInterface $input, OutputInterface $output)
63+
protected function initialize(InputInterface $input, OutputInterface $output)
6464
{
6565
$this->fs = new Filesystem();
6666
$directory = rtrim(trim($input->getArgument('directory')), DIRECTORY_SEPARATOR);
6767
$this->projectDir = $this->fs->isAbsolutePath($directory) ? $directory : getcwd().DIRECTORY_SEPARATOR.$directory;
6868
$this->projectName = basename($directory);
6969
$this->version = trim($input->getArgument('version'));
7070
$this->output = $output;
71+
}
7172

73+
protected function execute(InputInterface $input, OutputInterface $output)
74+
{
7275
try {
7376
$this
7477
->checkProjectName()

src/Symfony/Installer/SelfUpdateCommand.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ protected function configure()
3737
;
3838
}
3939

40+
/**
41+
* The self-update command is only available when using the installer via the PHAR file.
42+
*/
43+
public function isEnabled()
44+
{
45+
return 'phar://' === substr(__DIR__, 0, 7);
46+
}
47+
4048
protected function execute(InputInterface $input, OutputInterface $output)
4149
{
4250
$fs = new Filesystem();

symfony

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ $appVersion = '0.6.0-DEV';
2323
$app = new Symfony\Component\Console\Application('Symfony Installer', $appVersion);
2424
$app->add(new Symfony\Installer\AboutCommand($appVersion));
2525
$app->add(new Symfony\Installer\NewCommand());
26-
27-
// enable the self-update command only when using the PHAR file
28-
if ('phar://' === substr(__DIR__, 0, 7)) {
29-
$app->add(new Symfony\Installer\SelfUpdateCommand());
30-
}
26+
$app->add(new Symfony\Installer\SelfUpdateCommand());
3127

3228
$app->setDefaultCommand('about');
3329

0 commit comments

Comments
 (0)