Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Ignore the ASP.NET Core meta packages"
Browse files Browse the repository at this point in the history
  • Loading branch information
slang25 committed Sep 18, 2018
1 parent ad4e702 commit d4735e3
Showing 1 changed file with 53 additions and 47 deletions.
100 changes: 53 additions & 47 deletions NuKeeper.Inspection/UpdateFinder.cs
Original file line number Diff line number Diff line change
@@ -1,47 +1,53 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NuKeeper.Inspection.Files;
using NuKeeper.Inspection.Logging;
using NuKeeper.Inspection.NuGetApi;
using NuKeeper.Inspection.RepositoryInspection;
using NuKeeper.Inspection.Sources;

namespace NuKeeper.Inspection
{
public class UpdateFinder: IUpdateFinder
{
private readonly IRepositoryScanner _repositoryScanner;
private readonly IPackageUpdatesLookup _packageUpdatesLookup;
private readonly INuKeeperLogger _logger;

public UpdateFinder(
IRepositoryScanner repositoryScanner,
IPackageUpdatesLookup packageUpdatesLookup,
INuKeeperLogger logger)
{
_repositoryScanner = repositoryScanner;
_packageUpdatesLookup = packageUpdatesLookup;
_logger = logger;
}

public async Task<IReadOnlyCollection<PackageUpdateSet>> FindPackageUpdateSets(
IFolder workingFolder,
NuGetSources sources,
VersionChange allowedChange)
{
// scan for nuget packages
var packages = _repositoryScanner.FindAllNuGetPackages(workingFolder)
.ToList();

_logger.Log(PackagesFoundLogger.Log(packages));

// look for updates to these packages
var updates = await _packageUpdatesLookup.FindUpdatesForPackages(
packages, sources, allowedChange);

_logger.Log(UpdatesLogger.Log(updates));
return updates;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NuKeeper.Inspection.Files;
using NuKeeper.Inspection.Logging;
using NuKeeper.Inspection.NuGetApi;
using NuKeeper.Inspection.RepositoryInspection;
using NuKeeper.Inspection.Sources;

namespace NuKeeper.Inspection
{
public class UpdateFinder: IUpdateFinder
{
private readonly IRepositoryScanner _repositoryScanner;
private readonly IPackageUpdatesLookup _packageUpdatesLookup;
private readonly INuKeeperLogger _logger;

// ASP.NET Core has well know packages that should either be implicitly versioned, or carefully selected based on installed runtime
private static readonly List<string> _knownIgnoredPackages = new List<string>
{"Microsoft.AspNetCore.App", " Microsoft.AspNetCore.All"};

public UpdateFinder(
IRepositoryScanner repositoryScanner,
IPackageUpdatesLookup packageUpdatesLookup,
INuKeeperLogger logger)
{
_repositoryScanner = repositoryScanner;
_packageUpdatesLookup = packageUpdatesLookup;
_logger = logger;
}

public async Task<IReadOnlyCollection<PackageUpdateSet>> FindPackageUpdateSets(
IFolder workingFolder,
NuGetSources sources,
VersionChange allowedChange)
{
// scan for nuget packages
var packages = _repositoryScanner.FindAllNuGetPackages(workingFolder)
.Where(x => !_knownIgnoredPackages.Contains(x.Id, StringComparer.OrdinalIgnoreCase))
.ToList();

_logger.Log(PackagesFoundLogger.Log(packages));

// look for updates to these packages
var updates = await _packageUpdatesLookup.FindUpdatesForPackages(
packages, sources, allowedChange);

_logger.Log(UpdatesLogger.Log(updates));
return updates;
}
}
}

0 comments on commit d4735e3

Please sign in to comment.