Skip to content

Commit

Permalink
Fix yaml path (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
gseidel authored Oct 26, 2021
1 parent b8591a0 commit 811ae0a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Configuration/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ protected function findGlobalConfigFile()
if (file_exists($configFile)) {
return $configFile;
}
$configFile = sprintf('%s/.enhavo/config.yml', $home);
if (file_exists($configFile)) {
return $configFile;
}
return null;
}

Expand All @@ -44,6 +48,10 @@ protected function findLocalConfigFile()
if (file_exists($configFile)) {
return $configFile;
}
$configFile = sprintf('%s/.enhavo.yml', getcwd());
if (file_exists($configFile)) {
return $configFile;
}
return null;
}

Expand Down
4 changes: 4 additions & 0 deletions src/Subroutine/VendorSymlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ private function findMainPackagePath()

foreach ($mainRepositories as $mainRepository) {
$configPath = sprintf('%s/.enhavo.yaml', $mainRepository);
if(!$this->fs->exists($configPath)) {
$configPath = sprintf('%s/.enhavo.yml', $mainRepository);
}

if ($this->fs->exists($configPath)) {
$configuration = new Configuration();
$this->factory->readFromFile($configPath, $configuration);
Expand Down
5 changes: 4 additions & 1 deletion src/Task/EditConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class EditConfig extends AbstractSubroutine
public function __invoke()
{
$home = getenv("HOME");
$path = sprintf("%s/.enhavo/config.yaml", realpath($home));
$path = sprintf("%s/.enhavo/config.yml", realpath($home));
if (file_exists($path)) {
$path = sprintf("%s/.enhavo/config.yaml", realpath($home));
}
return $this->execute(['vim', $path], $this->output);
}
}

0 comments on commit 811ae0a

Please sign in to comment.