Ejemplo n.º 1
0
    static async Task ProcessSolution(string solution, string?package)
    {
        if (Excluder.ShouldExclude(solution))
        {
            Console.WriteLine($"  Exclude: {solution}");
            return;
        }

        Console.WriteLine($"  {solution}");
        await SolutionRestore.Run(solution);

        var solutionDirectory = Directory.GetParent(solution) !.FullName;

        foreach (var project in FileSystem.EnumerateFiles(solutionDirectory, "*.csproj"))
        {
            Console.WriteLine($"    {project.Replace(solutionDirectory, "").Trim(Path.DirectorySeparatorChar)}");
            foreach (var pending in await PendingUpdateReader.ReadPendingUpdates(project))
            {
                if (package == null)
                {
                    await Update(project, pending.Package, pending.Latest);

                    continue;
                }

                if (string.Equals(package, pending.Package, StringComparison.OrdinalIgnoreCase))
                {
                    await Update(project, pending.Package, pending.Latest);
                }
            }
        }
    }
    static Task VerifyUpdates(string input)
    {
        var lines = input.Lines().ToList();

        return(Verifier.Verify(
                   new
        {
            parsed = PendingUpdateReader.ParseUpdates(lines),
            withUpdates = PendingUpdateReader.ParseWithUpdates(lines)
        }));
    }