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

Better use of Console component features #104

Merged
merged 1 commit into from
Feb 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Symfony/Installer/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,18 @@ protected function configure()
;
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function initialize(InputInterface $input, OutputInterface $output)
{
$this->fs = new Filesystem();
$directory = rtrim(trim($input->getArgument('directory')), DIRECTORY_SEPARATOR);
$this->projectDir = $this->fs->isAbsolutePath($directory) ? $directory : getcwd().DIRECTORY_SEPARATOR.$directory;
$this->projectName = basename($directory);
$this->version = trim($input->getArgument('version'));
$this->output = $output;
}

protected function execute(InputInterface $input, OutputInterface $output)
{
try {
$this
->checkProjectName()
Expand Down
8 changes: 8 additions & 0 deletions src/Symfony/Installer/SelfUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ protected function configure()
;
}

/**
* The self-update command is only available when using the installer via the PHAR file.
*/
public function isEnabled()
{
return 'phar://' === substr(__DIR__, 0, 7);
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$fs = new Filesystem();
Expand Down
6 changes: 1 addition & 5 deletions symfony
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ $appVersion = '0.6.0-DEV';
$app = new Symfony\Component\Console\Application('Symfony Installer', $appVersion);
$app->add(new Symfony\Installer\AboutCommand($appVersion));
$app->add(new Symfony\Installer\NewCommand());

// enable the self-update command only when using the PHAR file
if ('phar://' === substr(__DIR__, 0, 7)) {
$app->add(new Symfony\Installer\SelfUpdateCommand());
}
$app->add(new Symfony\Installer\SelfUpdateCommand());

$app->setDefaultCommand('about');

Expand Down