From 18062fe3a60cb41b9f0a67d93904c1beaa748d8f Mon Sep 17 00:00:00 2001 From: Tomasz Heimowski Date: Wed, 3 Aug 2016 07:57:13 +0200 Subject: [PATCH] use regex from #1838, swap order of version / source? --- docs/content/local-file.md | 3 +-- src/Paket.Core/LocalFile.fs | 6 +++--- tests/Paket.Tests/LocalFile/LocalFileSpecs.fs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/content/local-file.md b/docs/content/local-file.md index aa40f88ad8..dcd26c9e40 100644 --- a/docs/content/local-file.md +++ b/docs/content/local-file.md @@ -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). diff --git a/src/Paket.Core/LocalFile.fs b/src/Paket.Core/LocalFile.fs index 824dd5a20f..fa8133b412 100644 --- a/src/Paket.Core/LocalFile.fs +++ b/src/Paket.Core/LocalFile.fs @@ -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 @@ -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) -> diff --git a/tests/Paket.Tests/LocalFile/LocalFileSpecs.fs b/tests/Paket.Tests/LocalFile/LocalFileSpecs.fs index 3365f0b816..50677bffe3 100644 --- a/tests/Paket.Tests/LocalFile/LocalFileSpecs.fs +++ b/tests/Paket.Tests/LocalFile/LocalFileSpecs.fs @@ -50,7 +50,7 @@ let ``should parse single dev source override in group``() = [] 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 [