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

Commit e3088a5

Browse files
committed
feature #198 Forward to 3.0 (Pierstoval)
This PR was squashed before being merged into the 1.0-dev branch (closes #198). Discussion ---------- Forward to 3.0 Hey guys, now released 😄 Commits ------- 6d75524 Forward to 3.0
2 parents bdb1067 + 6d75524 commit e3088a5

File tree

3 files changed

+51
-15
lines changed

3 files changed

+51
-15
lines changed

src/Symfony/Installer/DownloadCommand.php

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ protected function extract()
261261
protected function checkSymfonyRequirements()
262262
{
263263
try {
264-
require $this->projectDir.'/app/SymfonyRequirements.php';
264+
$requirementsDir = $this->isSymfony3() ? 'var' : 'app';
265+
require $this->projectDir.'/'.$requirementsDir.'/SymfonyRequirements.php';
265266
$symfonyRequirements = new \SymfonyRequirements();
266267
$this->requirementsErrors = array();
267268
foreach ($symfonyRequirements->getRequirements() as $req) {
@@ -284,18 +285,32 @@ protected function checkSymfonyRequirements()
284285
protected function createGitIgnore()
285286
{
286287
$gitIgnoreEntries = array(
287-
'/app/bootstrap.php.cache',
288-
'/app/cache/*',
289-
'!app/cache/.gitkeep',
290288
'/app/config/parameters.yml',
291-
'/app/logs/*',
292-
'!app/logs/.gitkeep',
293-
'/app/phpunit.xml',
294289
'/bin/',
290+
'/build/',
295291
'/composer.phar',
296292
'/vendor/',
297293
'/web/bundles/',
298294
);
295+
if ($this->isSymfony3()) {
296+
$gitIgnoreEntries = array_merge($gitIgnoreEntries, array(
297+
'/var/',
298+
'!var/cache/.gitkeep',
299+
'!var/logs/.gitkeep',
300+
'!var/sessions/.gitkeep',
301+
'/phpunit.xml',
302+
));
303+
} else {
304+
$gitIgnoreEntries = array_merge($gitIgnoreEntries, array(
305+
'/app/bootstrap.php.cache',
306+
'/app/cache/*',
307+
'!app/cache/.gitkeep',
308+
'/app/config/parameters.yml',
309+
'/app/logs/*',
310+
'!app/logs/.gitkeep',
311+
'/app/phpunit.xml',
312+
));
313+
}
299314

300315
try {
301316
$this->fs->dumpFile($this->projectDir.'/.gitignore', implode("\n", $gitIgnoreEntries)."\n");
@@ -416,6 +431,16 @@ protected function isEmptyDirectory($dir)
416431
return 2 === count(scandir($dir.'/'));
417432
}
418433

434+
/**
435+
* Checks that the asked version is in the 3.x branch.
436+
*
437+
* @return bool
438+
*/
439+
protected function isSymfony3()
440+
{
441+
return '3' === $this->version[0];
442+
}
443+
419444
private function enableSignalHandler()
420445
{
421446
if (!function_exists('pcntl_signal')) {

src/Symfony/Installer/NewCommand.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ protected function checkSymfonyVersionIsInstallable()
111111
}
112112

113113
// validate semver syntax
114-
if (!preg_match('/^2\.\d(?:\.\d{1,2})?(?:-(?:dev|BETA\d*|RC\d*))?$/i', $this->version)) {
115-
throw new \RuntimeException('The Symfony version must be 2.N or 2.N.M (where N and M are positive integers). The special "-dev", "-BETA" and "-RC" versions are also supported.');
114+
if (!preg_match('/^[23]\.\d(?:\.\d{1,2})?(?:-(?:dev|BETA\d*|RC\d*))?$/i', $this->version)) {
115+
throw new \RuntimeException('The Symfony version must be 2.N, 2.N.M, 3.N or 3.N.M (where N and M are positive integers). The special "-dev", "-BETA" and "-RC" versions are also supported.');
116116
}
117117

118-
if (preg_match('/^2\.\d$/', $this->version)) {
118+
if (preg_match('/^[23]\.\d$/', $this->version)) {
119119
// Check if we have a minor version in order to retrieve the last patch from symfony.com
120120

121121
$client = $this->getGuzzleClient();
@@ -246,26 +246,31 @@ protected function displayInstallationResult()
246246
$this->output->writeln(' * '.$helpText);
247247
}
248248

249+
$checkFile = $this->isSymfony3() ? 'bin/symfony_requirements' : 'app/check.php';
250+
249251
$this->output->writeln(sprintf(
250252
" After fixing these issues, re-check Symfony requirements executing this command:\n\n".
251-
" <comment>php %s/app/check.php</comment>\n\n".
253+
" <comment>php %s/%s</comment>\n\n".
252254
" Then, you can:\n",
253-
$this->projectName
255+
$this->projectName, $checkFile
254256
));
255257
}
256258

257259
if ('.' !== $this->projectDir) {
258260
$this->output->writeln(sprintf(
259-
" * Change your current directory to <comment>%s</comment>\n\n", $this->projectDir
261+
" * Change your current directory to <comment>%s</comment>\n", $this->projectDir
260262
));
261263
}
262264

265+
$consoleDir = ($this->isSymfony3() ? 'bin' : 'app');
266+
263267
$this->output->writeln(sprintf(
264268
" * Configure your application in <comment>app/config/parameters.yml</comment> file.\n\n".
265269
" * Run your application:\n".
266-
" 1. Execute the <comment>php app/console server:run</comment> command.\n".
270+
" 1. Execute the <comment>php %s/console server:run</comment> command.\n".
267271
" 2. Browse to the <comment>http://localhost:8000</comment> URL.\n\n".
268-
" * Read the documentation at <comment>http://symfony.com/doc</comment>\n"
272+
" * Read the documentation at <comment>http://symfony.com/doc</comment>\n",
273+
$consoleDir
269274
));
270275

271276
return $this;

tests/Symfony/Installer/Tests/IntegrationTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ public function provideSymfonyInstallationData()
125125
'/.*Symfony 2\.7\.0\-BETA1 was successfully installed.*/',
126126
'/Symfony version 2\.7\.0\-BETA1 - app\/dev\/debug/',
127127
),
128+
129+
array(
130+
'3.0.0-BETA1',
131+
'/.*Symfony 3\.0\.0\-BETA1 was successfully installed.*/',
132+
'/Symfony version 3\.0\.0\-BETA1 - app\/dev\/debug/',
133+
),
128134
);
129135
}
130136
}

0 commit comments

Comments
 (0)