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

Commit d8f6701

Browse files
committed
bug #205 Moved the version in DownloadCommand (Pierstoval)
This PR was squashed before being merged into the 1.0-dev branch (closes #205). Discussion ---------- Moved the version in DownloadCommand This fixes #204 Commits ------- 8e7572d Moved the version in DownloadCommand
2 parents b4b3b62 + 8e7572d commit d8f6701

File tree

2 files changed

+37
-12
lines changed

2 files changed

+37
-12
lines changed

src/Symfony/Installer/DownloadCommand.php

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,41 @@
3636
*/
3737
abstract class DownloadCommand extends Command
3838
{
39-
/** @var Filesystem */
39+
/**
40+
* @var Filesystem
41+
*/
4042
protected $fs;
41-
/** @var OutputInterface */
43+
44+
/**
45+
* @var OutputInterface
46+
*/
4247
protected $output;
48+
49+
/**
50+
* @var string
51+
*/
4352
protected $projectName;
53+
54+
/**
55+
* @var string
56+
*/
4457
protected $projectDir;
4558

59+
/**
60+
* @var string
61+
*/
62+
protected $version;
63+
64+
/**
65+
* @var string
66+
*/
67+
protected $downloadedFilePath;
68+
69+
/**
70+
* @var array
71+
*/
72+
protected $requirementsErrors = array();
73+
4674
/**
4775
* Returns the type of the downloaded application in a human readable format.
4876
* It's mainly used to display readable error messages.
@@ -62,14 +90,16 @@ protected function initialize(InputInterface $input, OutputInterface $output)
6290
$this->fs = new Filesystem();
6391

6492
$this->enableSignalHandler();
93+
94+
$this->version = $input->hasArgument('version') ? trim($input->getArgument('version')) : 'latest';
6595
}
6696

6797
/**
6898
* Chooses the best compressed file format to download (ZIP or TGZ) depending upon the
6999
* available operating system uncompressing commands and the enabled PHP extensions
70100
* and it downloads the file.
71101
*
72-
* @return Command
102+
* @return $this
73103
*
74104
* @throws \RuntimeException if the Symfony archive could not be downloaded
75105
*/
@@ -200,7 +230,7 @@ protected function getGuzzleClient()
200230
* Extracts the compressed Symfony file (ZIP or TGZ) using the
201231
* native operating system commands if available or PHP code otherwise.
202232
*
203-
* @return NewCommand
233+
* @return DownloadCommand
204234
*
205235
* @throws \RuntimeException if the downloaded archive could not be extracted
206236
*/
@@ -256,7 +286,7 @@ protected function extract()
256286
/**
257287
* Checks if environment meets symfony requirements.
258288
*
259-
* @return Command
289+
* @return $this
260290
*/
261291
protected function checkSymfonyRequirements()
262292
{
@@ -280,7 +310,7 @@ protected function checkSymfonyRequirements()
280310
/**
281311
* Creates the appropriate .gitignore file for a Symfony project.
282312
*
283-
* @return Command
313+
* @return $this
284314
*/
285315
protected function createGitIgnore()
286316
{
@@ -438,7 +468,7 @@ protected function isEmptyDirectory($dir)
438468
*/
439469
protected function isSymfony3()
440470
{
441-
return '3' === $this->version[0];
471+
return $this->version && '3' === $this->version[0];
442472
}
443473

444474
private function enableSignalHandler()

src/Symfony/Installer/NewCommand.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
*/
2525
class NewCommand extends DownloadCommand
2626
{
27-
protected $version;
28-
protected $downloadedFilePath;
29-
protected $requirementsErrors = array();
30-
3127
protected function configure()
3228
{
3329
$this
@@ -45,7 +41,6 @@ protected function initialize(InputInterface $input, OutputInterface $output)
4541
$directory = rtrim(trim($input->getArgument('directory')), DIRECTORY_SEPARATOR);
4642
$this->projectDir = $this->fs->isAbsolutePath($directory) ? $directory : getcwd().DIRECTORY_SEPARATOR.$directory;
4743
$this->projectName = basename($directory);
48-
$this->version = trim($input->getArgument('version'));
4944
}
5045

5146
protected function execute(InputInterface $input, OutputInterface $output)

0 commit comments

Comments
 (0)