Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/fsprojects/Paket into git…
Browse files Browse the repository at this point in the history
…hubcopy

Conflicts:
	RELEASE_NOTES.md
	src/Paket.Bootstrapper/Properties/AssemblyInfo.cs
	src/Paket.Core/AssemblyInfo.fs
	src/Paket/AssemblyInfo.fs
  • Loading branch information
forki committed Jun 10, 2015
2 parents a145783 + 2d47eff commit bfb2e00
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 18 deletions.
5 changes: 4 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#### 1.13.0-alpha002 - 09.06.2015
#### 1.13.0-alpha003 - 10.06.2015
* Allow link:false settings for file references in `paket.references` files

#### 1.12.1 - 10.06.2015
* BUGFIX: `paket update` did not pick latest prerelease version of indirect dependency - https://github.com/fsprojects/Paket/issues/866

#### 1.12.0 - 09.06.2015
* BUGFIX: Paket add should not update the package if it's already there
* BUGFIX: "copy_local" was not respected for indirect dependencies - https://github.com/fsprojects/Paket/issues/856
Expand Down
4 changes: 1 addition & 3 deletions src/Paket.Core/SemVer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ module SemVer =
{ Major = if l > 0 then Int32.Parse splitted.[0] else 0
Minor = if l > 1 then Int32.Parse splitted.[1] else 0
Patch = if l > 2 then Int32.Parse splitted.[2] else 0
PreRelease =

PreRelease.TryParse(prerelease)
PreRelease = PreRelease.TryParse prerelease
Build = if l > 3 then splitted.[3] else "0"
PreReleaseBuild = prereleaseBuild
Original = Some version }
19 changes: 15 additions & 4 deletions src/Paket.Core/VersionRange.fs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ type VersionRequirement =
static member Parse (text:string) =
if text = null || text = "" || text = "null" then VersionRequirement.AllReleases else

let prereleases = ref PreReleaseStatus.No
let analyzeVersion text =
let v = SemVer.Parse text
match v.PreRelease with
| Some _ -> prereleases := PreReleaseStatus.All
| _ -> prereleases := PreReleaseStatus.No
v

let parseRange (text:string) =
let failParse() = failwithf "unable to parse %s" text

Expand All @@ -154,8 +162,8 @@ type VersionRequirement =
| _ -> failParse()

if not <| text.Contains "," then
if text.StartsWith "[" then Specific(text.Trim([|'['; ']'|]) |> SemVer.Parse)
else Minimum(SemVer.Parse text)
if text.StartsWith "[" then Specific(text.Trim([|'['; ']'|]) |> analyzeVersion)
else Minimum(analyzeVersion text)
else
let fromB = parseBound text.[0]
let toB = parseBound (Seq.last text)
Expand All @@ -164,7 +172,7 @@ type VersionRequirement =
.Trim([|'['; ']';'(';')'|])
.Split([|','|], StringSplitOptions.RemoveEmptyEntries)
|> Array.filter (fun s -> String.IsNullOrWhiteSpace s |> not)
|> Array.map SemVer.Parse
|> Array.map analyzeVersion

match versions.Length with
| 2 ->
Expand All @@ -182,7 +190,10 @@ type VersionRequirement =
| VersionRangeBound.Including, VersionRangeBound.Including -> Minimum(versions.[0])
| _ -> failParse()
| _ -> failParse()
VersionRequirement(parseRange text,PreReleaseStatus.No)

let range = parseRange text

VersionRequirement(range,!prereleases)

/// Represents a resolver strategy.
[<RequireQualifiedAccess>]
Expand Down
4 changes: 2 additions & 2 deletions src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<WarningLevel>3</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<StartArguments>update</StartArguments>
<StartWorkingDirectory>D:\code\PaketKopie</StartWorkingDirectory>
<StartArguments>update -f</StartArguments>
<StartWorkingDirectory>D:\code\paket-866\tst</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
Expand Down
4 changes: 4 additions & 0 deletions tests/Paket.Tests/FilterVersionSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ open FsUnit
let isInRangeNoPreRelease (versionRange:VersionRange) semVer =
VersionRequirement(versionRange,PreReleaseStatus.No).IsInRange (SemVer.Parse semVer)

let isInRangePreRelease (versionRange:VersionRange) semVer =
VersionRequirement(versionRange,PreReleaseStatus.All).IsInRange (SemVer.Parse semVer)

let isInRange (version:VersionRequirement) semVer =
version.IsInRange (SemVer.Parse semVer)

Expand All @@ -21,6 +24,7 @@ let ``can check if in range for Minimum``() =
"2.1" |> isInRangeNoPreRelease (VersionRange.Minimum (SemVer.Parse "2.2")) |> shouldEqual false
"2.2" |> isInRangeNoPreRelease (VersionRange.Minimum (SemVer.Parse "2.2")) |> shouldEqual true
"3.0" |> isInRangeNoPreRelease (VersionRange.Minimum (SemVer.Parse "2.2")) |> shouldEqual true
"1.1-beta" |> isInRangePreRelease (VersionRange.Minimum(SemVer.Parse "1.0-beta")) |> shouldEqual true

