public static Config Provide(string gitDirectory, IFileSystem fileSystem) { if (fileSystem is null) { throw new ArgumentNullException(nameof(fileSystem)); } var configFilePath = GetConfigFilePath(gitDirectory); if (fileSystem.Exists(configFilePath)) { _logger.Verbose("Loading configuration from file: {FilePath}", configFilePath); var readAllText = fileSystem.ReadAllText(configFilePath); using (var stringReader = new StringReader(readAllText)) { var deserializedConfig = ConfigSerializer.Read(stringReader); EnsureDefaultConfig(deserializedConfig); return(deserializedConfig); } } _logger.Warning("Yaml not found, that's ok! Learn more at {Url}", "https://gittools.github.io/GitReleaseManager/docs/yaml"); return(new Config()); }
public static Config Provide(string gitDirectory, IFileSystem fileSystem) { if (fileSystem == null) { throw new ArgumentNullException(nameof(fileSystem)); } var configFilePath = GetConfigFilePath(gitDirectory); if (fileSystem.Exists(configFilePath)) { var readAllText = fileSystem.ReadAllText(configFilePath); return(ConfigSerializer.Read(new StringReader(readAllText))); } return(new Config()); }