Beispiel #1
0
        public override Task ExecuteAsync(CancellationToken cancellationToken)
        {
            var solutionFileName = _fileSearch.FindSolutionFile();
            var arguments        = _roboNuGetFile.MsBuild.ToString(solutionFileName);

            var processExecutor = new ProcessExecutor();

            var result = processExecutor.ShellCmdExecute("/q /c pause |", "msbuild", arguments);

            return(Task.CompletedTask);
        }
Beispiel #2
0
        public override Task ExecuteAsync(CancellationToken cancellationToken)
        {
            var solutionFileName = _fileSearch.FindSolutionFile();
            var nuspecFiles      = _fileSearch.FindNuspecFiles();

            foreach (var nuspecFile in nuspecFiles.OrderBy(x => x.FileName))
            {
                var nuspecDirectoryName = Path.GetDirectoryName(nuspecFile.FileName);
                var packagesConfig      = PackagesConfigFile.Load(nuspecDirectoryName);

                var csProj = CsProjFile.Load(Path.Combine(nuspecDirectoryName, $"{nuspecFile.Id}{CsProjFile.Extension}"));
                var projectDependencies = csProj.ProjectReferences.Select(projectReferenceName => new NuspecDependency {
                    Id = projectReferenceName, Version = _roboNuGetFile.FullVersion
                }).ToList();
                var packageDependencies = packagesConfig.Packages.Concat(csProj.PackageReferences).Select(package => new NuspecDependency {
                    Id = package.Id, Version = package.Version
                }).ToList();

                var dependencyCount = projectDependencies.Count + packageDependencies.Count;

                //dependencyCount = nuspecFile.Dependencies.Count();

                if (!Short)
                {
                    Logger.ConsoleMessageLine(m => m);
                }
                Logger.ConsoleMessageLine(m => m
                                          .Indent()
                                          .text($"{Path.GetFileNameWithoutExtension(nuspecFile.FileName)} ")
                                          .span(s => s.text($"({dependencyCount})").color(ConsoleColor.Magenta)));

                if (!Short)
                {
                    ListDependencies("Projects", projectDependencies.OrderBy(x => x.Id));
                    ListDependencies("Packages", packageDependencies.OrderBy(x => x.Id));
                }
            }

            return(Task.CompletedTask);
        }
Beispiel #3
0
        public override async Task ExecuteAsync(CancellationToken cancellationToken)
        {
            //this.ValidateWith(ParameterValidator).ThrowIfNotValid();

            var solutionFileName = _fileSearch.FindSolutionFile();
            var nuspecFiles      = _fileSearch.FindNuspecFiles();

            var pushStopwatch = Stopwatch.StartNew();

            var success = new Dictionary <bool, int>
            {
                [true]  = 0,
                [false] = 0
            };

            // We're not pushing packages in parallel.
            foreach (var nuspecFile in nuspecFiles)
            {
                var packageStopwatch = Stopwatch.StartNew();

                var commandLine = _roboNuGetFile.NuGet.Commands["push"].Format(new
                {
                    NupkgFileName   = Path.Combine(_roboNuGetFile.NuGet.OutputDirectoryName, $"{nuspecFile.Id}.{nuspecFile.Version}.nupkg"),
                    NuGetConfigName = _roboNuGetFile.NuGet.NuGetConfigName,
                });

                var result = await _processExecutor.NoWindowExecuteAsync("nuget", commandLine);

                success[result.ExitCode == ExitCode.Success]++;

                Logger.ConsoleMessageLine(m => m.text(result.Output.Trim()));
                Logger.ConsoleMessageLine(m => m.text(result.Error.Trim()));
                Logger.ConsoleMessageLine(p => p.text($"Elapsed: {packageStopwatch.Elapsed.TotalSeconds:F1} seconds"));
            }

            Logger.ConsoleMessageLine(p => p.text($"Uploaded: {success[true]} package(s)."));
            Logger.ConsoleMessageLine(p => p.text($"Failed: {success[false]} package(s)."));
            Logger.ConsoleMessageLine(p => p.text($"Elapsed: {pushStopwatch.Elapsed.TotalSeconds:F1} seconds"));
        }
Beispiel #4
0
        private void RenderSplashScreen(RoboNuGetFile roboNuGetFile)
        {
            Logger.ConsoleMessageLine(m => m.Prompt().span(s => s.text("RoboNuGet v4.0.0").color(ConsoleColor.DarkGray)));

            var solutionFileName = _fileSearch.FindSolutionFile();
            var nuspecFiles      = _fileSearch.FindNuspecFiles().ToList();

            //ConsoleColorizer.RenderLine($"<p>&gt;Solution '<span color='yellow'>{solutionName}</span>' <span color='magenta'>v{_program.RoboNuGetFile.FullVersion}</span> ({nuspecFileCount} nuspec{(nuspecFileCount != 1 ? "s" : string.Empty)})</p>");

            Logger.ConsoleMessageLine(p => p
                                      .Prompt()
                                      .text("Solution ")
                                      .span(s => s.text(Path.GetFileNameWithoutExtension(solutionFileName).QuoteWith("'")).color(ConsoleColor.Yellow))
                                      .text(" ")
                                      .span(s => s.text($" v{_roboNuGetFile.FullVersion}").color(ConsoleColor.Magenta))
                                      .text(" ")
                                      .text($"({nuspecFiles.Count} nuspec{(nuspecFiles.Count != 1 ? "s" : string.Empty)})")
                                      );
            //            ConsoleColorizer.RenderLine($"<p>&gt;<span color='darkgray'>Directory '{Path.GetDirectoryName(_program.RoboNuGetFile.SolutionFileNameActual)}'</span></p>");
            //            ConsoleColorizer.RenderLine($"<p>&gt;<span color='darkgray'>Packages '{_program.RoboNuGetFile.PackageDirectoryName}'</span></p>");
            //            ConsoleColorizer.RenderLine($"<p>&gt;<span color='darkgray'>Last command '{(string.IsNullOrEmpty(_lastCommandLine) ? "N/A" : _lastCommandLine)}'</span> <span color='darkyellow'>(Press Enter to reuse)</span></p>");
            //            Console.Write(">");
        }