Beispiel #1
0
        private static ISettings GetNuGetSettings(ProjectConverterSettings converterSettings)
        {
            string nugetConfigPath = Path.Combine(converterSettings.RepositoryRoot, "NuGet.config");

            if (File.Exists(nugetConfigPath))
            {
                return(Settings.LoadSpecificSettings(converterSettings.RepositoryRoot, Settings.DefaultSettingsFileName));
            }

            return(Settings.LoadDefaultSettings(converterSettings.RepositoryRoot, Settings.DefaultSettingsFileName, new XPlatMachineWideSetting()));
        }
Beispiel #2
0
        public ProjectConverter(ProjectConverterSettings converterSettings, ISettings nugetSettings)
        {
            _converterSettings = converterSettings ?? throw new ArgumentNullException(nameof(converterSettings));

            _nugetSettings = nugetSettings ?? throw new ArgumentNullException(nameof(nugetSettings));

            _repositoryPath = Path.GetFullPath(SettingsUtility.GetRepositoryPath(_nugetSettings)).Trim(Path.DirectorySeparatorChar);

            _globalPackagesFolder = Path.GetFullPath(SettingsUtility.GetGlobalPackagesFolder(_nugetSettings)).Trim(Path.DirectorySeparatorChar);

            PackagePathResolver = new PackagePathResolver(_repositoryPath);

            VersionFolderPathResolver = new VersionFolderPathResolver(_globalPackagesFolder);
        }
        public static void Run(ProgramArguments arguments)
        {
            if (arguments.Debug)
            {
                Debugger.Launch();
            }

            ConfigureLogger(arguments);

            ProjectConverterSettings settings = new ProjectConverterSettings
            {
                RepositoryRoot = arguments.RepoRoot,
                Include        = arguments.Include.ToRegex(),
                Exclude        = arguments.Exclude.ToRegex(),
                Log            = Log,
                TrimPackages   = arguments.Trim
            };

            Log.Info($" RepositoryRoot: '{settings.RepositoryRoot}'");
            Log.Info($"  Include regex: '{settings.Include}'");
            Log.Info($"  Exclude regex: '{settings.Exclude}'");
            Log.Info(String.Empty);

            if (!arguments.Yes)
            {
                Console.Write("Ensure there are no files checked out in git before continuing!  Continue? (Y/N) ");
                if (!Console.In.ReadLine().StartsWith("Y", StringComparison.OrdinalIgnoreCase))
                {
                    throw new OperationCanceledException();
                }
            }

            using (IProjectConverter projectConverter = ProjectConverterFactory.Create(settings))
            {
                projectConverter.ConvertRepository(CancellationTokenSource.Token);
            }
        }
Beispiel #4
0
 public ProjectConverter(ProjectConverterSettings converterSettings)
     : this(converterSettings, GetNuGetSettings(converterSettings))
 {
     _converterSettings = converterSettings ?? throw new ArgumentNullException(nameof(converterSettings));
 }
Beispiel #5
0
 public static IProjectConverter Create(ProjectConverterSettings settings)
 {
     return(Creator(settings));
 }