From 26d3670c17d40016249eadf1881afa70985383f0 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 22 Jan 2015 00:19:47 -0600 Subject: [PATCH] (GH-14) INugetService implements ISourceRunner --- .../services/INugetService.cs | 31 +------------------ .../services/NugetService.cs | 17 ++++++++-- 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/src/chocolatey/infrastructure.app/services/INugetService.cs b/src/chocolatey/infrastructure.app/services/INugetService.cs index c275314f34..1de5925c95 100644 --- a/src/chocolatey/infrastructure.app/services/INugetService.cs +++ b/src/chocolatey/infrastructure.app/services/INugetService.cs @@ -20,22 +20,8 @@ namespace chocolatey.infrastructure.app.services using configuration; using results; - public interface INugetService + public interface INugetService : ISourceRunner { - /// - /// Run list in noop mode - /// - /// The configuration. - void list_noop(ChocolateyConfiguration config); - - /// - /// Lists/searches for pacakge against nuget related feeds. - /// - /// The configuration. - /// Should results be logged? - /// - ConcurrentDictionary list_run(ChocolateyConfiguration config, bool logResults); - /// /// Run pack in noop mode. /// @@ -60,21 +46,6 @@ public interface INugetService /// The configuration. void push_run(ChocolateyConfiguration config); - /// - /// Run install in noop mode - /// - /// The configuration. - /// The action to continue with for each noop test install. - void install_noop(ChocolateyConfiguration config, Action continueAction); - - /// - /// Installs packages from NuGet related feeds - /// - /// The configuration. - /// The action to continue with when install is successful. - /// results of installs - ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction); - /// /// Run upgrade in noop mode /// diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 269ab549f9..17446c9b51 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -24,6 +24,7 @@ namespace chocolatey.infrastructure.app.services using adapters; using commandline; using configuration; + using domain; using guards; using logging; using nuget; @@ -37,11 +38,11 @@ public class NugetService : INugetService { private readonly IFileSystem _fileSystem; private readonly ILogger _nugetLogger; - private readonly Lazy datetime_initializer = new Lazy(() => new DateTime()); + private readonly Lazy _datetimeInitializer = new Lazy(() => new DateTime()); private IDateTime DateTime { - get { return datetime_initializer.Value; } + get { return _datetimeInitializer.Value; } } /// @@ -55,6 +56,16 @@ public NugetService(IFileSystem fileSystem, ILogger nugetLogger) _nugetLogger = nugetLogger; } + public SourceType SourceType + { + get { return SourceType.normal; } + } + + public void ensure_source_app_installed(ChocolateyConfiguration config, Action ensureAction) + { + // nothing to do. Nuget.Core is already part of Chocolatey + } + public void list_noop(ChocolateyConfiguration config) { this.Log().Info("{0} would have searched for '{1}' against the following source(s) :\"{2}\"".format_with( @@ -169,7 +180,7 @@ public void push_run(ChocolateyConfiguration config) NugetPush.push_package(config, nupkgFilePath); - if (config.RegularOuptut) this.Log().Warn(ChocolateyLoggers.Important,() => @" + if (config.RegularOuptut) this.Log().Warn(ChocolateyLoggers.Important, () => @" Your package may be subject to moderation. A moderator will review the package prior to acceptance. You should have received an email. If you