Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert-from-nuget - warn if there's a Nuget feed that cannot be connected to #548

Merged
merged 1 commit into from
Jan 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Paket.Core/NugetConvert.fs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,10 @@ let createDependenciesFileR (rootDirectory : DirectoryInfo) nugetEnv mode =
if nugetEnv.NugetConfig.PackageSources = [] then [Constants.DefaultNugetStream,None] else nugetEnv.NugetConfig.PackageSources
|> List.map (fun (n, auth) -> n, auth |> Option.map (CredsMigrationMode.toAuthentication mode n))
|> List.map (fun source ->
try source |> PackageSource.Parse |> Rop.succeed
with _ -> source |> fst |> PackageSourceParseError |> Rop.fail)
try source |> PackageSource.Parse |> succeed
with _ -> source |> fst |> PackageSourceParseError |> fail
|> successTee PackageSource.warnIfNoConnection)

|> Rop.collect

sources
Expand Down
16 changes: 15 additions & 1 deletion src/Paket.Core/PackageSources.fs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
module Paket.PackageSources

open System
open System.IO
open System.Text.RegularExpressions
open Logging

open Paket.Logging
open Paket.Rop

type EnvironmentVariable =
{ Variable : string
Expand Down Expand Up @@ -91,4 +94,15 @@ type PackageSource =

static member NugetSource url = Nuget { Url = url; Authentication = None }

static member warnIfNoConnection (source,_) =
match source with
| Nuget {Url = url; Authentication = auth} ->
use client = Utils.createWebClient (auth |> Option.map toBasicAuth)
try client.DownloadData url |> ignore
with _ ->
traceWarnfn "Unable to ping remote Nuget feed: %s." url
| LocalNuget path ->
if not <| File.Exists path then
traceWarnfn "Local Nuget feed doesn't exist: %s." path

let DefaultNugetSource = PackageSource.NugetSource Constants.DefaultNugetStream