Skip to content

Commit 0170279

Browse files
authored
Merge pull request #822 from dunglas/fix/docker-compose-yml
fix: use .yml instead of .yaml for Docker Compose files
2 parents 782ef22 + 32e4c13 commit 0170279

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/Configurator/DockerComposeConfigurator.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ public function configure(Recipe $recipe, $config, Lock $lock, array $options =
4545
foreach ($this->normalizeConfig($config) as $file => $extra) {
4646
$dockerComposeFile = $this->findDockerComposeFile($rootDir, $file);
4747
if (null === $dockerComposeFile) {
48-
$dockerComposeFileName = preg_replace('/\.yml$/', '.yaml', $file);
49-
$dockerComposeFile = $rootDir.'/'.$dockerComposeFileName;
48+
$dockerComposeFile = $rootDir.'/'.$file;
5049
file_put_contents($dockerComposeFile, "version: '3'\n");
51-
$this->write(sprintf(' Created <fg=green>"%s"</>', $dockerComposeFileName));
50+
$this->write(sprintf(' Created <fg=green>"%s"</>', $file));
5251
}
5352
if ($this->isFileMarked($recipe, $dockerComposeFile)) {
5453
continue;
@@ -168,7 +167,6 @@ private function findDockerComposeFile(string $rootDir, string $file): ?string
168167

169168
// COMPOSE_FILE not set, or doesn't contain the file we're looking for
170169
$dir = $rootDir;
171-
$previousDir = null;
172170
do {
173171
// Test with the ".yaml" extension if the file doesn't end up with ".yml".
174172
if (

tests/Configurator/DockerComposeConfiguratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ public function testConfigureFileInParentDir()
531531

532532
public function testConfigureWithoutExistingDockerComposeFiles()
533533
{
534-
$dockerComposeFile = FLEX_TEST_DIR.'/docker-compose.yaml';
534+
$dockerComposeFile = FLEX_TEST_DIR.'/docker-compose.yml';
535535
$defaultContent = "version: '3'\n";
536536

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

0 commit comments

Comments
 (0)