Skip to content
Prev Previous commit
Next Next commit
Get paket.bootstrapper.nupkg from local-filepath nuget sources too
  • Loading branch information
allykzam committed Nov 30, 2015
commit de9fb4bf5c745e7fd49ff4fc79c9b41b212101a7
25 changes: 20 additions & 5 deletions src/Paket.Bootstrapper/NugetDownloadStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,28 @@ public void SelfUpdate(string latestVersion, bool silent)
var randomFullPath = Path.Combine(Folder, Path.GetRandomFileName());
Directory.CreateDirectory(randomFullPath);
var paketPackageFile = Path.Combine(randomFullPath, paketFile);
if (!silent)
Console.WriteLine("Starting download from {0}", paketDownloadUrl);
using (var client = new WebClient())

if (Directory.Exists(NugetSource))
{
PrepareWebClient(client, paketDownloadUrl);
client.DownloadFile(paketDownloadUrl, paketPackageFile);
if (latestVersion == String.Empty) latestVersion = this.GetLatestVersion(false);
var sourcePath = Path.Combine(NugetSource, String.Format(paketNupkgFileTemplate, latestVersion));

if (!silent)
Console.WriteLine("Starting download from {0}", sourcePath);

File.Copy(sourcePath, paketPackageFile);
}
else
{
if (!silent)
Console.WriteLine("Starting download from {0}", paketDownloadUrl);
using (var client = new WebClient())
{
PrepareWebClient(client, paketDownloadUrl);
client.DownloadFile(paketDownloadUrl, paketPackageFile);
}
}

ZipFile.ExtractToDirectory(paketPackageFile, randomFullPath);

var paketSourceFile = Path.Combine(randomFullPath, "tools", "paket.bootstrapper.exe");
Expand Down