public ReleaseResource GetRelease(ProjectResource project, SemanticVersion version) { if (_cache.TryGetValue(CacheKey(CacheKeyType.Release, project.Id, version.ToNormalizedString()), out ReleaseResource release)) { return(release); } TrackCacheEvent(CacheKeyType.Release, project.Id + ";" + version.ToNormalizedString()); return(ListReleases(project).SingleOrDefault(package => { var packageVesion = package.Version.ToSemanticVersion(); return string.Equals(version.ToOriginalString(), packageVesion.ToOriginalString(), StringComparison.OrdinalIgnoreCase) || string.Equals(version.ToNormalizedString(), packageVesion.ToNormalizedString(), StringComparison.OrdinalIgnoreCase) || string.Equals(version.ToFullString(), packageVesion.ToFullString(), StringComparison.OrdinalIgnoreCase); })); }
public void VersionLength(string version) { // Arrange & Act var semVer = new SemanticVersion(version); Assert.Equal("2.0.0", semVer.ToNormalizedString()); }
public static bool IsUnzippedPackageManifest(string path, string packageId, SemanticVersion packageVersion) { var fileName = Path.GetFileName(path); var expectedFileName = packageId + "." + packageVersion.ToNormalizedString() + Constants.ManifestExtension; return(fileName != null && string.Equals(fileName, expectedFileName, StringComparison.OrdinalIgnoreCase)); }
public ReleaseResource GetRelease(ProjectResource project, SemanticVersion semver) { var version = semver.ToNormalizedString(); if (_cache.TryGetValue(CacheKey(CacheKeyType.Release, project.Id, version), out ReleaseResource release)) { return(release); } return(ListReleases(project).SingleOrDefault(package => string.Equals(version, package.Version.ToSemanticVersion().ToNormalizedString(), StringComparison.OrdinalIgnoreCase) || string.Equals(semver.ToOriginalString(), package.Version, StringComparison.OrdinalIgnoreCase))); }
public UnzippedPackage(IFileSystem repositoryFileSystem, string packageId, SemanticVersion version) { if (repositoryFileSystem == null) { throw new ArgumentNullException("repositoryFileSystem"); } if (String.IsNullOrEmpty(packageId)) { throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "packageId"); } if (version == null) { throw new ArgumentNullException("version"); } _repositoryFileSystem = repositoryFileSystem; _packagePath = Path.Combine(packageId, version.ToNormalizedString()); _packageFileName = Path.Combine(_packagePath, packageId + "." + version.ToNormalizedString() + Constants.PackageExtension); EnsureManifest(Path.Combine(_packagePath, packageId + Constants.ManifestExtension)); }
private static string GetPackagePath(string packageId, SemanticVersion version) { return(Path.Combine( GetPackageRoot(packageId, version), packageId + "." + version.ToNormalizedString() + Constants.PackageExtension)); }
private static string GetPackageRoot(string packageId, SemanticVersion version) { return(Path.Combine(packageId, version.ToNormalizedString())); }