Skip to content

Commit

Permalink
(chocolateyGH-14) INugetService implements ISourceRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
ferventcoder committed Jan 22, 2015
1 parent 1aac979 commit 26d3670
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 33 deletions.
31 changes: 1 addition & 30 deletions src/chocolatey/infrastructure.app/services/INugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,8 @@ namespace chocolatey.infrastructure.app.services
using configuration;
using results;

public interface INugetService
public interface INugetService : ISourceRunner
{
/// <summary>
/// Run list in noop mode
/// </summary>
/// <param name="config">The configuration.</param>
void list_noop(ChocolateyConfiguration config);

/// <summary>
/// Lists/searches for pacakge against nuget related feeds.
/// </summary>
/// <param name="config">The configuration.</param>
/// <param name="logResults">Should results be logged?</param>
/// <returns></returns>
ConcurrentDictionary<string, PackageResult> list_run(ChocolateyConfiguration config, bool logResults);

/// <summary>
/// Run pack in noop mode.
/// </summary>
Expand All @@ -60,21 +46,6 @@ public interface INugetService
/// <param name="config">The configuration.</param>
void push_run(ChocolateyConfiguration config);

/// <summary>
/// Run install in noop mode
/// </summary>
/// <param name="config">The configuration.</param>
/// <param name="continueAction">The action to continue with for each noop test install.</param>
void install_noop(ChocolateyConfiguration config, Action<PackageResult> continueAction);

/// <summary>
/// Installs packages from NuGet related feeds
/// </summary>
/// <param name="config">The configuration.</param>
/// <param name="continueAction">The action to continue with when install is successful.</param>
/// <returns>results of installs</returns>
ConcurrentDictionary<string, PackageResult> install_run(ChocolateyConfiguration config, Action<PackageResult> continueAction);

/// <summary>
/// Run upgrade in noop mode
/// </summary>
Expand Down
17 changes: 14 additions & 3 deletions src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace chocolatey.infrastructure.app.services
using adapters;
using commandline;
using configuration;
using domain;
using guards;
using logging;
using nuget;
Expand All @@ -37,11 +38,11 @@ public class NugetService : INugetService
{
private readonly IFileSystem _fileSystem;
private readonly ILogger _nugetLogger;
private readonly Lazy<IDateTime> datetime_initializer = new Lazy<IDateTime>(() => new DateTime());
private readonly Lazy<IDateTime> _datetimeInitializer = new Lazy<IDateTime>(() => new DateTime());

private IDateTime DateTime
{
get { return datetime_initializer.Value; }
get { return _datetimeInitializer.Value; }
}

/// <summary>
Expand All @@ -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<PackageResult> 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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 26d3670

Please sign in to comment.