private bool IsHugoApp()

in src/Detector/Hugo/HugoDetector.cs [61:152]


        private bool IsHugoApp(ISourceRepo sourceRepo, out string appDirectory)
        {
            // Hugo configuration variables:
            // https://gohugo.io/getting-started/configuration/#all-configuration-settings
            appDirectory = string.Empty;

            // Search for config.toml
            if (sourceRepo.FileExists(HugoConstants.TomlFileName)
                && IsHugoTomlFile(sourceRepo, HugoConstants.TomlFileName))
            {
                return true;
            }

            // Search for config.yml
            if (sourceRepo.FileExists(HugoConstants.YmlFileName)
                && IsHugoYamlFile(sourceRepo, HugoConstants.YmlFileName))
            {
                return true;
            }

            // Search for config.yaml
            if (sourceRepo.FileExists(HugoConstants.YamlFileName)
                && IsHugoYamlFile(sourceRepo, HugoConstants.YamlFileName))
            {
                return true;
            }

            // Search for config.json
            if (sourceRepo.FileExists(HugoConstants.JsonFileName)
                && IsHugoYamlFile(sourceRepo, HugoConstants.JsonFileName))
            {
                return true;
            }

            // NOTE: we do NOT disable looking up into the 'config' folder because it is a special folder
            // from perspective of Hugo where users can have configuration files.
            if (sourceRepo.DirExists(HugoConstants.ConfigFolderName))
            {
                // Search for config/**/*.toml
                var tomlFiles = sourceRepo.EnumerateFiles(
                    "*.toml",
                    searchSubDirectories: true,
                    subDirectoryToSearchUnder: HugoConstants.ConfigFolderName);
                foreach (var tomlFile in tomlFiles)
                {
                    if (IsHugoTomlFile(sourceRepo, tomlFile))
                    {
                        return true;
                    }
                }

                // Search for config/**/*.yaml and config/**/*.yml
                var yamlFiles = sourceRepo.EnumerateFiles(
                    "*.yaml",
                    searchSubDirectories: true,
                    subDirectoryToSearchUnder: HugoConstants.ConfigFolderName);
                foreach (var yamlFile in yamlFiles)
                {
                    if (IsHugoYamlFile(sourceRepo, yamlFile))
                    {
                        return true;
                    }
                }

                var ymlFiles = sourceRepo.EnumerateFiles(
                    "*.yml",
                    searchSubDirectories: true,
                    subDirectoryToSearchUnder: HugoConstants.ConfigFolderName);
                foreach (var ymlFile in ymlFiles)
                {
                    if (IsHugoYamlFile(sourceRepo, ymlFile))
                    {
                        return true;
                    }
                }

                // Search for config/**/*.json
                var jsonFiles = sourceRepo.EnumerateFiles(
                    "*.json",
                    searchSubDirectories: true,
                    subDirectoryToSearchUnder: HugoConstants.ConfigFolderName);
                foreach (var jsonFile in jsonFiles)
                {
                    if (IsHugoJsonFile(sourceRepo, jsonFile))
                    {
                        return true;
                    }
                }
            }

            return false;
        }