Skip to content

Commit

Permalink
Initial support for autocomplete of local NuGet feeds - references #1298
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jan 17, 2016
1 parent 82764be commit e694ed5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 2.44.5 - 17.01.2016
* Initial support for autocomplete of local NuGet feeds - https://github.com/fsprojects/Paket/issues/1298

#### 2.44.4 - 16.01.2016
* Initial support for autocomplete of private sources - https://github.com/fsprojects/Paket/issues/1298
* Allow to set project url in paket pack
Expand Down
12 changes: 10 additions & 2 deletions integrationtests/Paket.IntegrationTests/AutocompleteSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,17 @@ let ``#1298 should autocomplete for nunit on NuGet3``() =
result |> shouldContain "NUnit"

[<Test>]
[<Ignore>] // it's only wrking on forki's machine
[<Ignore>] // it's only working on forki's machine
let ``#1298 should autocomplete for msu on local teamcity``() =
let result = Dependencies.FindPackagesByName([PackageSource.NuGetV2Source "http://teamcity/guestAuth/app/nuget/v1/FeedService.svc/"],"msu")
result |> shouldContain "msu.Addins"


[<Test>]
let ``#1298 should autocomplete for dapper on local feed``() =
let result = Dependencies.FindPackagesByName([PackageSource.LocalNuGet(Path.Combine(originalScenarioPath "i001219-props-files", "nuget_repo"))],"dapp")
result |> shouldContain "Dapper"

[<Test>]
let ``#1298 should autocomplete for fake on local feed``() =
let result = Dependencies.FindPackagesByName([PackageSource.LocalNuGet(Path.Combine(originalScenarioPath "i001219-props-files", "nuget_repo"))],"fake")
result |> shouldContain "fake.core"
Binary file not shown.
12 changes: 12 additions & 0 deletions src/Paket.Core/PublicAPI.fs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,18 @@ type Dependencies(dependenciesFileName: string) =
else
Some(NuGetV2.FindPackages(s.Authentication, s.Url, searchTerm, maxResults))
| NuGetV3 s -> Some(NuGetV3.FindPackages(s.Authentication, s.Url, searchTerm, maxResults))
| LocalNuGet s ->
Some(async {
let a =
Fake.Globbing.search s (sprintf "**/*%s*" searchTerm)
|> List.map (fun s ->
let parts = FileInfo(s).Name.Split('.')
let nameParts = parts |> Seq.takeWhile (fun x -> x <> "nupkg" && System.Int32.TryParse x |> fst |> not)
String.Join(".",nameParts))
|> List.toArray

return a
})
| _ -> None)

static member FindPackagesByName(sources:PackageSource seq,searchTerm,?maxResults) =
Expand Down

0 comments on commit e694ed5

Please sign in to comment.