Skip to content

Commit 8357c08

Browse files
committed
bug #103 Allow Symfony 5 components (Lustmored)
This PR was squashed before being merged into the 1.0.x-dev branch (closes #103). Discussion ---------- Allow Symfony 5 components Also closes #100 - use new Process method to create object from shell command when available Commits ------- 483be54 Allow Symfony 5 components
2 parents f6c45c2 + 483be54 commit 8357c08

File tree

6 files changed

+35
-14
lines changed

6 files changed

+35
-14
lines changed

Diff for: .travis.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ matrix:
1616
env:
1717
- SYMFONY_VERSION="dev-master"
1818
- CHECK_PHP_SYNTAX="no"
19-
- php: 7.1
19+
- php: 7.2
2020
env:
21-
- SYMFONY_VERSION="3.2.*"
21+
- SYMFONY_VERSION="3.4.*"
22+
- CHECK_PHP_SYNTAX="yes"
23+
- php: 7.2
24+
env:
25+
- SYMFONY_VERSION="4.4.*"
26+
- CHECK_PHP_SYNTAX="yes"
27+
- php: 7.2
28+
env:
29+
- SYMFONY_VERSION="5.0.*"
2230
- CHECK_PHP_SYNTAX="yes"
2331
allow_failures:
2432
- php: nightly
@@ -31,7 +39,7 @@ before_install:
3139
- echo opcache.enable_cli = 1 >> $INI_FILE
3240
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
3341
- composer self-update
34-
- if [[ "$SYMFONY_VERSION" != "" ]]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
42+
- if [[ "$SYMFONY_VERSION" != "" ]]; then composer require "symfony/framework-bundle:${SYMFONY_VERSION}" --no-update; fi;
3543

3644
install:
3745
- if [[ "$CHECK_PHP_SYNTAX" == "yes" ]]; then composer require --dev --no-update friendsofphp/php-cs-fixer; fi;

Diff for: composer.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=7.1.0",
16-
"symfony/console": "~2.3|~3.0|~4.0",
17-
"symfony/dependency-injection": "~2.3|~3.0|~4.0",
18-
"symfony/expression-language": "~2.4|~3.0|~4.0",
19-
"symfony/filesystem": "~2.3|~3.0|~4.0",
20-
"symfony/http-foundation": "~2.3|~3.0|~4.0",
21-
"symfony/http-kernel": "~2.3|~3.0|~4.0",
15+
"php": ">=7.2.0",
16+
"symfony/console": "~2.3|~3.0|~4.0|~5.0",
17+
"symfony/dependency-injection": "~2.3|~3.0|~4.0|~5.0",
18+
"symfony/expression-language": "~2.4|~3.0|~4.0|~5.0",
19+
"symfony/filesystem": "~2.3|~3.0|~4.0|~5.0",
20+
"symfony/http-foundation": "~2.3|~3.0|~4.0|~5.0",
21+
"symfony/http-kernel": "~2.3|~3.0|~4.0|~5.0",
2222
"symfony/polyfill-mbstring": "^1.3",
23-
"symfony/process": "~2.3|~3.0|~4.0"
23+
"symfony/process": "~2.3|~3.0|~4.0|~5.0"
2424
},
2525
"require-dev": {
2626
"phpunit/phpunit": "^6.1"

Diff for: src/Command/DeployCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
7777
$deployer = include $this->configFilePath;
7878
$deployer->initialize($context);
7979
$deployer->doDeploy();
80+
81+
return 0;
8082
}
8183

8284
private function createDefaultConfigFile(InputInterface $input, OutputInterface $output, string $defaultConfigPath, string $stageName): void

Diff for: src/Command/RollbackCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7272
$deployer = include $this->configFilePath;
7373
$deployer->initialize($context);
7474
$deployer->doRollback();
75+
76+
return 0;
7577
}
7678
}

Diff for: src/Configuration/DefaultConfiguration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ private function setDefaultConfiguration(int $symfonyMajorVersion, $symfonyMinor
381381
$this->sharedFiles = ['app/config/parameters.yml'];
382382
$this->sharedDirs = ['var/logs'];
383383
$this->writableDirs = ['var/cache/', 'var/logs/'];
384-
} elseif (4 === $symfonyMajorVersion || (3 === $symfonyMajorVersion && 4 >= $symfonyMinorVersion)) {
384+
} elseif (4 <= $symfonyMajorVersion || (3 === $symfonyMajorVersion && 4 >= $symfonyMinorVersion)) {
385385
$this->_symfonyEnvironmentEnvVarName = 'APP_ENV';
386386
$this->setDirs('bin', 'config', 'var/cache', 'var/log', 'src', 'templates', 'public');
387387
$this->controllersToRemove([]);

Diff for: src/Task/TaskRunner.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ public function run(Task $task): array
4141
return $results;
4242
}
4343

44+
private function createProcess(string $shellCommand): Process
45+
{
46+
if (method_exists(Process::class, 'fromShellCommandline')) {
47+
return Process::fromShellCommandline($shellCommand);
48+
}
49+
50+
return new Process($shellCommand);
51+
}
52+
4453
private function doRun(Server $server, string $shellCommand, array $envVars): TaskCompleted
4554
{
4655
if ($server->has(Property::project_dir)) {
@@ -63,9 +72,9 @@ private function doRun(Server $server, string $shellCommand, array $envVars): Ta
6372
}
6473

6574
if ($server->isLocalHost()) {
66-
$process = new Process($shellCommand);
75+
$process = $this->createProcess($shellCommand);
6776
} else {
68-
$process = new Process(sprintf('%s %s', $server->getSshConnectionString(), escapeshellarg($shellCommand)));
77+
$process = $this->createProcess(sprintf('%s %s', $server->getSshConnectionString(), escapeshellarg($shellCommand)));
6978
}
7079

7180
$process->setTimeout(null);

0 commit comments

Comments
 (0)