static void Main(string[] args) { var baseAddress = "http://*****:*****@"d:\omnishopcentraldata\Packages\Private", settingsProvider, logger); NuGetPublicRepository = NuGetV2WebApiEnabler.CreatePackageRepository(@"d:\omnishopcentraldata\Packages\Public", settingsProvider, logger); NuGetVeryPublicRepository = NuGetV2WebApiEnabler.CreatePackageRepository(@"d:\omnishopcentraldata\Packages\VeryPublic", settingsProvider, logger); // Start OWIN host, which in turn will create a new instance of Startup class, and execute its Configuration method. using (WebApp.Start <Startup>(url: baseAddress)) { Console.WriteLine("Server listening at baseaddress: " + baseAddress); Console.WriteLine("[ENTER] to close server"); Console.ReadLine(); } }
private static async Task <IEnumerable <IServerPackage> > GetUpdateCandidatesAsync( IServerPackageRepository repository, IEnumerable <IPackageName> packages, bool includePrerelease, ClientCompatibility compatibility, CancellationToken token) { var query = await repository.GetPackagesAsync(compatibility, token); var ids = new HashSet <string>( packages.Select(p => p.Id), StringComparer.OrdinalIgnoreCase); query = query.Where(p => ids.Contains(p.Id)); if (!includePrerelease) { query = query.Where(p => p.IsReleaseVersion()); } // for updates, we never consider unlisted packages query = query.Where(p => p.Listed); return(query); }
/// <summary> /// /// </summary> /// <param name="repository">Required.</param> /// <param name="authenticationService">Optional. If this is not supplied Upload/Delete is not available (requests returns 403 Forbidden)</param> protected NuGetODataController( IServerPackageRepository repository, IPackageAuthenticationService authenticationService = null) { _serverRepository = repository ?? throw new ArgumentNullException(nameof(repository)); _authenticationService = authenticationService; }
public DefaultServiceResolver() { _hashProvider = new CryptoHashProvider(Constants.HashAlgorithm); _packageRepository = new ServerPackageRepository(PackageUtility.PackagePhysicalPath, _hashProvider, new TraceLogger()); _packageService = new PackageService(_packageRepository, new PackageAuthenticationService()); }
public DefaultServiceResolver() { _hashProvider = new CryptoHashProvider(Constants.HashAlgorithm); _packageRepository = new ServerPackageRepository(PackageUtility.PackagePhysicalPath, _hashProvider, new TraceLogger()); _packageService = new PackageService(_packageRepository, new PackageAuthenticationService()); }
public AzureServiceResolver(IServiceResolver serviceResolver) { _serviceResolver = serviceResolver; var azureServerPackageRepository = new AzureServerPackageRepository(new AzurePackageLocator(), new AzurePackageSerializer()); _serverPackageRepository = azureServerPackageRepository; _packageService = new AzurePackageService(azureServerPackageRepository, new PackageAuthenticationService()); }
/// <summary> /// Initializes a new instance of the TestModule class. /// </summary> /// <param name="authService"></param> /// <param name="settings"></param> public PackageFilesModule(IAuthorizePackageOperations authService, IServerPackageRepository packageRepo, IZipPackageFactory zipPackageFactory) : base("/PackageFiles") { this.packageRepo = packageRepo; this.authService = authService; this.zipPackageFactory = zipPackageFactory; DefineHandlers(); }
public LightNuGetFeed(LightNuGetFeedSettings settings, IServerPackageRepository repository) { Ensure.Any.IsNotNull(settings, nameof(settings)); Ensure.Any.IsNotNull(repository, nameof(repository)); Slug = settings.Name.Slugify(); Settings = settings; Repository = repository; }
public PackageService( IServerPackageRepository repository, IPackageAuthenticationService authenticationService, NLog.ILogger logger) { _serverRepository = repository; _authenticationService = authenticationService; _logger = logger; }
public static async Task <IServerPackage> FindPackageAsync( this IServerPackageRepository repository, string id, SemanticVersion version, CancellationToken token) { var packages = await repository.FindPackagesByIdAsync(id, ClientCompatibility.Max, token); return(packages.FirstOrDefault(p => p.Version.Equals(version))); }
public static async Task <IEnumerable <IServerPackage> > FindPackagesByIdAsync( this IServerPackageRepository repository, string id, ClientCompatibility compatibility, CancellationToken token) { var packages = await repository.GetPackagesAsync(compatibility, token); return(packages.Where(p => StringComparer.OrdinalIgnoreCase.Equals(p.Id, id))); }
public static async Task <bool> ExistsAsync( this IServerPackageRepository repository, string id, SemanticVersion version, CancellationToken token) { var package = await repository.FindPackageAsync(id, version, token); return(package != null); }
public static async Task <IServerPackage> FindPackageAsync( this IServerPackageRepository repository, string id, ClientCompatibility compatibility, CancellationToken token) { var packages = await repository.FindPackagesByIdAsync(id, compatibility, token); return(packages .OrderByDescending(p => p.Version) .FirstOrDefault()); }
public static async Task <IEnumerable <IServerPackage> > SearchAsync( this IServerPackageRepository repository, string searchTerm, bool allowPrereleaseVersions, ClientCompatibility compatibility, CancellationToken token) { return(await repository.SearchAsync( searchTerm, Enumerable.Empty <string>(), allowPrereleaseVersions, compatibility, token)); }
public PackageContext(IServerPackageRepository repository) { _repository = repository; }
public PackageService(IServerPackageRepository repository, IPackageAuthenticationService authenticationService) { _serverRepository = repository; _authenticationService = authenticationService; }
public PackageController() { _repository = ServiceResolver.Current.Get <IServerPackageRepository>(); }
public static IEnumerable <IPackage> GetUpdatesCore( this IServerPackageRepository repository, IEnumerable <IPackageName> packages, bool includePrerelease, bool includeAllVersions, IEnumerable <FrameworkName> targetFramework, IEnumerable <VersionRange> versionConstraints, ClientCompatibility compatibility) { List <IPackageName> packageList = packages.ToList(); if (!packageList.Any()) { return(Enumerable.Empty <IPackage>()); } IList <VersionRange> versionConstraintList; if (versionConstraints == null) { versionConstraintList = new VersionRange[packageList.Count]; } else { versionConstraintList = versionConstraints.ToList(); } if (packageList.Count != versionConstraintList.Count) { throw new ArgumentException("The 'packages' and 'versionConstraints' parameters must have the same number of elements."); } // These are the packages that we need to look at for potential updates. ILookup <string, IPackage> sourcePackages = GetUpdateCandidates( repository, packageList, includePrerelease, compatibility) .ToList() .ToLookup(package => package.Id, StringComparer.OrdinalIgnoreCase); var results = new List <IPackage>(); for (int i = 0; i < packageList.Count; i++) { var package = packageList[i]; var constraint = versionConstraintList[i]; var updates = from candidate in sourcePackages[package.Id] where (candidate.Version > package.Version) && SupportsTargetFrameworks(targetFramework, candidate) && (constraint == null || constraint.Satisfies(candidate.Version)) select candidate; results.AddRange(updates); } if (!includeAllVersions) { return(CollapseById(results)); } return(results); }
public PackageService(IServerPackageRepository repository, IPackageAuthenticationService authenticationService) { _serverRepository = repository; _authenticationService = authenticationService; }
public PackageContext(IServerPackageRepository repository) { _repository = repository; }
public TestableNuGetODataController(IServerPackageRepository serverPackageRepository) : base(serverPackageRepository, null) { }
public static async Task <IEnumerable <IServerPackage> > GetUpdatesAsync( this IServerPackageRepository repository, IEnumerable <IPackageName> packages, bool includePrerelease, bool includeAllVersions, IEnumerable <FrameworkName> targetFramework, IEnumerable <IVersionSpec> versionConstraints, ClientCompatibility compatibility, CancellationToken token) { List <IPackageName> packageList = packages.ToList(); if (!packageList.Any()) { return(Enumerable.Empty <IServerPackage>()); } IList <IVersionSpec> versionConstraintList; if (versionConstraints == null) { versionConstraintList = new IVersionSpec[packageList.Count]; } else { versionConstraintList = versionConstraints.ToList(); } if (packageList.Count != versionConstraintList.Count) { throw new ArgumentException(Strings.GetUpdatesParameterMismatch); } // These are the packages that we need to look at for potential updates. var candidates = await GetUpdateCandidatesAsync( repository, packageList, includePrerelease, compatibility, token); ILookup <string, IServerPackage> sourcePackages = candidates .ToList() .ToLookup(package => package.Id, StringComparer.OrdinalIgnoreCase); var results = new List <IServerPackage>(); for (int i = 0; i < packageList.Count; i++) { var package = packageList[i]; var constraint = versionConstraintList[i]; var updates = from candidate in sourcePackages[package.Id] where (candidate.Version > package.Version) && SupportsTargetFrameworks(targetFramework, candidate) && (constraint == null || constraint.Satisfies(candidate.Version)) select candidate; results.AddRange(updates); } if (!includeAllVersions) { return(CollapseById(results)); } return(results); }
public SymbolPackageService(IServerPackageRepository repository, IPackageAuthenticationService authenticationService) : base(repository, authenticationService) { }