예제 #1
0
        public static SettingsContainer ParseToSettings(RawConfiguration settings)
        {
            var modalSettings = ReadModalSettings(settings);

            if (modalSettings == null)
            {
                return(null);
            }

            var authSettings = new GithubAuthSettings(
                EnsureTrailingSlash(settings.GithubApiEndpoint),
                settings.GithubToken);

            var userPrefs = new UserSettings
            {
                AllowedChange = settings.AllowedChange,
                ForkMode      = settings.ForkMode,
                LogLevel      = settings.LogLevel,
                MaxPullRequestsPerRepository = settings.MaxPullRequestsPerRepository,
                NuGetSources    = ReadNuGetSources(settings),
                PackageIncludes = ParseRegex(settings.Include, nameof(settings.Include)),
                PackageExcludes = ParseRegex(settings.Exclude, nameof(settings.Exclude))
            };

            return(new SettingsContainer
            {
                ModalSettings = modalSettings,
                GithubAuthSettings = authSettings,
                UserSettings = userPrefs
            });
        }
예제 #2
0
        public static SettingsContainer ParseToSettings(RawConfiguration settings)
        {
            var modalSettings = ReadModalSettings(settings);

            if (modalSettings == null)
            {
                return(null);
            }

            var authSettings = new GithubAuthSettings(
                EnsureTrailingSlash(settings.GithubApiEndpoint),
                settings.GithubToken);

            var minPackageAge = DurationParser.Parse(settings.MinPackageAge);

            if (!minPackageAge.HasValue)
            {
                minPackageAge = TimeSpan.Zero;
                Console.WriteLine($"Min package age '{settings.MinPackageAge}' could not be parsed");
            }

            var userPrefs = new UserSettings
            {
                AllowedChange = settings.AllowedChange,
                ForkMode      = settings.ForkMode,
                ReportMode    = settings.ReportMode,
                MaxPullRequestsPerRepository = settings.MaxPullRequestsPerRepository,
                MaxRepositoriesChanged       = settings.MaxRepositoriesChanged,
                NuGetSources      = ReadNuGetSources(settings),
                PackageIncludes   = ParseRegex(settings.Include, nameof(settings.Include)),
                PackageExcludes   = ParseRegex(settings.Exclude, nameof(settings.Exclude)),
                MinimumPackageAge = minPackageAge.Value,
                Directory         = settings.Dir
            };

            return(new SettingsContainer
            {
                ModalSettings = modalSettings,
                GithubAuthSettings = authSettings,
                UserSettings = userPrefs
            });
        }