Skip to content

Commit

Permalink
Fix paket add for very first dependency - references #814
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed May 6, 2015
1 parent 0f9d0ff commit c6e590c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 1.3.21 - 06.05.2015
* BUGFIX: Fix `paket add` for very first dependency - https://github.com/fsprojects/Paket/issues/814

#### 1.3.20 - 06.05.2015
* BUGFIX: Paket pack had issues with \ in subfolders - https://github.com/fsprojects/Paket/issues/812

Expand Down
7 changes: 4 additions & 3 deletions src/Paket.Core/DependenciesFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,15 @@ type DependenciesFile(fileName,options,sources,packages : PackageRequirement lis
| [] ->
if remoteFiles <> [] then
list.Insert(0,"")

list.Insert(0,packageString)

match sources with
| [] ->
list.Insert(0,packageString)
list.Insert(0,"")
list.Insert(0,DependenciesFileSerializer.sourceString Constants.DefaultNugetStream)
| _ -> ()
| _ ->
list.Add("")
list.Add(packageString)
| p::_ ->
match tryFindPackageLine p.Name with
| None -> list.Add packageString
Expand Down
13 changes: 13 additions & 0 deletions tests/Paket.Tests/DependenciesFile/AddPackageSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,18 @@ github fsharp/FAKE modules/Octokit/Octokit.fsx
github fsharp/FAKE src/app/FakeLib/Globbing/Globbing.fs
github fsprojects/Chessie src/Chessie/ErrorHandling.fs"""

cfg.ToString()
|> shouldEqual (normalizeLineEndings expected)

[<Test>]
let ``should add Microsoft.AspNet.WebApi package in first position if only souce is given``() =
let config = """source https://nuget.org/api/v2"""

let cfg = DependenciesFile.FromCode(config).Add(PackageName "Microsoft.AspNet.WebApi","")

let expected = """source https://nuget.org/api/v2
nuget Microsoft.AspNet.WebApi"""

cfg.ToString()
|> shouldEqual (normalizeLineEndings expected)

0 comments on commit c6e590c

Please sign in to comment.