Skip to content

Commit

Permalink
Merge pull request #314 from betgenius/master
Browse files Browse the repository at this point in the history
Generate other dependency version reqs in lockfile
  • Loading branch information
forki committed Oct 30, 2014
2 parents e6026fb + e1faad7 commit 35337fe
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/Paket.Core/LockFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ open Paket.PackageSources
module LockFileSerializer =
/// [omit]
let formatVersionRange (version : VersionRequirement) =
match version.Range with
| Minimum v -> ">= " + v.ToString()
| Specific v -> v.ToString()
| Range(_, v1, v2, _) -> ">= " + v1.ToString() + ", < " + v2.ToString()
version.ToString()

/// [omit]
let serializePackages options (resolved : PackageResolution) =
Expand Down
32 changes: 31 additions & 1 deletion tests/Paket.Tests/Lockfile/GeneratorSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,34 @@ let ``should generate lock file for RavenDB.Client``() =
let cfg = DependenciesFile.FromCode(config2)
cfg.Resolve(noSha1,VersionsFromGraph graph2, PackageDetailsFromGraph graph2).ResolvedPackages.GetModelOrFail()
|> LockFileSerializer.serializePackages cfg.Options
|> shouldEqual (normalizeLineEndings expected2)
|> shouldEqual (normalizeLineEndings expected2)

let config3 = """
source "http://nuget.org/api/v2"
nuget "OtherVersionRanges.Package" "~> 1.0" """

let graph3 = [
"OtherVersionRanges.Package","1.0", ["LessThan.Package", VersionRequirement(VersionRange.LessThan(SemVer.Parse "2.0"), PreReleaseStatus.No)]
"LessThan.Package","1.9",["GreaterThan.Package", VersionRequirement(VersionRange.GreaterThan(SemVer.Parse "2.0"), PreReleaseStatus.No)]
"GreaterThan.Package","2.1",["Maximum.Package", VersionRequirement(VersionRange.Maximum(SemVer.Parse "3.0"), PreReleaseStatus.No)]
"Maximum.Package","2.9",[]
]

let expected3 = """NUGET
remote: http://nuget.org/api/v2
specs:
GreaterThan.Package (2.1)
Maximum.Package (<= 3.0)
LessThan.Package (1.9)
GreaterThan.Package (> 2.0)
Maximum.Package (2.9)
OtherVersionRanges.Package (1.0)
LessThan.Package (< 2.0)"""

[<Test>]
let ``should generate other version ranges for packages``() =
let cfg = DependenciesFile.FromCode(config3)
cfg.Resolve(noSha1,VersionsFromGraph graph3, PackageDetailsFromGraph graph3).ResolvedPackages.GetModelOrFail()
|> LockFileSerializer.serializePackages cfg.Options
|> shouldEqual (normalizeLineEndings expected3)

0 comments on commit 35337fe

Please sign in to comment.