Skip to content

Commit

Permalink
paket install correctly parses HTTP references - references #571
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Feb 6, 2015
1 parent 574ef30 commit 323bdd3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 73 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### 0.27.0-alpha006 - 03.02.2015
#### 0.27.0-alpha007 - 03.02.2015
* Allow to reference `.props` and `.targets` files - https://github.com/fsprojects/Paket/issues/516
* Create a install function in the api which takes a `paket.dependencies` file as text - https://github.com/fsprojects/Paket/issues/576
* Don't internalize in paket.exe during ILMerge
Expand Down
10 changes: 4 additions & 6 deletions src/Paket.Core/LockFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ module LockFileParser =
| _ -> failwith "invalid file source details."

let sourceFile =
{ Commit = String.Empty
{ Commit = path
Owner = domain
Origin = HttpLink(state.RemoteUrl.Value + path)
Project = domain
Origin = HttpLink(state.RemoteUrl.Value)
Project = ""
Dependencies = Set.empty
Name = name }

Expand All @@ -244,9 +244,7 @@ module LockFileParser =
Project = project + "/" + String.Join("/",moredetails)
Dependencies = Set.empty
Name = details } :: state.SourceFiles }
| _ -> failwith "invalid remote details."
)

| _ -> failwith "invalid remote details.")


/// Allows to parse and analyze paket.lock files.
Expand Down
2 changes: 1 addition & 1 deletion src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<WarningLevel>3</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<StartArguments>update</StartArguments>
<StartArguments>install</StartArguments>
<StartAction>Project</StartAction>
<StartProgram>paket.exe</StartProgram>
<StartWorkingDirectory>d:\code\paketkopie</StartWorkingDirectory>
Expand Down
23 changes: 21 additions & 2 deletions tests/Paket.Tests/Lockfile/GeneratorSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ open Paket
open NUnit.Framework
open FsUnit
open TestHelpers
open Paket.ModuleResolver

let config1 = """
source "http://nuget.org/api/v2"
Expand Down Expand Up @@ -214,7 +215,25 @@ http http://nlp.stanford.edu/software/stanford-segmenter-2014-10-26.zip"""

let cfg = DependenciesFile.FromCode(config)

cfg.RemoteFiles
|> List.map trivialResolve
let references =
cfg.RemoteFiles
|> List.map trivialResolve

references.Length |> shouldEqual 6

references.[5].Origin |> shouldEqual (SingleSourceFileOrigin.HttpLink("http://nlp.stanford.edu"))
references.[5].Commit |> shouldEqual ("/software/stanford-segmenter-2014-10-26.zip") // That's strange
references.[5].Name |> shouldEqual "stanford-segmenter-2014-10-26.zip"

references
|> LockFileSerializer.serializeSourceFiles
|> shouldEqual (normalizeLineEndings expectedForStanfordNLPdotNET)

[<Test>]
let ``should parse and regenerate http Stanford.NLP.NET project``() =
let lockFile = LockFileParser.Parse(toLines expectedForStanfordNLPdotNET)

lockFile.SourceFiles
|> List.rev
|> LockFileSerializer.serializeSourceFiles
|> shouldEqual (normalizeLineEndings expectedForStanfordNLPdotNET)
67 changes: 4 additions & 63 deletions tests/Paket.Tests/Lockfile/ParserSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -287,66 +287,7 @@ let ``should parse lock file for http Stanford.NLP.NET project``() =

references.Length |> shouldEqual 6

references.[0].Origin |> shouldEqual (SingleSourceFileOrigin.HttpLink("http://nlp.stanford.edu/software/stanford-segmenter-2014-10-26.zip"))
references.[0].Name |> shouldEqual "stanford-segmenter-2014-10-26.zip"

()

let realWorldHTTP = """
NUGET
remote: https://nuget.org/api/v2
specs:
Costura.Fody (1.3.3.0)
Fody (>= 1.26.1)
dotNetRDF (1.0.6.3421)
HtmlAgilityPack (>= 1.4.6)
Newtonsoft.Json (>= 6.0.3)
VDS.Common (1.3.0)
Eto.Parse (1.3.1.0)
FakeItEasy (1.25.1)
Fody (1.26.4)
gitlink (2.1.0)
HtmlAgilityPack (1.4.6)
ImpromptuInterface (6.2.2)
InfoOf.Fody (0.11.2.0)
Fody
json-ld.net (1.0.4)
Newtonsoft.Json (>= 4.0.1)
MethodTimer.Fody (1.15.2.0)
Fody
MSBuildTasks (1.4.0.88)
Newtonsoft.Json (6.0.7)
NullGuard.Fody (1.2.0.0)
Fody
NUnit (2.6.4)
SpecFlow (1.9.0)
StyleCop.MSBuild (4.7.49.0)
StyleCopPlus.MSBuild (4.7.49.5)
StyleCop.MSBuild (>= 4.7.49.0)
VDS.Common (1.3.0)
Zoltu.Versioning (1.2.15.0)
GITHUB
remote: tpluscode/FileVersionExtractor
specs:
FULLPROJECT (b1126aa31f362d0cd1e19e7abe1acd30da35ab6a)
HTTP
remote: http://www.w3.org/2013/N-QuadsTests/TESTS.zip
specs:
TESTS.zip
remote: https://gist.githubusercontent.com
specs:
paket.txt (/JonCanning/37769e635aaece6dcef3/raw/adffa54dd02f94e5b06667700ef44e1a5feded73/paket.txt)
"""

[<Test>]
let ``should parse real world http reference``() =
let lockFile = LockFileParser.Parse(toLines realWorldHTTP)
let references = lockFile.SourceFiles

references.Length |> shouldEqual 3

references.[0].Origin |> shouldEqual (SingleSourceFileOrigin.HttpLink("https://gist.githubusercontent.com/JonCanning/37769e635aaece6dcef3/raw/adffa54dd02f94e5b06667700ef44e1a5feded73/paket.txt"))
references.[0].Name |> shouldEqual "paket.txt"

references.[1].Name |> shouldEqual "TESTS.zip"
references.[1].Origin |> shouldEqual (SingleSourceFileOrigin.HttpLink("http://www.w3.org/2013/N-QuadsTests/TESTS.zip"))
references.[0].Origin |> shouldEqual (SingleSourceFileOrigin.HttpLink("http://nlp.stanford.edu"))
references.[0].Commit |> shouldEqual ("/software/stanford-segmenter-2014-10-26.zip") // That's strange
references.[0].Project |> shouldEqual ""
references.[0].Name |> shouldEqual "stanford-segmenter-2014-10-26.zip"

0 comments on commit 323bdd3

Please sign in to comment.