Skip to content

Commit

Permalink
(GH-12) add software display name / version
Browse files Browse the repository at this point in the history
Add fields based on the registry name for software being installed to
make it easier to evaluate what is being created. This facilitates the
ability to know ahead of time what is being added to the registry and
what version it shows.
  • Loading branch information
ferventcoder committed Mar 21, 2017
1 parent 6bd1088 commit b9c4bc5
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Core/Authoring/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ private static Manifest CreateManifestWithMetadata(IPackageMetadata metadata)
Replaces = GetCommaSeparatedString(metadata.Replaces),
Provides = GetCommaSeparatedString(metadata.Provides),
Conflicts = GetCommaSeparatedString(metadata.Conflicts),
SoftwareDisplayName = metadata.SoftwareDisplayName.SafeTrim(),
SoftwareDisplayVersion = metadata.SoftwareDisplayVersion.SafeTrim(),
IconUrl = ConvertUrlToStringSafe(metadata.IconUrl),
RequireLicenseAcceptance = metadata.RequireLicenseAcceptance,
DevelopmentDependency = metadata.DevelopmentDependency,
Expand Down
7 changes: 6 additions & 1 deletion src/Core/Authoring/ManifestMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ public string Owners
[XmlElement("tags")]
public string Tags { get; set; }

[XmlElement("softwareDisplayName")]
public string SoftwareDisplayName { get; set; }

[XmlElement("softwareDisplayVersion")]
public string SoftwareDisplayVersion { get; set; }

[SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings", Justification = "Xml deserialziation can't handle uris")]
[XmlElement("projectSourceUrl")]
public string ProjectSourceUrl { get; set; }
Expand Down Expand Up @@ -617,6 +623,5 @@ private static PackageDependencySet CreatePackageDependencySet(ManifestDependenc
return new PackageDependencySet(targetFramework, dependencies);
}


}
}
6 changes: 6 additions & 0 deletions src/Core/Authoring/ManifestReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ private static void ReadMetadataValue(ManifestMetadata manifestMetadata, XElemen
break;
case "conflicts":
manifestMetadata.Conflicts = value;
break;
case "softwareDisplayName":
manifestMetadata.SoftwareDisplayName = value;
break;
case "softwareDisplayVersion":
manifestMetadata.SoftwareDisplayVersion = value;
break;
case "dependencies":
manifestMetadata.DependencySets = ReadDependencySets(element);
Expand Down
8 changes: 7 additions & 1 deletion src/Core/Authoring/PackageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ public ISet<string> Tags
public ISet<string> Provides { get; set; }
public ISet<string> Conflicts { get; set; }

public string SoftwareDisplayName { get; set; }
public string SoftwareDisplayVersion { get; set; }

public string Copyright
{
get;
Expand Down Expand Up @@ -491,7 +494,10 @@ public void Populate(ManifestMetadata manifestMetadata)
Replaces.AddRange(metadata.Replaces);
Provides.AddRange(metadata.Provides);
Conflicts.AddRange(metadata.Conflicts);


SoftwareDisplayName = metadata.SoftwareDisplayName;
SoftwareDisplayVersion = metadata.SoftwareDisplayVersion;

if (metadata.Tags != null)
{
Tags.AddRange(ParseTags(metadata.Tags));
Expand Down
2 changes: 2 additions & 0 deletions src/Core/Authoring/nuspec.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
<xs:element name="replaces" maxOccurs="1" minOccurs="0" type="xs:string" />
<xs:element name="provides" maxOccurs="1" minOccurs="0" type="xs:string" />
<xs:element name="conflicts" maxOccurs="1" minOccurs="0" type="xs:string" />
<xs:element name="softwareDisplayName" maxOccurs="1" minOccurs="0" type="xs:string" />
<xs:element name="softwareDisplayVersion" maxOccurs="1" minOccurs="0" type="xs:string" />
<xs:element name="iconUrl" maxOccurs="1" minOccurs="0" type="xs:anyURI" />
<xs:element name="requireLicenseAcceptance" maxOccurs="1" minOccurs="0" type="xs:boolean" />
<xs:element name="developmentDependency" maxOccurs="1" minOccurs="0" type="xs:boolean" />
Expand Down
3 changes: 3 additions & 0 deletions src/Core/Packages/DataServicePackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ public string Dependencies
public bool IsDownloadCacheAvailable { get; set; }
public DateTime? DownloadCacheDate { get; set; }
public string DownloadCache { get; set; }

public string SoftwareDisplayName { get; set; }
public string SoftwareDisplayVersion { get; set; }

IEnumerable<DownloadCache> IServerPackageMetadata.DownloadCache
{
Expand Down
3 changes: 3 additions & 0 deletions src/Core/Packages/IChocolateyPackageMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@ public partial interface IPackageMetadata
IEnumerable<string> Replaces { get; }
IEnumerable<string> Provides { get; }
IEnumerable<string> Conflicts { get; }

string SoftwareDisplayName { get; }
string SoftwareDisplayVersion { get; }
}
}
3 changes: 3 additions & 0 deletions src/Core/Packages/LocalPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public string Tags
public IEnumerable<string> Provides { get; set; }
public IEnumerable<string> Conflicts { get; set; }

public string SoftwareDisplayName { get; set; }
public string SoftwareDisplayVersion { get; set; }

public Version MinClientVersion
{
get;
Expand Down
6 changes: 6 additions & 0 deletions src/Server/DataServices/Package.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ public Package(IPackage package, DerivedPackageData derivedData)
IsDownloadCacheAvailable = package.IsDownloadCacheAvailable;
DownloadCacheDate = package.DownloadCacheDate;
DownloadCache = String.Join("|", package.DownloadCache.Select(ConvertDownloadCacheToStrings));

SoftwareDisplayName = package.SoftwareDisplayName;
SoftwareDisplayVersion = package.SoftwareDisplayVersion;
}

internal string FullPath
Expand Down Expand Up @@ -294,6 +297,9 @@ public string MinClientVersion
public string Replaces { get; set; }
public string Provides { get; set; }
public string Conflicts { get; set; }
// round 2
public string SoftwareDisplayName { get; set; }
public string SoftwareDisplayVersion { get; set; }
#endregion

#region Server Metadata Only
Expand Down
2 changes: 1 addition & 1 deletion test/Server.Test/FeedPackageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void FeedPackageHasSameMembersAsDataServicePackage()
var excludedProperties = new[] { "Owners", "ReportAbuseUrl", "GalleryDetailsUrl", "DownloadUrl", "Rating", "RatingsCount", "Language",
"AssemblyReferences", "FrameworkAssemblies", "DependencySets", "PackageAssemblyReferences", "LicenseNames",
"LicenseNameCollection", "LicenseReportUrl", "ProjectSourceUrl", "PackageSourceUrl","DocsUrl","WikiUrl",
"MailingListUrl","BugTrackerUrl","Replaces", "Provides", "Conflicts"
"MailingListUrl","BugTrackerUrl","Replaces", "Provides", "Conflicts", "SoftwareDisplayName", "SoftwareDisplayVersion"
};
var feedPackageProperties = new HashSet<string>(typeof(NuGet.Server.DataServices.Package).GetProperties().Select(p => p.Name), StringComparer.Ordinal);
var dataServiceProperties = typeof(DataServicePackage).GetProperties()
Expand Down
2 changes: 2 additions & 0 deletions test/Test.Utility/PackageUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ public static IPackage CreatePackage(string id,
mockPackage.Setup(m => m.Replaces).Returns(new[] { String.Empty });
mockPackage.Setup(m => m.Provides).Returns(new[] { String.Empty });
mockPackage.Setup(m => m.Conflicts).Returns(new[] { String.Empty });
mockPackage.Setup(m => m.SoftwareDisplayName).Returns(String.Empty);
mockPackage.Setup(m => m.SoftwareDisplayVersion).Returns(String.Empty);
mockPackage.Setup(m => m.MinClientVersion).Returns(minClientVersion == null ? new Version() : Version.Parse(minClientVersion));
mockPackage.Setup(m => m.PackageAssemblyReferences).Returns(new PackageReferenceSet[0]);
if (!listed)
Expand Down

0 comments on commit b9c4bc5

Please sign in to comment.