Skip to content

Commit

Permalink
Keep order of sources - fixes #233
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Oct 9, 2014
1 parent 80795aa commit c0148a7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 0.5.0-alpha010 - 09.10.2014
* Keep order of sources - https://github.com/fsprojects/Paket/issues/233

#### 0.5.0-alpha009 - 09.10.2014
* Bootstrapper will only download stable releases by default - http://fsprojects.github.io/Paket/bootstrapper.html

Expand Down
2 changes: 1 addition & 1 deletion src/Paket/DependenciesFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module DependenciesFileParser =
let lineNo = lineNo + 1
try
match line with
| Remote(newSource,auth) -> lineNo, options, (PackageSource.Parse(newSource.TrimEnd([|'/'|]),auth) :: sources), packages, sourceFiles
| Remote(newSource,auth) -> lineNo, options, sources @ [PackageSource.Parse(newSource.TrimEnd([|'/'|]),auth)], packages, sourceFiles
| Blank -> lineNo, options, sources, packages, sourceFiles
| ReferencesMode mode -> lineNo, { options with Strict = mode }, sources, packages, sourceFiles
| OmitContent omit -> lineNo, { options with OmitContent = omit }, sources, packages, sourceFiles
Expand Down
8 changes: 4 additions & 4 deletions tests/Paket.Tests/DependenciesFile/ParserSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ let ``should read simple config with comments``() =

let config4 = """
source "http://nuget.org/api/v2" // first source
source "http://nuget.org/api/v3" // second
nuget "FAKE" "~> 3.0"
source "http://nuget.org/api/v3" // second
nuget "Rx-Main" "~> 2.2"
nuget "MinPackage" "1.1.3"
"""
Expand All @@ -81,9 +81,9 @@ let ``should read config with multiple sources``() =
let cfg = DependenciesFile.FromCode(config4)
cfg.Options.Strict |> shouldEqual false

(cfg.Packages |> List.find (fun p -> p.Name = "Rx-Main")).Sources |> shouldEqual [PackageSource.NugetSource "http://nuget.org/api/v3"; PackageSources.DefaultNugetSource]
(cfg.Packages |> List.find (fun p -> p.Name = "MinPackage")).Sources |> shouldEqual [PackageSource.NugetSource "http://nuget.org/api/v3"; PackageSources.DefaultNugetSource]
(cfg.Packages |> List.find (fun p -> p.Name = "FAKE")).Sources |> shouldEqual [PackageSources.DefaultNugetSource]
(cfg.Packages |> List.find (fun p -> p.Name = "Rx-Main")).Sources |> shouldEqual [PackageSources.DefaultNugetSource; PackageSource.NugetSource "http://nuget.org/api/v3"]
(cfg.Packages |> List.find (fun p -> p.Name = "MinPackage")).Sources |> shouldEqual [PackageSources.DefaultNugetSource; PackageSource.NugetSource "http://nuget.org/api/v3"]
(cfg.Packages |> List.find (fun p -> p.Name = "FAKE")).Sources |> shouldEqual [PackageSources.DefaultNugetSource; PackageSource.NugetSource "http://nuget.org/api/v3"]

[<Test>]
let ``should read source file from config``() =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ open TestHelpers

let config1 = """
source "http://nuget.org/api/v2"
source "http://nuget.org/api/v3"
nuget "Castle.Windsor-log4net" "~> 3.2"
source "http://nuget.org/api/v3"
nuget "Rx-Main" "~> 2.0"
"""

Expand Down Expand Up @@ -38,8 +37,6 @@ let expected = """NUGET
log (1.2)
log4net (1.1)
log (>= 1.0)
remote: http://nuget.org/api/v3
specs:
Rx-Core (2.1)
Rx-Main (2.0)
Rx-Core (>= 2.1)"""
Expand Down

0 comments on commit c0148a7

Please sign in to comment.