Skip to content

Commit 5387acc

Browse files
authored
Split Symfony dependencies (#22)
1 parent 5f61ddd commit 5387acc

File tree

3 files changed

+9
-31
lines changed

3 files changed

+9
-31
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ matrix:
233233
sudo: required
234234
before_script:
235235
- travis_retry composer self-update
236-
- if [ "$SYMFONY_VERSION" != "" ]; then travis_retry php tests/setSymfonyVersion.php $PUG_VERSION $SYMFONY_VERSION; fi;
236+
- if [ "$SYMFONY_VERSION" != "" ]; then travis_retry composer require --no-update -n symfony/symfony=$SYMFONY_VERSION; fi;
237+
- if [ "$PUG_VERSION" != "" ]; then travis_retry composer require --no-update -n pug-php/pug=$PUG_VERSION; fi;
237238
- travis_retry composer update --no-interaction --prefer-stable
238239
- chmod -R 0777 tests/project
239240
script:

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
"pug/installer": "^0.1.0",
1111
"pug-php/pug": "^2.7.1 || ^3.0.0",
1212
"pug-php/pug-assets": "^1.0.1",
13-
"symfony/symfony": "^2.7 || ^3.0 || ^4.0"
13+
"symfony/framework-bundle": "^2.7 || ^3.0 || ^4.0",
14+
"symfony/http-foundation": "^2.7 || ^3.0 || ^4.0",
15+
"symfony/http-kernel": "^2.7 || ^3.0 || ^4.0",
16+
"symfony/templating": "^2.7 || ^3.0 || ^4.0",
17+
"symfony/twig-bridge": "^2.7 || ^3.0 || ^4.0"
1418
},
1519
"require-dev": {
1620
"phpunit/phpunit": "^4.8.35 || ^5.7 || ~6.3.0",

tests/setSymfonyVersion.php

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,8 @@
11
<?php
22

33
list($pugVersion, $symfonyVersion) = explode(' ', implode(' ', array_slice($argv, 1)), 2);
4-
$composerFile = __DIR__ . '/../composer.json';
5-
$composer = file_get_contents($composerFile);
6-
$newContent = preg_replace('/"symfony\/symfony"\s*:\s*"[^"]+"/', '"symfony/symfony": "' . $symfonyVersion . '"', $composer);
74

8-
if ($newContent === $composer) {
9-
echo 'symfony/symfony not found in composer.json';
10-
11-
exit(1);
12-
}
13-
14-
echo "symfony/symfony version: $symfonyVersion\n";
15-
16-
$composer = $newContent;
17-
$newContent = preg_replace('/"pug-php\/pug"\s*:\s*"[^"]+"/', '"pug-php/pug": "' . $pugVersion . '"', $composer);
18-
19-
if ($newContent === $composer) {
20-
echo 'pug-php/pug not found in composer.json';
21-
22-
exit(1);
23-
}
24-
25-
echo "pug-php/pug version: $pugVersion\n";
26-
27-
if (empty($newContent) || !file_put_contents($composerFile, $newContent)) {
28-
echo 'composer.json cannot be updated';
29-
30-
exit(1);
31-
}
32-
33-
echo 'composer.json has been updated';
5+
echo shell_exec('composer require --no-update -n symfony/symfony=' . $symfonyVersion);
6+
echo shell_exec('composer require --no-update -n pug-php/pug=' . $pugVersion);
347

358
exit(0);

0 commit comments

Comments
 (0)