bool Push( string packageFilePath, NugetSourceConfiguration config) { var logger = new ProcessLogger(_output.Standard, _output.Error); _output.Accent1.WriteLine("Pushing {0}", packageFilePath); _output.Standard.WriteLine(); if (_proj.NuGet.Push( packageFilePath, logger, config == null ? null : config.Source, config == null ? null : config.ApiKey)) { _output.Standard.WriteLine(); _output.Accent1.WriteLine("Successfully pushed {0}", packageFilePath); return(true); } else { _output.Standard.WriteLine(); _output.Error.WriteLine("An error occured while pushing {0}", packageFilePath); return(false); } }
private static void AddFeed(FeedConfigurationOptions options, CodeGenerationConfiguration configuration) { var feedName = options.Name?.Trim(); if (string.IsNullOrEmpty(feedName)) { Console.WriteLine("No feed name provided"); Environment.ExitCode |= (int)ExitCodes.InvalidFeedName; return; } var source = options.Source?.Trim(); if (string.IsNullOrEmpty(source)) { Console.WriteLine("No feed source provided"); Environment.ExitCode |= (int)ExitCodes.InvalidFeedSource; return; } var feedItemExists = configuration.NugetFeeds.Any(x => x.Name.Equals(feedName, StringComparison.InvariantCultureIgnoreCase)); if (feedItemExists) { Console.WriteLine($"Feed with name {feedName} already exists"); Environment.ExitCode |= (int)ExitCodes.InvalidFeedName; } else { var feedItem = new NugetSourceConfiguration { Name = feedName, Source = source, ProtocolVersion = options.ProtocolVersion }; configuration.NugetFeeds.Add(feedItem); UpdateConfiguration(configuration); Console.WriteLine($"Nuget feed {feedName} added"); } }