public CreatedCuratedPackage ( |
||
curatedFeed | ||
package | ||
included | bool | |
automaticallyCurated | bool | |
notes | string | |
commitChanges | bool | |
return |
public override void Curate(Package galleryPackage, INupkg nugetPackage, bool commitChanges) { // Make sure the target feed exists CuratedFeed feed = CuratedFeedService.GetFeedByName(CuratedFeedName, includePackages: true); if (feed != null && galleryPackage.Tags != null) { // Break the tags up so we can be sure we don't catch any partial matches (i.e. "foobar" when we're looking for "foo") string[] tags = galleryPackage.Tags.Split(); // Check if this package should be curated if (tags.Any(tag => RequiredTags.Contains(tag, StringComparer.OrdinalIgnoreCase))) { // It should! // But now we need to ensure that the package's dependencies are also curated if (DependenciesAreCurated(galleryPackage, feed)) { CuratedFeedService.CreatedCuratedPackage( feed, galleryPackage.PackageRegistration, automaticallyCurated: true, commitChanges: commitChanges); } } } }
public virtual ActionResult PostCuratedPackages( string curatedFeedName, CreateCuratedPackageRequest request) { var curatedFeed = CuratedFeedService.GetFeedByName(curatedFeedName, includePackages: true); if (curatedFeed == null) { return(HttpNotFound()); } if (curatedFeed.Managers.All(manager => manager.Username != User.Identity.Name)) { return(new HttpStatusCodeResult(403)); } if (!ModelState.IsValid) { ViewBag.CuratedFeedName = curatedFeed.Name; return(View("CreateCuratedPackageForm")); } var packageRegistration = EntitiesContext.PackageRegistrations .Where(pr => pr.Id == request.PackageId) .Include(pr => pr.Packages) .Include(pr => pr.Owners) .FirstOrDefault(); if (packageRegistration == null) { ModelState.AddModelError("PackageId", Strings.PackageWithIdDoesNotExist); ViewBag.CuratedFeedName = curatedFeed.Name; return(View("CreateCuratedPackageForm")); } if (curatedFeed.Packages.Any(cp => cp.PackageRegistration.Key == packageRegistration.Key)) { ModelState.AddModelError("PackageId", Strings.PackageIsAlreadyCurated); ViewBag.CuratedFeedName = curatedFeed.Name; return(View("CreateCuratedPackageForm")); } var packages = packageRegistration.Packages.ToList(); foreach (var package in packages) { CuratedFeedService.CreatedCuratedPackage( curatedFeed, package, included: true, automaticallyCurated: false, notes: request.Notes, commitChanges: false); } CuratedFeedService.UpdateIsLatest(packageRegistration, false); EntitiesContext.SaveChanges(); return(RedirectToRoute(RouteName.CuratedFeed, new { name = curatedFeed.Name })); }
public override void Curate( Package galleryPackage, INupkg nugetPackage, bool commitChanges) { var curatedFeed = CuratedFeedService.GetFeedByName("webmatrix", includePackages: true); if (curatedFeed == null) { return; } var shouldBeIncluded = ShouldCuratePackage(curatedFeed, galleryPackage, nugetPackage); if (shouldBeIncluded) { CuratedFeedService.CreatedCuratedPackage( curatedFeed, galleryPackage.PackageRegistration, included: true, automaticallyCurated: true, commitChanges: commitChanges); } }