mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Burn Framework version
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NuGet;
|
||||
|
||||
namespace Squirrel
|
||||
{
|
||||
public static class PackageExtensions
|
||||
{
|
||||
public static string ExtractTitle(this IPackage package)
|
||||
{
|
||||
if (package == null) return String.Empty;
|
||||
|
||||
var title = package.Title;
|
||||
return !String.IsNullOrWhiteSpace(title) ? title : package.Id;
|
||||
}
|
||||
|
||||
public static FrameworkVersion DetectFrameworkVersion(this IPackage package)
|
||||
{
|
||||
return package.GetFiles().Any(x => x.Path.Contains("lib") && x.Path.Contains("45")) ?
|
||||
FrameworkVersion.Net45 : FrameworkVersion.Net40;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,6 @@
|
||||
<Compile Include="IUpdateManager.cs" />
|
||||
<Compile Include="MarkdownSharp.cs" />
|
||||
<Compile Include="NativeMethods.cs" />
|
||||
<Compile Include="PackageExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ReleaseEntry.cs" />
|
||||
<Compile Include="ReleaseExtensions.cs" />
|
||||
|
||||
@@ -7,18 +7,12 @@ using Splat;
|
||||
|
||||
namespace Squirrel
|
||||
{
|
||||
public enum FrameworkVersion {
|
||||
Net40,
|
||||
Net45,
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class UpdateInfo : IEnableLogger
|
||||
{
|
||||
[DataMember] public ReleaseEntry CurrentlyInstalledVersion { get; protected set; }
|
||||
[DataMember] public ReleaseEntry FutureReleaseEntry { get; protected set; }
|
||||
[DataMember] public List<ReleaseEntry> ReleasesToApply { get; protected set; }
|
||||
[DataMember] public FrameworkVersion AppFrameworkVersion { get; protected set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public bool IsBootstrapping {
|
||||
@@ -28,7 +22,7 @@ namespace Squirrel
|
||||
[IgnoreDataMember]
|
||||
public string PackageDirectory { get; protected set; }
|
||||
|
||||
protected UpdateInfo(ReleaseEntry currentlyInstalledVersion, IEnumerable<ReleaseEntry> releasesToApply, string packageDirectory, FrameworkVersion appFrameworkVersion)
|
||||
protected UpdateInfo(ReleaseEntry currentlyInstalledVersion, IEnumerable<ReleaseEntry> releasesToApply, string packageDirectory)
|
||||
{
|
||||
// NB: When bootstrapping, CurrentlyInstalledVersion is null!
|
||||
CurrentlyInstalledVersion = currentlyInstalledVersion;
|
||||
@@ -37,8 +31,6 @@ namespace Squirrel
|
||||
ReleasesToApply.MaxBy(x => x.Version).FirstOrDefault() :
|
||||
CurrentlyInstalledVersion;
|
||||
|
||||
AppFrameworkVersion = appFrameworkVersion;
|
||||
|
||||
this.PackageDirectory = packageDirectory;
|
||||
}
|
||||
|
||||
@@ -57,7 +49,7 @@ namespace Squirrel
|
||||
.ToDictionary(k => k.Item1, v => v.Item2);
|
||||
}
|
||||
|
||||
public static UpdateInfo Create(ReleaseEntry currentVersion, IEnumerable<ReleaseEntry> availableReleases, string packageDirectory, FrameworkVersion appFrameworkVersion)
|
||||
public static UpdateInfo Create(ReleaseEntry currentVersion, IEnumerable<ReleaseEntry> availableReleases, string packageDirectory)
|
||||
{
|
||||
Contract.Requires(availableReleases != null);
|
||||
Contract.Requires(!String.IsNullOrEmpty(packageDirectory));
|
||||
@@ -68,11 +60,11 @@ namespace Squirrel
|
||||
}
|
||||
|
||||
if (currentVersion == null) {
|
||||
return new UpdateInfo(currentVersion, new[] { latestFull }, packageDirectory, appFrameworkVersion);
|
||||
return new UpdateInfo(currentVersion, new[] { latestFull }, packageDirectory);
|
||||
}
|
||||
|
||||
if (currentVersion.Version == latestFull.Version) {
|
||||
return new UpdateInfo(currentVersion, Enumerable.Empty<ReleaseEntry>(), packageDirectory, appFrameworkVersion);
|
||||
return new UpdateInfo(currentVersion, Enumerable.Empty<ReleaseEntry>(), packageDirectory);
|
||||
}
|
||||
|
||||
var newerThanUs = availableReleases
|
||||
@@ -82,8 +74,8 @@ namespace Squirrel
|
||||
var deltasSize = newerThanUs.Where(x => x.IsDelta).Sum(x => x.Filesize);
|
||||
|
||||
return (deltasSize < latestFull.Filesize && deltasSize > 0) ?
|
||||
new UpdateInfo(currentVersion, newerThanUs.Where(x => x.IsDelta).ToArray(), packageDirectory, appFrameworkVersion) :
|
||||
new UpdateInfo(currentVersion, new[] { latestFull }, packageDirectory, appFrameworkVersion);
|
||||
new UpdateInfo(currentVersion, newerThanUs.Where(x => x.IsDelta).ToArray(), packageDirectory) :
|
||||
new UpdateInfo(currentVersion, new[] { latestFull }, packageDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,6 @@ namespace Squirrel
|
||||
{
|
||||
internal class ApplyReleasesImpl : IEnableLogger
|
||||
{
|
||||
// TODO: Kill this entire concept
|
||||
readonly FrameworkVersion appFrameworkVersion = FrameworkVersion.Net45;
|
||||
|
||||
readonly string rootAppDirectory;
|
||||
|
||||
public ApplyReleasesImpl(string rootAppDirectory)
|
||||
@@ -234,7 +231,7 @@ namespace Squirrel
|
||||
// with the 4.0 version.
|
||||
this.Log().Info("Writing files to app directory: {0}", target.FullName);
|
||||
|
||||
var toWrite = pkg.GetLibFiles().Where(x => pathIsInFrameworkProfile(x, appFrameworkVersion))
|
||||
var toWrite = pkg.GetLibFiles().Where(x => pathIsInFrameworkProfile(x))
|
||||
.OrderBy(x => x.Path)
|
||||
.ToList();
|
||||
|
||||
@@ -279,17 +276,12 @@ namespace Squirrel
|
||||
}, "Failed to write file: " + target.FullName);
|
||||
}
|
||||
|
||||
static bool pathIsInFrameworkProfile(IPackageFile packageFile, FrameworkVersion appFrameworkVersion)
|
||||
static bool pathIsInFrameworkProfile(IPackageFile packageFile)
|
||||
{
|
||||
if (!packageFile.Path.StartsWith("lib", StringComparison.InvariantCultureIgnoreCase)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (appFrameworkVersion == FrameworkVersion.Net40
|
||||
&& packageFile.Path.StartsWith("lib\\net45", StringComparison.InvariantCultureIgnoreCase)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,6 @@ namespace Squirrel
|
||||
{
|
||||
readonly string rootAppDirectory;
|
||||
|
||||
// TODO: rip this out
|
||||
readonly FrameworkVersion appFrameworkVersion = FrameworkVersion.Net45;
|
||||
|
||||
public CheckForUpdateImpl(string rootAppDirectory)
|
||||
{
|
||||
this.rootAppDirectory = rootAppDirectory;
|
||||
@@ -146,7 +143,7 @@ namespace Squirrel
|
||||
if (latestFullRelease == currentRelease) {
|
||||
this.Log().Info("No updates, remote and local are the same");
|
||||
|
||||
var info = UpdateInfo.Create(currentRelease, new[] {latestFullRelease}, packageDirectory, appFrameworkVersion);
|
||||
var info = UpdateInfo.Create(currentRelease, new[] {latestFullRelease}, packageDirectory);
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -156,15 +153,15 @@ namespace Squirrel
|
||||
|
||||
if (!localReleases.Any()) {
|
||||
this.Log().Warn("First run or local directory is corrupt, starting from scratch");
|
||||
return UpdateInfo.Create(Utility.FindCurrentVersion(localReleases), new[] {latestFullRelease}, packageDirectory, appFrameworkVersion);
|
||||
return UpdateInfo.Create(Utility.FindCurrentVersion(localReleases), new[] {latestFullRelease}, packageDirectory);
|
||||
}
|
||||
|
||||
if (localReleases.Max(x => x.Version) > remoteReleases.Max(x => x.Version)) {
|
||||
this.Log().Warn("hwhat, local version is greater than remote version");
|
||||
return UpdateInfo.Create(Utility.FindCurrentVersion(localReleases), new[] {latestFullRelease}, packageDirectory, appFrameworkVersion);
|
||||
return UpdateInfo.Create(Utility.FindCurrentVersion(localReleases), new[] {latestFullRelease}, packageDirectory);
|
||||
}
|
||||
|
||||
return UpdateInfo.Create(currentRelease, remoteReleases, packageDirectory, appFrameworkVersion);
|
||||
return UpdateInfo.Create(currentRelease, remoteReleases, packageDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,13 +25,11 @@ namespace Squirrel
|
||||
readonly string applicationName;
|
||||
readonly IFileDownloader urlDownloader;
|
||||
readonly string updateUrlOrPath;
|
||||
readonly FrameworkVersion appFrameworkVersion;
|
||||
|
||||
IDisposable updateLock;
|
||||
|
||||
public UpdateManager(string urlOrPath,
|
||||
string applicationName,
|
||||
FrameworkVersion appFrameworkVersion,
|
||||
string rootDirectory = null,
|
||||
IFileDownloader urlDownloader = null)
|
||||
{
|
||||
@@ -40,7 +38,6 @@ namespace Squirrel
|
||||
|
||||
updateUrlOrPath = urlOrPath;
|
||||
this.applicationName = applicationName;
|
||||
this.appFrameworkVersion = appFrameworkVersion;
|
||||
this.urlDownloader = urlDownloader ?? new FileDownloader();
|
||||
|
||||
if (rootDirectory != null) {
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace Squirrel.Update
|
||||
var ourAppName = ReleaseEntry.ParseReleaseFile(File.ReadAllText(releasesPath, Encoding.UTF8))
|
||||
.First().PackageName;
|
||||
|
||||
using (var mgr = new UpdateManager(sourceDirectory, ourAppName, FrameworkVersion.Net45)) {
|
||||
using (var mgr = new UpdateManager(sourceDirectory, ourAppName)) {
|
||||
this.Log().Info("About to install to: " + mgr.RootAppDirectory);
|
||||
Directory.CreateDirectory(mgr.RootAppDirectory);
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace Squirrel.Update
|
||||
|
||||
this.Log().Info("Starting update, downloading from " + updateUrl);
|
||||
|
||||
using (var mgr = new UpdateManager(updateUrl, appName, FrameworkVersion.Net45)) {
|
||||
using (var mgr = new UpdateManager(updateUrl, appName)) {
|
||||
bool ignoreDeltaUpdates = false;
|
||||
this.Log().Info("About to update to: " + mgr.RootAppDirectory);
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace Squirrel.Update
|
||||
appName = appName ?? getAppNameFromDirectory();
|
||||
|
||||
this.Log().Info("Fetching update information, downloading from " + updateUrl);
|
||||
using (var mgr = new UpdateManager(updateUrl, appName, FrameworkVersion.Net45)) {
|
||||
using (var mgr = new UpdateManager(updateUrl, appName)) {
|
||||
var updateInfo = await mgr.CheckForUpdate(progress: x => Console.WriteLine(x / 3));
|
||||
await mgr.DownloadReleases(updateInfo.ReleasesToApply, x => Console.WriteLine(33 + x / 3));
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace Squirrel.Update
|
||||
this.Log().Info("Starting uninstall for app: " + appName);
|
||||
|
||||
appName = appName ?? getAppNameFromDirectory();
|
||||
using (var mgr = new UpdateManager("", appName, FrameworkVersion.Net45)) {
|
||||
using (var mgr = new UpdateManager("", appName)) {
|
||||
await mgr.FullUninstall();
|
||||
mgr.RemoveUninstallerRegistryEntry();
|
||||
}
|
||||
@@ -406,7 +406,7 @@ namespace Squirrel.Update
|
||||
var defaultLocations = ShortcutLocation.StartMenu | ShortcutLocation.Desktop;
|
||||
var locations = parseShortcutLocations(shortcutArgs);
|
||||
|
||||
using (var mgr = new UpdateManager("", appName, FrameworkVersion.Net45)) {
|
||||
using (var mgr = new UpdateManager("", appName)) {
|
||||
mgr.CreateShortcutsForExecutable(exeName, locations ?? defaultLocations, false);
|
||||
}
|
||||
}
|
||||
@@ -422,7 +422,7 @@ namespace Squirrel.Update
|
||||
var defaultLocations = ShortcutLocation.StartMenu | ShortcutLocation.Desktop;
|
||||
var locations = parseShortcutLocations(shortcutArgs);
|
||||
|
||||
using (var mgr = new UpdateManager("", appName, FrameworkVersion.Net45)) {
|
||||
using (var mgr = new UpdateManager("", appName)) {
|
||||
mgr.RemoveShortcutsForExecutable(exeName, locations ?? defaultLocations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Squirrel.Tests
|
||||
var pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
|
||||
ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));
|
||||
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", FrameworkVersion.Net45, tempDir)) {
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
|
||||
await fixture.FullInstall();
|
||||
|
||||
// NB: We execute the Squirrel-aware apps, so we need to give
|
||||
@@ -70,7 +70,7 @@ namespace Squirrel.Tests
|
||||
var pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
|
||||
ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));
|
||||
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", FrameworkVersion.Net45, tempDir)) {
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
|
||||
await fixture.FullInstall();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Squirrel.Tests
|
||||
pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
|
||||
ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));
|
||||
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", FrameworkVersion.Net45, tempDir)) {
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
|
||||
await fixture.UpdateApp();
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace Squirrel.Tests
|
||||
var pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
|
||||
ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));
|
||||
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", FrameworkVersion.Net45, tempDir)) {
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
|
||||
await fixture.FullInstall();
|
||||
}
|
||||
|
||||
@@ -116,14 +116,14 @@ namespace Squirrel.Tests
|
||||
pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
|
||||
ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));
|
||||
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", FrameworkVersion.Net45, tempDir)) {
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
|
||||
await fixture.UpdateApp();
|
||||
}
|
||||
|
||||
await Task.Delay(1000);
|
||||
|
||||
// NB: The 2nd time we won't have any updates to apply. We should just do nothing!
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", FrameworkVersion.Net45, tempDir)) {
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
|
||||
await fixture.UpdateApp();
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Squirrel.Tests
|
||||
var pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
|
||||
ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));
|
||||
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", FrameworkVersion.Net45, tempDir)) {
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
|
||||
await fixture.FullInstall();
|
||||
}
|
||||
|
||||
@@ -153,13 +153,13 @@ namespace Squirrel.Tests
|
||||
pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
|
||||
ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));
|
||||
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", FrameworkVersion.Net45, tempDir)) {
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
|
||||
await fixture.UpdateApp();
|
||||
}
|
||||
|
||||
await Task.Delay(1000);
|
||||
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", FrameworkVersion.Net45, tempDir)) {
|
||||
using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
|
||||
await fixture.FullUninstall();
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace Squirrel.Tests
|
||||
var aGivenPackage = Path.Combine(packages, package);
|
||||
var baseEntry = ReleaseEntry.GenerateFromFile(aGivenPackage);
|
||||
|
||||
var updateInfo = UpdateInfo.Create(baseEntry, new[] { baseEntry }, "dontcare", FrameworkVersion.Net40);
|
||||
var updateInfo = UpdateInfo.Create(baseEntry, new[] { baseEntry }, "dontcare");
|
||||
|
||||
Assert.Empty(updateInfo.ReleasesToApply);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ namespace Squirrel.Tests
|
||||
var deltaEntry = ReleaseEntry.GenerateFromFile(deltaPackage);
|
||||
|
||||
Assert.Throws<Exception>(
|
||||
() => UpdateInfo.Create(baseEntry, new[] { deltaEntry }, "dontcare", FrameworkVersion.Net40));
|
||||
() => UpdateInfo.Create(baseEntry, new[] { deltaEntry }, "dontcare"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Squirrel.Tests
|
||||
var baseEntry = ReleaseEntry.GenerateFromFile(Path.Combine(packagesDir, "Squirrel.Core.1.0.0.0-full.nupkg"));
|
||||
var latestFullEntry = ReleaseEntry.GenerateFromFile(Path.Combine(packagesDir, "Squirrel.Core.1.1.0.0-full.nupkg"));
|
||||
|
||||
var updateInfo = UpdateInfo.Create(baseEntry, new[] { latestFullEntry }, packagesDir, FrameworkVersion.Net40);
|
||||
var updateInfo = UpdateInfo.Create(baseEntry, new[] { latestFullEntry }, packagesDir);
|
||||
updateInfo.ReleasesToApply.Contains(latestFullEntry).ShouldBeTrue();
|
||||
|
||||
var progress = new List<int>();
|
||||
@@ -286,7 +286,7 @@ namespace Squirrel.Tests
|
||||
var baseEntry = ReleaseEntry.GenerateFromFile(Path.Combine(packagesDir, "Squirrel.Core.1.1.0.0-full.nupkg"));
|
||||
var latestFullEntry = ReleaseEntry.GenerateFromFile(Path.Combine(packagesDir, "Squirrel.Core.1.2.0.0-full.nupkg"));
|
||||
|
||||
var updateInfo = UpdateInfo.Create(baseEntry, new[] { latestFullEntry }, packagesDir, FrameworkVersion.Net40);
|
||||
var updateInfo = UpdateInfo.Create(baseEntry, new[] { latestFullEntry }, packagesDir);
|
||||
updateInfo.ReleasesToApply.Contains(latestFullEntry).ShouldBeTrue();
|
||||
|
||||
var progress = new List<int>();
|
||||
@@ -335,7 +335,7 @@ namespace Squirrel.Tests
|
||||
var baseEntry = ReleaseEntry.GenerateFromFile(Path.Combine(packagesDir, "Squirrel.Core.1.1.0.0-full.nupkg"));
|
||||
var latestFullEntry = ReleaseEntry.GenerateFromFile(Path.Combine(packagesDir, "Squirrel.Core.1.3.0.0-full.nupkg"));
|
||||
|
||||
var updateInfo = UpdateInfo.Create(baseEntry, new[] { latestFullEntry }, packagesDir, FrameworkVersion.Net40);
|
||||
var updateInfo = UpdateInfo.Create(baseEntry, new[] { latestFullEntry }, packagesDir);
|
||||
updateInfo.ReleasesToApply.Contains(latestFullEntry).ShouldBeTrue();
|
||||
|
||||
var progress = new List<int>();
|
||||
@@ -387,7 +387,7 @@ namespace Squirrel.Tests
|
||||
var deltaEntry = ReleaseEntry.GenerateFromFile(Path.Combine(packagesDir, "Squirrel.Core.1.1.0.0-delta.nupkg"));
|
||||
var latestFullEntry = ReleaseEntry.GenerateFromFile(Path.Combine(packagesDir, "Squirrel.Core.1.1.0.0-full.nupkg"));
|
||||
|
||||
var updateInfo = UpdateInfo.Create(baseEntry, new[] { deltaEntry, latestFullEntry }, packagesDir, FrameworkVersion.Net40);
|
||||
var updateInfo = UpdateInfo.Create(baseEntry, new[] { deltaEntry, latestFullEntry }, packagesDir);
|
||||
updateInfo.ReleasesToApply.Contains(deltaEntry).ShouldBeTrue();
|
||||
|
||||
var progress = new List<int>();
|
||||
@@ -453,7 +453,7 @@ namespace Squirrel.Tests
|
||||
|
||||
using (Utility.WithTempDirectory(out path)) {
|
||||
using (Utility.WithTempDirectory(out remotePkgPath))
|
||||
using (var mgr = new UpdateManager(remotePkgPath, "theApp", FrameworkVersion.Net45, path)) {
|
||||
using (var mgr = new UpdateManager(remotePkgPath, "theApp", path)) {
|
||||
IntegrationTestHelper.CreateFakeInstalledApp("1.0.0.1", remotePkgPath);
|
||||
await mgr.FullInstall();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Squirrel.Tests
|
||||
urlDownloader.Setup(x => x.DownloadUrl(It.IsAny<string>(), It.IsAny<IObserver<int>>()))
|
||||
.Returns(Observable.Return(File.ReadAllText(dlPath, Encoding.UTF8)));
|
||||
|
||||
var fixture = new UpdateManager("http://lol", "theApp", FrameworkVersion.Net40, ".", fs.Object, urlDownloader.Object);
|
||||
var fixture = new UpdateManager("http://lol", "theApp", ".", fs.Object, urlDownloader.Object);
|
||||
var result = default(UpdateInfo);
|
||||
|
||||
using (fixture) {
|
||||
@@ -69,7 +69,7 @@ namespace Squirrel.Tests
|
||||
urlDownloader.Setup(x => x.DownloadUrl(It.IsAny<string>(), It.IsAny<IObserver<int>>()))
|
||||
.Returns(Observable.Return(File.ReadAllText(dlPath, Encoding.UTF8)));
|
||||
|
||||
var fixture = new UpdateManager("http://lol", "theApp", FrameworkVersion.Net40, ".", fs.Object, urlDownloader.Object);
|
||||
var fixture = new UpdateManager("http://lol", "theApp", ".", fs.Object, urlDownloader.Object);
|
||||
using (fixture) {
|
||||
fixture.CheckForUpdate().First();
|
||||
}
|
||||
@@ -104,7 +104,7 @@ namespace Squirrel.Tests
|
||||
urlDownloader.Setup(x => x.DownloadUrl(It.IsAny<string>(), It.IsAny<IObserver<int>>()))
|
||||
.Returns(Observable.Return("lol this isn't right"));
|
||||
|
||||
var fixture = new UpdateManager("http://lol", "theApp", FrameworkVersion.Net40, ".", fs.Object, urlDownloader.Object);
|
||||
var fixture = new UpdateManager("http://lol", "theApp", ".", fs.Object, urlDownloader.Object);
|
||||
|
||||
using (fixture) {
|
||||
Assert.Throws<Exception>(() => fixture.CheckForUpdate().First());
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Squirrel.Tests
|
||||
fs.Setup(x => x.GetFileInfo(Path.Combine(".", "theApp", "packages", filename))).Returns(fileInfo.Object);
|
||||
|
||||
var fixture = ExposedObject.From(
|
||||
new UpdateManager("http://lol", "theApp", FrameworkVersion.Net40, ".", fs.Object, urlDownloader.Object));
|
||||
new UpdateManager("http://lol", "theApp", ".", fs.Object, urlDownloader.Object));
|
||||
|
||||
bool shouldDie = true;
|
||||
try {
|
||||
@@ -76,7 +76,7 @@ namespace Squirrel.Tests
|
||||
fs.Setup(x => x.GetFileInfo(Path.Combine(".", "theApp", "packages", filename))).Returns(fileInfo.Object);
|
||||
|
||||
var fixture = ExposedObject.From(
|
||||
new UpdateManager("http://lol", "theApp", FrameworkVersion.Net40, ".", fs.Object, urlDownloader.Object));
|
||||
new UpdateManager("http://lol", "theApp", ".", fs.Object, urlDownloader.Object));
|
||||
|
||||
bool shouldDie = true;
|
||||
try {
|
||||
@@ -122,7 +122,7 @@ namespace Squirrel.Tests
|
||||
// we're skipping that in the test we have to do it ourselves
|
||||
Directory.CreateDirectory(Path.Combine(tempDir, "SampleUpdatingApp", "packages"));
|
||||
|
||||
var fixture = new UpdateManager("http://localhost:30405", "SampleUpdatingApp", FrameworkVersion.Net40, tempDir);
|
||||
var fixture = new UpdateManager("http://localhost:30405", "SampleUpdatingApp", tempDir);
|
||||
using (fixture) {
|
||||
var progress = new List<int>();
|
||||
await fixture.DownloadReleases(entriesToDownload, progress.Add);
|
||||
@@ -166,7 +166,7 @@ namespace Squirrel.Tests
|
||||
// we're skipping that in the test we have to do it ourselves
|
||||
Directory.CreateDirectory(Path.Combine(tempDir, "SampleUpdatingApp", "packages"));
|
||||
|
||||
var fixture = new UpdateManager(updateDir.FullName, "SampleUpdatingApp", FrameworkVersion.Net40, tempDir);
|
||||
var fixture = new UpdateManager(updateDir.FullName, "SampleUpdatingApp", tempDir);
|
||||
using (fixture) {
|
||||
var progress = new List<int>();
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using NuGet;
|
||||
using Squirrel;
|
||||
using Squirrel.Tests.TestHelpers;
|
||||
using Xunit;
|
||||
using Assert = Xunit.Assert;
|
||||
|
||||
namespace Squirrel.Tests
|
||||
{
|
||||
public class PackageExtensionsTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("Squirrel.Core.1.0.0.0-full.nupkg", FrameworkVersion.Net40)]
|
||||
[InlineData("Caliburn.Micro.1.5.2.nupkg", FrameworkVersion.Net45)]
|
||||
public void DetectFrameworkVersion(string packageName, FrameworkVersion expected)
|
||||
{
|
||||
var path = IntegrationTestHelper.GetPath("fixtures", packageName);
|
||||
|
||||
var zip = new ZipPackage(path);
|
||||
|
||||
Assert.Equal(expected, zip.DetectFrameworkVersion());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,6 @@
|
||||
<Compile Include="ContentTypeTests.cs" />
|
||||
<Compile Include="DeltaPackageTests.cs" />
|
||||
<Compile Include="DownloadReleasesTests.cs" />
|
||||
<Compile Include="PackageExtensionsTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ReleaseEntryTests.cs" />
|
||||
<Compile Include="ReleasePackageTests.cs" />
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace Squirrel.Tests
|
||||
|
||||
using (Utility.WithTempDirectory(out path)) {
|
||||
using (Utility.WithTempDirectory(out remotePkgPath))
|
||||
using (var mgr = new UpdateManager(remotePkgPath, "theApp", FrameworkVersion.Net45, path)) {
|
||||
using (var mgr = new UpdateManager(remotePkgPath, "theApp", path)) {
|
||||
IntegrationTestHelper.CreateFakeInstalledApp("1.0.0.1", remotePkgPath);
|
||||
await mgr.FullInstall();
|
||||
}
|
||||
|
||||
using (var mgr = new UpdateManager("http://lol", "theApp", FrameworkVersion.Net45, path)) {
|
||||
using (var mgr = new UpdateManager("http://lol", "theApp", path)) {
|
||||
await mgr.CreateUninstallerRegistryEntry();
|
||||
var regKey = await mgr.CreateUninstallerRegistryEntry();
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Squirrel.Tests
|
||||
"Squirrel.Core.1.0.0.0-full.nupkg",
|
||||
}.ForEach(x => File.Copy(IntegrationTestHelper.GetPath("fixtures", x), Path.Combine(remotePackageDir.FullName, x)));
|
||||
|
||||
using (var fixture = new UpdateManager(remotePackageDir.FullName, "theApp", FrameworkVersion.Net45, tempDir)) {
|
||||
using (var fixture = new UpdateManager(remotePackageDir.FullName, "theApp", tempDir)) {
|
||||
await fixture.FullInstall();
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace Squirrel.Tests
|
||||
|
||||
// check for an update
|
||||
UpdateInfo updateInfo;
|
||||
using (var mgr = new UpdateManager(remotePackages, "theApp", FrameworkVersion.Net40, tempDir, new FakeUrlDownloader())) {
|
||||
using (var mgr = new UpdateManager(remotePackages, "theApp", tempDir, new FakeUrlDownloader())) {
|
||||
updateInfo = await mgr.CheckForUpdate();
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Squirrel.Tests
|
||||
ReleaseEntry.BuildReleasesFile(remotePackages);
|
||||
|
||||
UpdateInfo updateInfo;
|
||||
using (var mgr = new UpdateManager(remotePackages, "theApp", FrameworkVersion.Net40, tempDir, new FakeUrlDownloader())) {
|
||||
using (var mgr = new UpdateManager(remotePackages, "theApp", tempDir, new FakeUrlDownloader())) {
|
||||
updateInfo = await mgr.CheckForUpdate();
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace Squirrel.Tests
|
||||
await fixture.updateLocalReleasesFile();
|
||||
ReleaseEntry.BuildReleasesFile(remotePackages);
|
||||
|
||||
using (var mgr = new UpdateManager(remotePackages, "theApp", FrameworkVersion.Net40, tempDir, new FakeUrlDownloader())) {
|
||||
using (var mgr = new UpdateManager(remotePackages, "theApp", tempDir, new FakeUrlDownloader())) {
|
||||
UpdateInfo updateInfo;
|
||||
updateInfo = await mgr.CheckForUpdate();
|
||||
Assert.True(updateInfo.ReleasesToApply.First().IsDelta);
|
||||
@@ -243,7 +243,7 @@ namespace Squirrel.Tests
|
||||
string tempDir;
|
||||
using (Utility.WithTempDirectory(out tempDir)) {
|
||||
var directory = Path.Combine(tempDir, "missing-folder");
|
||||
var fixture = new UpdateManager(directory, "MyAppName", FrameworkVersion.Net40);
|
||||
var fixture = new UpdateManager(directory, "MyAppName");
|
||||
|
||||
using (fixture) {
|
||||
await Assert.ThrowsAsync<Exception>(() => fixture.CheckForUpdate());
|
||||
@@ -256,7 +256,7 @@ namespace Squirrel.Tests
|
||||
{
|
||||
string tempDir;
|
||||
using (Utility.WithTempDirectory(out tempDir)) {
|
||||
var fixture = new UpdateManager(tempDir, "MyAppName", FrameworkVersion.Net40);
|
||||
var fixture = new UpdateManager(tempDir, "MyAppName");
|
||||
|
||||
using (fixture) {
|
||||
await Assert.ThrowsAsync<Exception>(() => fixture.CheckForUpdate());
|
||||
@@ -269,7 +269,7 @@ namespace Squirrel.Tests
|
||||
{
|
||||
string tempDir;
|
||||
using (Utility.WithTempDirectory(out tempDir)) {
|
||||
var fixture = new UpdateManager(tempDir, "MyAppName", FrameworkVersion.Net40);
|
||||
var fixture = new UpdateManager(tempDir, "MyAppName");
|
||||
File.WriteAllText(Path.Combine(tempDir, "RELEASES"), "");
|
||||
|
||||
using (fixture) {
|
||||
@@ -282,7 +282,7 @@ namespace Squirrel.Tests
|
||||
public async Task WhenUrlResultsInWebExceptionWeShouldThrow()
|
||||
{
|
||||
// This should result in a WebException (which gets caught) unless you can actually access http://lol
|
||||
using (var fixture = new UpdateManager("http://lol", "theApp", FrameworkVersion.Net45)) {
|
||||
using (var fixture = new UpdateManager("http://lol", "theApp")) {
|
||||
await Assert.ThrowsAsync(typeof(WebException), () => fixture.CheckForUpdate());
|
||||
}
|
||||
}
|
||||
@@ -296,7 +296,7 @@ namespace Squirrel.Tests
|
||||
input = Environment.ExpandEnvironmentVariables(input);
|
||||
var expected = expectedVersion != null ? new Version(expectedVersion) : default(Version);
|
||||
|
||||
using (var fixture = new UpdateManager("http://lol", "theApp", FrameworkVersion.Net45)) {
|
||||
using (var fixture = new UpdateManager("http://lol", "theApp")) {
|
||||
Assert.Equal(expected, fixture.CurrentlyInstalledVersion(input));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user