Don't run the app if an update did nothing and we're not initial installing. Fixes #60

This commit is contained in:
Paul Betts
2014-09-25 16:07:30 -07:00
parent bbf23bf9ef
commit a0984b3a74
3 changed files with 12 additions and 9 deletions

View File

@@ -26,7 +26,7 @@ namespace Squirrel
this.rootAppDirectory = rootAppDirectory;
}
public async Task<string> ApplyReleases(UpdateInfo updateInfo, bool silentInstall, Action<int> progress = null)
public async Task<string> ApplyReleases(UpdateInfo updateInfo, bool silentInstall, bool attemptingFullInstall, Action<int> progress = null)
{
progress = progress ?? (_ => { });
@@ -34,8 +34,11 @@ namespace Squirrel
progress(10);
if (release == null) {
this.Log().Info("No release to install, running the app");
await invokePostInstall(updateInfo.CurrentlyInstalledVersion.Version, true, true);
if (attemptingFullInstall) {
this.Log().Info("No release to install, running the app");
await invokePostInstall(updateInfo.CurrentlyInstalledVersion.Version, true, true);
}
return getDirectoryForRelease(updateInfo.CurrentlyInstalledVersion.Version).FullName;
}

View File

@@ -67,7 +67,7 @@ namespace Squirrel
var applyReleases = new ApplyReleasesImpl(rootAppDirectory);
await acquireUpdateLock();
return await applyReleases.ApplyReleases(updateInfo, false, progress);
return await applyReleases.ApplyReleases(updateInfo, false, false, progress);
}
public async Task FullInstall(bool silentInstall = false)
@@ -78,7 +78,7 @@ namespace Squirrel
var applyReleases = new ApplyReleasesImpl(rootAppDirectory);
await acquireUpdateLock();
await applyReleases.ApplyReleases(updateInfo, silentInstall);
await applyReleases.ApplyReleases(updateInfo, silentInstall, true);
}
public async Task FullUninstall()

View File

@@ -205,7 +205,7 @@ namespace Squirrel.Tests
var progress = new List<int>();
await fixture.ApplyReleases(updateInfo, false, progress.Add);
await fixture.ApplyReleases(updateInfo, false, false, progress.Add);
this.Log().Info("Progress: [{0}]", String.Join(",", progress));
progress
@@ -254,7 +254,7 @@ namespace Squirrel.Tests
updateInfo.ReleasesToApply.Contains(latestFullEntry).ShouldBeTrue();
var progress = new List<int>();
await fixture.ApplyReleases(updateInfo, false, progress.Add);
await fixture.ApplyReleases(updateInfo, false, false, progress.Add);
this.Log().Info("Progress: [{0}]", String.Join(",", progress));
progress
@@ -303,7 +303,7 @@ namespace Squirrel.Tests
updateInfo.ReleasesToApply.Contains(latestFullEntry).ShouldBeTrue();
var progress = new List<int>();
await fixture.ApplyReleases(updateInfo, false, progress.Add);
await fixture.ApplyReleases(updateInfo, false, false, progress.Add);
this.Log().Info("Progress: [{0}]", String.Join(",", progress));
progress
@@ -356,7 +356,7 @@ namespace Squirrel.Tests
var progress = new List<int>();
await fixture.ApplyReleases(updateInfo, false, progress.Add);
await fixture.ApplyReleases(updateInfo, false, false, progress.Add);
this.Log().Info("Progress: [{0}]", String.Join(",", progress));
progress