forked from chocolatey/choco
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16fe0c8
commit d20fc60
Showing
7 changed files
with
265 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
src/chocolatey/infrastructure.app/nuget/ChocolateyPackage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
// Copyright © 2011 - Present RealDimensions Software, LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace chocolatey.infrastructure.app.nuget | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Runtime.Versioning; | ||
using NuGet; | ||
|
||
public class ChocolateyPackage : IPackage | ||
{ | ||
private readonly IPackage _package; | ||
|
||
public ChocolateyPackage(IPackage package) | ||
{ | ||
_package = package; | ||
} | ||
|
||
public string Id { get; set; } | ||
public SemanticVersion Version { get; set; } | ||
public Uri ProjectSourceUrl { get; set; } | ||
public Uri PackageSourceUrl { get; set; } | ||
public Uri DocsUrl { get; set; } | ||
public Uri WikiUrl { get; set; } | ||
public Uri MailingListUrl { get; set; } | ||
public Uri BugTrackerUrl { get; set; } | ||
public IEnumerable<string> Replaces { get; set; } | ||
public IEnumerable<string> Provides { get; set; } | ||
public IEnumerable<string> Conflicts { get; set; } | ||
public string Title { get; set; } | ||
public IEnumerable<string> Authors { get; set; } | ||
public IEnumerable<string> Owners { get; set; } | ||
public Uri IconUrl { get; set; } | ||
public Uri LicenseUrl { get; set; } | ||
public Uri ProjectUrl { get; set; } | ||
public bool RequireLicenseAcceptance { get; set; } | ||
public bool DevelopmentDependency { get; set; } | ||
public string Description { get; set; } | ||
public string Summary { get; set; } | ||
public string ReleaseNotes { get; set; } | ||
public string Language { get; set; } | ||
public string Tags { get; set; } | ||
public string Copyright { get; set; } | ||
public IEnumerable<FrameworkAssemblyReference> FrameworkAssemblies { get; set; } | ||
public ICollection<PackageReferenceSet> PackageAssemblyReferences { get; set; } | ||
public IEnumerable<PackageDependencySet> DependencySets { get; set; } | ||
public Version MinClientVersion { get; set; } | ||
public string PackageHash { get; set; } | ||
public string PackageHashAlgorithm { get; set; } | ||
public long PackageSize { get; set; } | ||
public int VersionDownloadCount { get; set; } | ||
public bool IsApproved { get; set; } | ||
public string PackageStatus { get; set; } | ||
public string PackageSubmittedStatus { get; set; } | ||
public string PackageTestResultStatus { get; set; } | ||
public DateTime? PackageTestResultStatusDate { get; set; } | ||
public string PackageValidationResultStatus { get; set; } | ||
public DateTime? PackageValidationResultDate { get; set; } | ||
public DateTime? PackageCleanupResultDate { get; set; } | ||
public DateTime? PackageReviewedDate { get; set; } | ||
public DateTime? PackageApprovedDate { get; set; } | ||
public string PackageReviewer { get; set; } | ||
public bool IsDownloadCacheAvailable { get; set; } | ||
public DateTime? DownloadCacheDate { get; set; } | ||
public IEnumerable<DownloadCache> DownloadCache { get; set; } | ||
public Uri ReportAbuseUrl { get; set; } | ||
public int DownloadCount { get; set; } | ||
|
||
public bool IsAbsoluteLatestVersion { get; set; } | ||
public bool IsLatestVersion { get; set; } | ||
public bool Listed { get; set; } | ||
public DateTimeOffset? Published { get; set; } | ||
public IEnumerable<IPackageAssemblyReference> AssemblyReferences { get; set; } | ||
|
||
|
||
public IEnumerable<IPackageFile> GetFiles() | ||
{ | ||
if (_package != null) return _package.GetFiles(); | ||
|
||
throw new NotImplementedException("If there is no underlying package passed in, ChocolateyPackage doesn't yet support this method call."); | ||
} | ||
|
||
public IEnumerable<FrameworkName> GetSupportedFrameworks() | ||
{ | ||
if (_package != null) return _package.GetSupportedFrameworks(); | ||
|
||
throw new NotImplementedException("If there is no underlying package passed in, ChocolateyPackage doesn't yet support this method call."); | ||
} | ||
|
||
public Stream GetStream() | ||
{ | ||
if (_package != null) return _package.GetStream(); | ||
|
||
throw new NotImplementedException("If there is no underlying package passed in, ChocolateyPackage doesn't yet support this method call."); | ||
} | ||
|
||
public void ExtractContents(IFileSystem fileSystem, string extractPath) | ||
{ | ||
if (_package != null) _package.ExtractContents(fileSystem, extractPath); | ||
} | ||
|
||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
src/chocolatey/infrastructure.app/nuget/ChocolateyPackageDownloader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Copyright © 2011 - Present RealDimensions Software, LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace chocolatey.infrastructure.app.nuget | ||
{ | ||
using System; | ||
using System.Globalization; | ||
using System.IO; | ||
using NuGet; | ||
using NuGet.Resources; | ||
|
||
// ReSharper disable InconsistentNaming | ||
|
||
//public sealed class ChocolateyPackageDownloader : PackageDownloader, IPackageDownloader | ||
//{ | ||
// private const string DefaultUserAgentClient = "Chocolatey Core"; | ||
|
||
// public override void DownloadPackage(Uri uri, IPackageMetadata package, Stream targetStream) | ||
// { | ||
// if (uri == null) | ||
// { | ||
// throw new ArgumentNullException("uri"); | ||
// } | ||
|
||
// var downloadClient = new HttpClient(uri) | ||
// { | ||
// UserAgent = HttpUtility.CreateUserAgentString(DefaultUserAgentClient) | ||
// }; | ||
// DownloadPackage(downloadClient, package, targetStream); | ||
// } | ||
|
||
// public override void DownloadPackage(IHttpClient downloadClient, IPackageName package, Stream targetStream) | ||
// { | ||
// if (downloadClient == null) | ||
// { | ||
// throw new ArgumentNullException("downloadClient"); | ||
// } | ||
|
||
// if (targetStream == null) | ||
// { | ||
// throw new ArgumentNullException("targetStream"); | ||
// } | ||
|
||
// // Get the operation display text | ||
// string operation = String.Format(CultureInfo.CurrentCulture, NuGetResources.DownloadProgressStatus, package.Id, package.Version); | ||
// CurrentDownloadPackageId = package.Id; | ||
|
||
// EventHandler<ProgressEventArgs> progressAvailableHandler = (sender, e) => { OnPackageDownloadProgress(new ProgressEventArgs(operation, e.PercentComplete)); }; | ||
|
||
// try | ||
// { | ||
// downloadClient.ProgressAvailable += progressAvailableHandler; | ||
// downloadClient.SendingRequest += OnSendingRequest; | ||
|
||
// downloadClient.DownloadData(targetStream); | ||
// } | ||
// finally | ||
// { | ||
// downloadClient.ProgressAvailable -= progressAvailableHandler; | ||
// downloadClient.SendingRequest -= OnSendingRequest; | ||
// CurrentDownloadPackageId = null; | ||
// } | ||
// } | ||
|
||
// protected override void OnPackageDownloadProgress(ProgressEventArgs e) | ||
// { | ||
// ProgressAvailable(this, e); | ||
// } | ||
|
||
// protected override void OnSendingRequest(object sender, WebRequestEventArgs webRequestArgs) | ||
// { | ||
// SendingRequest(this, webRequestArgs); | ||
// } | ||
//} | ||
|
||
// ReSharper restore InconsistentNaming | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.