[<Test>]
let ``can check if in range for GreaterThan``() =
Expand Down
7 changes: 6 additions & 1 deletion tests/Paket.Tests/NugetVersionRangeParserSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ let ``can detect specific version``() =
[<Test>]
let ``can detect minimum version``() =
parseRange "2.2" |> shouldEqual (VersionRange.Minimum (SemVer.Parse "2.2"))
parseRange"1.2" |> shouldEqual (VersionRange.Minimum (SemVer.Parse "1.2"))
parseRange "1.2" |> shouldEqual (VersionRange.Minimum (SemVer.Parse "1.2"))
parseRange "1.0-beta" |> shouldEqual (VersionRange.Minimum(SemVer.Parse "1.0-beta"))

[<Test>]
let ``can detect minimum version for pre-releases``() =
VersionRequirement.Parse("1.0-beta").PreReleases |> shouldEqual PreReleaseStatus.All

[<Test>]
let ``can detect greater than version``() =
Expand Down
15 changes: 8 additions & 7 deletions tests/Paket.Tests/NugetVersionRangeSerializerSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,41 @@ open NUnit.Framework
open FsUnit

[<Test>]
let ``can detect latest version``() =
let ``can format latest version``() =
VersionRequirement.Parse "" |> shouldEqual VersionRequirement.AllReleases

let format(versionRange:VersionRange) = versionRange.FormatInNuGetSyntax()

[<Test>]
let ``can detect specific version``() =
let ``can format specific version``() =
VersionRange.Specific(SemVer.Parse "2.2").FormatInNuGetSyntax() |> shouldEqual "[2.2]"
VersionRange.Specific(SemVer.Parse "1.2").FormatInNuGetSyntax() |> shouldEqual "[1.2]"

[<Test>]
let ``can detect minimum version``() =
let ``can format minimum version``() =
VersionRange.Minimum(SemVer.Parse "2.2").FormatInNuGetSyntax() |> shouldEqual "2.2"
VersionRange.Minimum(SemVer.Parse "1.2").FormatInNuGetSyntax() |> shouldEqual "1.2"
VersionRange.Minimum(SemVer.Parse "0").FormatInNuGetSyntax() |> shouldEqual ""
VersionRange.Minimum(SemVer.Parse "1.0-beta").FormatInNuGetSyntax() |> shouldEqual "1.0-beta"

[<Test>]
let ``can detect greater than version``() =
let ``can format greater than version``() =
VersionRange.GreaterThan(SemVer.Parse "2.2").FormatInNuGetSyntax() |> shouldEqual "(2.2,)"
VersionRange.GreaterThan(SemVer.Parse "1.2").FormatInNuGetSyntax() |> shouldEqual "(1.2,)"

[<Test>]
let ``can detect maximum version``() =
let ``can format maximum version``() =
VersionRange.Maximum(SemVer.Parse "2.2").FormatInNuGetSyntax() |> shouldEqual "(,2.2]"
VersionRange.Maximum(SemVer.Parse "0").FormatInNuGetSyntax() |> shouldEqual "(,0]"
VersionRange.Maximum(SemVer.Parse "1.2").FormatInNuGetSyntax() |> shouldEqual "(,1.2]"

[<Test>]
let ``can detect less than version``() =
let ``can format less than version``() =
VersionRange.LessThan(SemVer.Parse "2.2").FormatInNuGetSyntax() |> shouldEqual "(,2.2)"
VersionRange.LessThan(SemVer.Parse "1.2").FormatInNuGetSyntax() |> shouldEqual "(,1.2)"

[<Test>]
let ``can detect range version``() =
let ``can format range version``() =
VersionRange.Range(VersionRangeBound.Excluding, SemVer.Parse "2.2", SemVer.Parse "3", VersionRangeBound.Excluding).FormatInNuGetSyntax() |> shouldEqual "(2.2,3)"
VersionRange.Range(VersionRangeBound.Excluding, SemVer.Parse "2.2", SemVer.Parse "3", VersionRangeBound.Including).FormatInNuGetSyntax() |> shouldEqual "(2.2,3]"
VersionRange.Range(VersionRangeBound.Including, SemVer.Parse "2.2", SemVer.Parse "3", VersionRangeBound.Excluding).FormatInNuGetSyntax() |> shouldEqual "[2.2,3)"
Expand Down
4 changes: 4 additions & 0 deletions tests/Paket.Tests/SemVerSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ let ``pre-release versions have lower precedence (SemVer 2.0.0/9,11)`` () =
let ``larger pre-release identifiers have higher precedence (SemVer 2.0.0/11)`` () =
(SemVer.Parse "1.0.0-alpha") |> shouldBeSmallerThan (SemVer.Parse "1.0.0-alpha.1")

[<Test>]
let ``newer beta versions have higher precedence`` () =
(SemVer.Parse "1.0-beta") |> shouldBeSmallerThan (SemVer.Parse "1.1-beta")

[<Test>]
let ``alpha pre-release identifiers have higher precedence than numeric (SemVer 2.0.0/11)`` () =
(SemVer.Parse "1.0.0-alpha.1") |> shouldBeSmallerThan (SemVer.Parse "1.0.0-alpha.beta")
Expand Down

0 comments on commit bfb2e00

Please sign in to comment.