Skip to content

Commit

Permalink
bug #1024 Remove version in generated Docker compose files (fabpot)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.x branch.

Discussion
----------

Remove version in generated Docker compose files

closes #1023

Commits
-------

33ce7c1 Remove version in generated Docker compose files
  • Loading branch information
fabpot committed Apr 27, 2024
2 parents 1691a42 + 33ce7c1 commit 4dc1191
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Configurator/DockerComposeConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private function configureDockerCompose(Recipe $recipe, array $config, bool $upd
$dockerComposeFile = $this->findDockerComposeFile($rootDir, $file);
if (null === $dockerComposeFile) {
$dockerComposeFile = $rootDir.'/'.$file;
file_put_contents($dockerComposeFile, "version: '3'\n");
file_put_contents($dockerComposeFile, '');
$this->write(sprintf(' Created <fg=green>"%s"</>', $file));
}

Expand Down
13 changes: 2 additions & 11 deletions tests/Configurator/DockerComposeConfiguratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
class DockerComposeConfiguratorTest extends TestCase
{
public const ORIGINAL_CONTENT = <<<'YAML'
version: '3.4'
services:
app:
build:
Expand Down Expand Up @@ -640,11 +638,10 @@ public function testConfigureFileInParentDir()
public function testConfigureWithoutExistingDockerComposeFiles()
{
$dockerComposeFile = FLEX_TEST_DIR.'/compose.yaml';
$defaultContent = "version: '3'\n";

$this->configurator->configure($this->recipeDb, self::CONFIG_DB, $this->lock);

$this->assertStringEqualsFile($dockerComposeFile, $defaultContent.<<<'YAML'
$this->assertStringEqualsFile($dockerComposeFile, <<<'YAML'
services:
###> doctrine/doctrine-bundle ###
Expand All @@ -671,7 +668,7 @@ public function testConfigureWithoutExistingDockerComposeFiles()
);

$this->configurator->unconfigure($this->recipeDb, self::CONFIG_DB, $this->lock);
$this->assertEquals(trim($defaultContent), file_get_contents($dockerComposeFile));
$this->assertEquals('', file_get_contents($dockerComposeFile));
}

public function testUpdate()
Expand All @@ -691,8 +688,6 @@ public function testUpdate()
file_put_contents(
FLEX_TEST_DIR.'/docker-compose.yml',
<<<EOF
version: '3'
services:
###> doctrine/doctrine-bundle ###
database:
Expand Down Expand Up @@ -768,8 +763,6 @@ public function testUpdate()
);

$this->assertSame(['docker-compose.yml' => <<<EOF
version: '3'
services:
###> doctrine/doctrine-bundle ###
database:
Expand Down Expand Up @@ -807,8 +800,6 @@ public function testUpdate()
], $recipeUpdate->getOriginalFiles());

$this->assertSame(['docker-compose.yml' => <<<EOF
version: '3'
services:
###> doctrine/doctrine-bundle ###
database:
Expand Down

0 comments on commit 4dc1191

Please sign in to comment.