public void Throws_if_release_is_null() { var patient = new Evergreen("user", "repo"); const string currentVersion = "1.0.0"; Assert.Throws <ArgumentNullException>(() => patient.IsCurrent(currentVersion, null)); }
[InlineData("1.0.0.1", "v1.0.0")] // invalid semver public void IsCurrent_throws_on_invalid_semversions(string currentVersion, string tagVersion) { var patient = new Evergreen("user", "repo"); var version = CreateReleaseFromTag(tagVersion); Assert.Throws <ArgumentException>(() => patient.IsCurrent(currentVersion, version)); }
[InlineData("2.0.0", "v1.0.0", true)] // current version is higher than tag. Active development? public void IsCurrent_responds_correctly(string currentVersion, string tagVersion, bool isCurrent) { var patient = new Evergreen("user", "repo"); var version = CreateReleaseFromTag(tagVersion); Assert.Equal(isCurrent, patient.IsCurrent(currentVersion, version)); }
/// <summary> /// Called when the addin initializes to check for updates and download the latest /// </summary> /// <returns>Task</returns> public static Task RunAsyncUpdateCheck() { return(QueuedTask.Run(async() => { // check current release and update it if there's a newer version var evergreen = new Evergreen("roemhildtg", "arcgis-pro-addins"); VersionInformation currentVersion = evergreen.GetCurrentAddInVersion(); Release latestVersion = await evergreen.GetLatestReleaseFromGithub(); if (!evergreen.IsCurrent(currentVersion.AddInVersion, latestVersion)) { await evergreen.Update(latestVersion); var notify = new ArcGIS.Desktop.Framework.Notification(); notify.Title = "Addin Update"; notify.Message = string.Format("Your pro-addins have been updated to version {0}. Please restart Pro to complete the update.", latestVersion.TagName); FrameworkApplication.AddNotification(notify); } })); }
private static void Main() { var updator = new Evergreen("steveoh", "pro-evergreen"); var release = updator.GetLatestReleaseFromGithub().Result; var version = updator.GetCurrentAddInVersion(); if (updator.IsCurrent(version.AddInVersion, release)) { return; } var assets = updator.Update(release).Result; // if (!updator.IsCompatible("currentProVersion", ".proversion from assets in release")) { // throw new Exception("incompatible versions of pro"); // } // // updator.Update(assets); }
public async Task CheckForUpdate() { Release = await Evergreen.GetLatestReleaseFromGithub(); var version = Evergreen.GetCurrentAddInVersion(); var notification = new Notification { Message = "You are up to date.", ImageUrl = "", Title = "Evergreen: Version Check" }; if (Evergreen.IsCurrent(version.AddInVersion, Release)) { FrameworkApplication.AddNotification(notification); return; } notification.Message = $"Release version {Release.TagName} is available"; FrameworkApplication.AddNotification(notification); }