Skip to content

Commit

Permalink
Prepare for #327
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Nov 3, 2014
1 parent 8daaec2 commit 4fb298d
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/Paket.Core/Nuget.fs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type NugetPackageCache =
{ Dependencies : (string * VersionRequirement * (FrameworkIdentifier option)) list
Name : string
SourceUrl: string
Unlisted : bool
DownloadUrl : string}

let rec private followODataLink auth url =
Expand Down Expand Up @@ -141,7 +142,11 @@ let getODataDetails nugetURL raw =
|> Array.map (fun (name, version, restricted) -> name, NugetVersionRangeParser.parse version, restricted)
|> Array.toList

{ Name = officialName; DownloadUrl = downloadLink; Dependencies = packages; SourceUrl = nugetURL }
{ Name = officialName
DownloadUrl = downloadLink
Dependencies = packages
SourceUrl = nugetURL
Unlisted = false }

/// Gets package details from Nuget via OData
let getDetailsFromNugetViaOData auth nugetURL package version =
Expand Down Expand Up @@ -210,7 +215,12 @@ let getDetailsFromLocalFile path package version =

File.Delete(fileName)

return { Name = nuspec.OfficialName; DownloadUrl = package; Dependencies = nuspec.Dependencies; SourceUrl = path }
return
{ Name = nuspec.OfficialName
DownloadUrl = package
Dependencies = nuspec.Dependencies
SourceUrl = path
Unlisted = false }
}


Expand Down Expand Up @@ -366,6 +376,7 @@ let GetPackageDetails force sources package version : PackageResolver.PackageDet
{ Name = nugetObject.Name
Source = source
DownloadLink = nugetObject.DownloadUrl
Unlisted = nugetObject.Unlisted
DirectDependencies = nugetObject.Dependencies |> Set.ofList }

/// Allows to retrieve all version no. for a package from the given sources.
Expand Down
1 change: 1 addition & 0 deletions src/Paket.Core/PackageResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type PackageDetails =
{ Name : string
Source : PackageSource
DownloadLink : string
Unlisted : bool
DirectDependencies : (string * VersionRequirement * (FrameworkIdentifier option)) Set }

/// Represents data about resolved packages
Expand Down
2 changes: 1 addition & 1 deletion src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<WarningLevel>3</WarningLevel>
<DocumentationFile>..\..\bin\Paket.xml</DocumentationFile>
<StartArguments>update -f</StartArguments>
<StartWorkingDirectory>D:\code\PaketKopie</StartWorkingDirectory>
<StartWorkingDirectory>D:\code\paketkopie</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
Expand Down
13 changes: 13 additions & 0 deletions tests/Paket.Tests/NuGetOData/ODataSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,27 @@ let ``can detect explicit dependencies for Fantomas``() =
{ Name = "Fantomas"
DownloadUrl = "http://www.nuget.org/api/v2/package/Fantomas/1.6.0"
Dependencies = ["FSharp.Compiler.Service",DependenciesFileParser.parseVersionRequirement(">= 0.0.73"), None]
Unlisted = false
SourceUrl = fakeUrl }

[<Test>]
let ``can detect explicit dependencies for Rx-PlaformServices``() =
parse "NuGetOData/Rx-PlatformServices.xml"
|> shouldEqual
{ Name = "Rx-PlatformServices"
DownloadUrl = "http://www.nuget.org/api/v2/package/Rx-PlatformServices/2.3.0"
Dependencies = ["Rx-Interfaces",DependenciesFileParser.parseVersionRequirement(">= 2.2"), None
"Rx-Core",DependenciesFileParser.parseVersionRequirement(">= 2.2"), None]
Unlisted = false
SourceUrl = fakeUrl }

