public virtual string GetPackageDirectory(string packageId, SemanticVersion version) { string directory = packageId; if (_useSideBySidePaths) { directory = Path.Combine(directory, version.ToString()); } return(directory); }
public override bool Exists(string packageId, SemanticVersion version) { if (version != null) { // optimization: if we find the sub-directory with the name "id.version", consider it exists string folderPath = packageId + "." + version.ToString(); if (FileSystem.DirectoryExists(folderPath)) { return(true); } } return(FindPackage(packageId, version) != null); }
public static IEnumerable <string> GetComparableVersionStrings(this SemanticVersion version) { Version coreVersion = version.Version; string specialVersion = String.IsNullOrEmpty(version.SpecialVersion) ? String.Empty : "-" + version.SpecialVersion; string originalVersion = version.ToString(); string[] originalVersionComponents = version.GetOriginalVersionComponents(); var paths = new LinkedList <string>(); if (coreVersion.Revision == 0) { if (coreVersion.Build == 0) { string twoComponentVersion = String.Format( CultureInfo.InvariantCulture, "{0}.{1}{2}", originalVersionComponents[0], originalVersionComponents[1], specialVersion); AddVersionToList(originalVersion, paths, twoComponentVersion); } string threeComponentVersion = String.Format( CultureInfo.InvariantCulture, "{0}.{1}.{2}{3}", originalVersionComponents[0], originalVersionComponents[1], originalVersionComponents[2], specialVersion); AddVersionToList(originalVersion, paths, threeComponentVersion); } string fullVersion = String.Format( CultureInfo.InvariantCulture, "{0}.{1}.{2}.{3}{4}", originalVersionComponents[0], originalVersionComponents[1], originalVersionComponents[2], originalVersionComponents[3], specialVersion); AddVersionToList(originalVersion, paths, fullVersion); return(paths); }
public static IEnumerable <string> GetComparableVersionStrings(this SemanticVersion version) { Version version2 = version.Version; string str = string.IsNullOrEmpty(version.SpecialVersion) ? string.Empty : ("-" + version.SpecialVersion); string originalVersion = version.ToString(); string[] originalVersionComponents = version.GetOriginalVersionComponents(); LinkedList <string> paths = new LinkedList <string>(); if (version2.Revision == 0) { if (version2.Build == 0) { object[] objArray1 = new object[] { originalVersionComponents[0], originalVersionComponents[1], str }; AddVersionToList(originalVersion, paths, string.Format(CultureInfo.InvariantCulture, "{0}.{1}{2}", objArray1)); } object[] objArray2 = new object[] { originalVersionComponents[0], originalVersionComponents[1], originalVersionComponents[2], str }; AddVersionToList(originalVersion, paths, string.Format(CultureInfo.InvariantCulture, "{0}.{1}.{2}{3}", objArray2)); } object[] args = new object[] { originalVersionComponents[0], originalVersionComponents[1], originalVersionComponents[2], originalVersionComponents[3], str }; AddVersionToList(originalVersion, paths, string.Format(CultureInfo.InvariantCulture, "{0}.{1}.{2}.{3}{4}", args)); return(paths); }
void AddUnsafeUpdateOperation( string id, SemanticVersion version, bool targetVersionSetExplicitly, IProjectManager projectManager) { var oldPackage = projectManager.LocalRepository.FindPackage(id); if (oldPackage == null) { return; } Logger.Log(MessageLevel.Debug, NuGetResources.Debug_LookingForUpdates, id); var package = projectManager.PackageManager.SourceRepository.FindPackage( id, version, projectManager.ConstraintProvider, AllowPrereleaseVersions, allowUnlisted: false); // the condition (allowPrereleaseVersions || targetVersionSetExplicitly || oldPackage.IsReleaseVersion() || !package.IsReleaseVersion() || oldPackage.Version < package.Version) // is to fix bug 1574. We want to do nothing if, let's say, you have package 2.0alpha installed, and you do: // update-package // without specifying a version explicitly, and the feed only has version 1.0 as the latest stable version. if (package != null && oldPackage.Version != package.Version && (AllowPrereleaseVersions || targetVersionSetExplicitly || oldPackage.IsReleaseVersion() || !package.IsReleaseVersion() || oldPackage.Version < package.Version)) { Logger.Log(MessageLevel.Info, NuGetResources.Log_UpdatingPackages, package.Id, oldPackage.Version, package.Version, projectManager.Project.ProjectName); Resolver.AddOperation(PackageAction.Install, package, projectManager); } else { throw new Exception(String.Format(NuGetResources.InvalidVersionString, version.ToString())); } // Display message that no updates are available. IVersionSpec constraint = projectManager.ConstraintProvider.GetConstraint(package.Id); if (constraint != null) { Logger.Log(MessageLevel.Info, NuGetResources.Log_ApplyingConstraints, package.Id, VersionUtility.PrettyPrint(constraint), projectManager.ConstraintProvider.Source); } Logger.Log( MessageLevel.Info, NuGetResources.Log_NoUpdatesAvailableForProject, package.Id, projectManager.Project.ProjectName); }
private static string GetPackageFileName(string packageId, SemanticVersion version) { return(packageId + "." + version.ToString()); }
public void OverrideOriginalVersion(SemanticVersion version) { if (version != null) Version = version.ToString(); }
void AddUnsafeUpdateOperation( string id, SemanticVersion version, bool targetVersionSetExplicitly, IProjectManager projectManager) { Logger.Log(MessageLevel.Debug, NuGetResources.Debug_LookingForUpdates, id); var package = projectManager.PackageManager.SourceRepository.FindPackage( id, version, projectManager.ConstraintProvider, AllowPrereleaseVersions, allowUnlisted: false); if (package != null) { Logger.Log(MessageLevel.Info, NuGetResources.Log_UpdatingPackages, package.Id, package.Version, projectManager.Project.ProjectName); Resolver.AddOperation(PackageAction.Install, package, projectManager); } else { throw new Exception(String.Format(NuGetResources.InvalidVersionString, version.ToString())); } // Display message that no updates are available. IVersionSpec constraint = projectManager.ConstraintProvider.GetConstraint(package.Id); if (constraint != null) { Logger.Log(MessageLevel.Info, NuGetResources.Log_ApplyingConstraints, package.Id, VersionUtility.PrettyPrint(constraint), projectManager.ConstraintProvider.Source); } Logger.Log( MessageLevel.Info, NuGetResources.Log_NoUpdatesAvailableForProject, package.Id, projectManager.Project.ProjectName); }
public virtual string GetPackageDirectory(string packageId, SemanticVersion version) { return(Path.Combine(packageId, version.ToString())); }