private static bool FilterMatch(string id, XpandPackageFilter filter) { if (filter == XpandPackageFilter.Standalone) { return(id.StartsWith("Xpand")); } if (filter == XpandPackageFilter.Xpand) { return(id.StartsWith("eXpand")); } return(id.StartsWith("Xpand") || id.StartsWith("eXpand")); }
public static IObservable <PSObject> GetPackages(XpandPackageSource packageSource, string xpandFeed, string nugetFeed, XpandPackageFilter filter) { var allLabPackages = Providers.ListPackages(xpandFeed).ToPackageObject() .Where(tuple => FilterMatch(tuple, filter)); if (packageSource == XpandPackageSource.Nuget) { IObservable <(string Id, Version Version)> Metadata((string Id, Version Version) tuple) => Providers.PackageMetadata(nugetFeed, tuple.Id).ToPackageObject() .GroupBy(_ => _.Id).SelectMany(obs => obs.LastAsync()); allLabPackages = allLabPackages.SelectMany(Metadata); } return(allLabPackages.Distinct().Select(_ => PSObject.AsPSObject(new{ _.Id, _.Version }))); }
public static IObservable <string> GetPackages(XpandPackageSource packageSource, string xpandFeed, string nugetFeed, XpandPackageFilter filter) { var allLabPackages = Providers.ListPackages(xpandFeed) .Where(s => FilterMatch(s, filter)); if (packageSource == XpandPackageSource.Nuget) { allLabPackages = allLabPackages.SelectMany(id => Providers.ListPackages(nugetFeed, id)); } return(allLabPackages.Distinct()); }
public static IObservable <PSObject> GetPackages(XpandPackageSource packageSource, string xpandFeed, string nugetFeed, XpandPackageFilter filter) { if (packageSource == XpandPackageSource.Xpand) { nugetFeed = null; } else if (packageSource == XpandPackageSource.Nuget) { xpandFeed = null; } return(Providers.ListXpandPackages(xpandFeed, nugetFeed).ToPackageObject() .Where(tuple => FilterMatch(tuple, filter)) .Select(_ => PSObject.AsPSObject(new{ _.Id, _.Version }))); }