[<Test>]
let ``can detect explicit dependencies for Fleece``() =
parse "NuGetOData/Fleece.xml"
|> shouldEqual
{ Name = "Fleece"
DownloadUrl = "http://www.nuget.org/api/v2/package/Fleece/0.4.0"
Unlisted = false
Dependencies =
["FSharpPlus",DependenciesFileParser.parseVersionRequirement(">= 0.0.4"), None
"ReadOnlyCollectionInterfaces",DependenciesFileParser.parseVersionRequirement("1.0.0"), None
Expand All @@ -41,6 +53,7 @@ let ``can detect explicit dependencies for ReadOnlyCollectionExtensions``() =
|> shouldEqual
{ Name = "ReadOnlyCollectionExtensions"
DownloadUrl = "http://www.nuget.org/api/v2/package/ReadOnlyCollectionExtensions/1.2.0"
Unlisted = false
Dependencies =
["LinqBridge",DependenciesFileParser.parseVersionRequirement(">= 1.3.0"), Some(DotNetFramework(FrameworkVersion.V2))
"ReadOnlyCollectionInterfaces",DependenciesFileParser.parseVersionRequirement("1.0.0"), Some(DotNetFramework(FrameworkVersion.V2))
Expand Down
46 changes: 46 additions & 0 deletions tests/Paket.Tests/NuGetOData/Rx-PlatformServices.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="http://www.nuget.org/api/v2/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<id>http://www.nuget.org/api/v2/Packages(Id='Rx-PlatformServices',Version='2.3')</id>
<category term="NuGetGallery.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="V2FeedPackage" href="Packages(Id='Rx-PlatformServices',Version='2.3')" />
<title type="text">Rx-PlatformServices</title>
<summary type="text"></summary>
<updated>2014-08-21T19:17:53Z</updated>
<author>
<name>Microsoft</name>
</author>
<link rel="edit-media" title="V2FeedPackage" href="Packages(Id='Rx-PlatformServices',Version='2.3')/$value" />
<content type="application/zip" src="http://www.nuget.org/api/v2/package/Rx-PlatformServices/2.3.0" />
<m:properties>
<d:Version>2.3</d:Version>
<d:NormalizedVersion>2.3.0</d:NormalizedVersion>
<d:Copyright>Copyright (C) Microsoft Corporation</d:Copyright>
<d:Created m:type="Edm.DateTime">2014-01-27T19:28:43.397</d:Created>
<d:Dependencies>Rx-Interfaces:2.2:|Rx-Core:2.2:</d:Dependencies>
<d:Description>Reactive Extensions Platform Services Library used to access platform-specific functionality and enlightenment services.</d:Description>
<d:DownloadCount m:type="Edm.Int32">260453</d:DownloadCount>
<d:GalleryDetailsUrl>http://www.nuget.org/packages/Rx-PlatformServices/2.3.0</d:GalleryDetailsUrl>
<d:IconUrl>http://go.microsoft.com/fwlink/?LinkId=261274</d:IconUrl>
<d:IsLatestVersion m:type="Edm.Boolean">false</d:IsLatestVersion>
<d:IsAbsoluteLatestVersion m:type="Edm.Boolean">false</d:IsAbsoluteLatestVersion>
<d:IsPrerelease m:type="Edm.Boolean">false</d:IsPrerelease>
<d:Language>en-US</d:Language>
<d:Published m:type="Edm.DateTime">2014-01-27T19:28:43.397</d:Published>
<d:PackageHash>H3aiFtRAsdG2mN5O6p/tvOiDbRRISYEQAnTDJGheX9Kmal0YS3txJbqlOuOtJB6XbkVA7/vtvdsWDswSKItFyA==</d:PackageHash>
<d:PackageHashAlgorithm>SHA512</d:PackageHashAlgorithm>
<d:PackageSize m:type="Edm.Int64">196416</d:PackageSize>
<d:ProjectUrl>http://go.microsoft.com/fwlink/?LinkId=261273</d:ProjectUrl>
<d:ReportAbuseUrl>http://www.nuget.org/package/ReportAbuse/Rx-PlatformServices/2.3.0</d:ReportAbuseUrl>
<d:ReleaseNotes m:null="true" />
<d:RequireLicenseAcceptance m:type="Edm.Boolean">true</d:RequireLicenseAcceptance>
<d:Summary m:null="true" />
<d:Tags>Rx Reactive Extensions Observable LINQ Events</d:Tags>
<d:Title>Reactive Extensions - Platform Services Library</d:Title>
<d:VersionDownloadCount m:type="Edm.Int32">357</d:VersionDownloadCount>
<d:MinClientVersion m:null="true" />
<d:LastEdited m:type="Edm.DateTime">2014-01-27T19:32:41.41</d:LastEdited>
<d:LicenseUrl>http://go.microsoft.com/fwlink/?LinkID=261272</d:LicenseUrl>
<d:LicenseNames>MS-EULA</d:LicenseNames>
<d:LicenseReportUrl></d:LicenseReportUrl>
</m:properties>
</entry>
3 changes: 3 additions & 0 deletions tests/Paket.Tests/Paket.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@
</Content>
<Content Include="NuGetOData\ReadOnlyCollectionExtensions.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="NuGetOData\Rx-PlatformServices.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Compile Include="NuGetOData\ODataSpecs.fs" />
<Content Include="NuGetConfig\ClearTextPasswordConfig.xml">
Expand Down
1 change: 1 addition & 0 deletions tests/Paket.Tests/TestHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ let PackageDetailsFromGraph (graph : seq<string * string * (string * VersionRequ
{ Name = name
Source = Seq.head sources
DownloadLink = ""
Unlisted = false
DirectDependencies = Set.ofList dependencies }

let VersionsFromGraph (graph : seq<string * string * (string * VersionRequirement) list>) (sources, package : string) =
Expand Down

0 comments on commit 4fb298d

Please sign in to comment.