Skip to content

Commit

Permalink
use regex from #1838, swap order of version / source?
Browse files Browse the repository at this point in the history
  • Loading branch information
theimowski committed Aug 3, 2016
1 parent 1eaec2f commit 18062fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions docs/content/local-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ Format of git source is the same as used in `paket.dependencies` for specifying
nuget Fake -> source c:\github\FAKE\bin

// Argu is searched in specific version
// The version has to be provided before source
nuget Argu -> version 0.0.0 source C:\github\Argu\bin
nuget Argu -> source C:\github\Argu\bin version 0.0.0

The Format of the source is the same as in [path sources](nuget-dependencies.html#Path-sources).

Expand Down
6 changes: 3 additions & 3 deletions src/Paket.Core/LocalFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ module LocalFile =

let private parseLine = function
| Regex
"nuget\s+(\w+)(\s+group\s+(\w+))?\s+->(\s+version\s+(.*))?\s+(source\s+.+)"
[package; _; group; _; version; source] ->
"^nuget[ ]+(.*?)([ ]+group[ ]+(.*))?[ ]+->[ ]+(source[ ]+.*?)([ ]+version[ ]+(.*))?$"
[package; _; group; source; _; version] ->
let v = try SemVer.Parse version |> Some with _ -> None
source
|> Trial.Catch PackageSource.Parse
Expand Down Expand Up @@ -82,7 +82,7 @@ module LocalFile =
let private warning x =
match x with
| LocalSourceOverride ({ Name = p; Group = g},s, Some v) ->
sprintf "nuget %s group %s -> version %s %s" (p.ToString()) (g.ToString()) (v.ToString()) (s.ToString())
sprintf "nuget %s group %s -> %s version %s" (p.ToString()) (g.ToString()) (s.ToString()) (v.ToString())
| LocalSourceOverride ({ Name = p; Group = g},s, None) ->
sprintf "nuget %s group %s -> %s" (p.ToString()) (g.ToString()) (s.ToString())
| LocalGitOverride ({ Name = p; Group = g},s) ->
Expand Down
2 changes: 1 addition & 1 deletion tests/Paket.Tests/LocalFile/LocalFileSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ let ``should parse single dev source override in group``() =
[<Test>]
let ``should parse single dev source override with version``() =
let contents = """
nuget NUnit -> version 0.0.0 source ./local_source
nuget NUnit -> source ./local_source version 0.0.0
"""
let expected =
LocalFile [
Expand Down

0 comments on commit 18062fe

Please sign in to comment.