From 2e108620d69fe1da528d7d2f5448c913d1adcbee Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 9 Aug 2013 22:00:07 -0700 Subject: [PATCH] Prepping for git flow, changed update branch to master --- .../UpdateTests/UpdatePackageProviderFixture.cs | 2 +- NzbDrone.Core/Configuration/ConfigFileProvider.cs | 6 +++--- NzbDrone.Core/Update/InstallUpdateService.cs | 1 - NzbDrone.Core/Update/UpdatePackageProvider.cs | 9 +++++++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/NzbDrone.Core.Test/UpdateTests/UpdatePackageProviderFixture.cs b/NzbDrone.Core.Test/UpdateTests/UpdatePackageProviderFixture.cs index 0ccb1aabb..4683d8221 100644 --- a/NzbDrone.Core.Test/UpdateTests/UpdatePackageProviderFixture.cs +++ b/NzbDrone.Core.Test/UpdateTests/UpdatePackageProviderFixture.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Core.Test.UpdateTests { UseRealHttp(); - Mocker.GetMock().SetupGet(c => c.UpdateUrl).Returns("http://update.nzbdrone.com/_release/"); + Mocker.GetMock().SetupGet(c => c.Branch).Returns("master"); var updates = Subject.GetAvailablePackages().ToList(); diff --git a/NzbDrone.Core/Configuration/ConfigFileProvider.cs b/NzbDrone.Core/Configuration/ConfigFileProvider.cs index 703d8c426..f588e2272 100644 --- a/NzbDrone.Core/Configuration/ConfigFileProvider.cs +++ b/NzbDrone.Core/Configuration/ConfigFileProvider.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Core.Configuration string Username { get; } string Password { get; } string LogLevel { get; } - string UpdateUrl { get; } + string Branch { get; } } public class ConfigFileProvider : IConfigFileProvider @@ -96,9 +96,9 @@ namespace NzbDrone.Core.Configuration get { return GetValueBoolean("AuthenticationEnabled", false); } } - public string UpdateUrl + public string Branch { - get { return GetValue("UpdateUrl", "http://update.nzbdrone.com/vnext/"); } + get { return GetValue("Branch", "master"); } } public string Username diff --git a/NzbDrone.Core/Update/InstallUpdateService.cs b/NzbDrone.Core/Update/InstallUpdateService.cs index d79d663b9..82c544a3d 100644 --- a/NzbDrone.Core/Update/InstallUpdateService.cs +++ b/NzbDrone.Core/Update/InstallUpdateService.cs @@ -71,7 +71,6 @@ namespace NzbDrone.Core.Update _diskProvider.MoveFolder(_appFolderInfo.GetUpdateClientFolder(), updateSandboxFolder); - _logger.Info("Starting update client"); var startInfo = new ProcessStartInfo { diff --git a/NzbDrone.Core/Update/UpdatePackageProvider.cs b/NzbDrone.Core/Update/UpdatePackageProvider.cs index 95fc23543..f85dc6e66 100644 --- a/NzbDrone.Core/Update/UpdatePackageProvider.cs +++ b/NzbDrone.Core/Update/UpdatePackageProvider.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text.RegularExpressions; using NLog; using NzbDrone.Common; +using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.Configuration; namespace NzbDrone.Core.Update @@ -20,7 +21,8 @@ namespace NzbDrone.Core.Update private readonly IHttpProvider _httpProvider; private readonly Logger _logger; - private static readonly Regex ParseRegex = new Regex(@"(?:\>)(?NzbDrone.+?(?\d+\.\d+\.\d+\.\d+).+?)(?:\<\/A\>)", RegexOptions.IgnoreCase); + private static readonly Regex ParseRegex = new Regex(@"(?:\>)(?NzbDrone.+?(?(?<=\.)\d+\.\d+\.\d+\.\d+).+?)(?:\<\/a\>)", + RegexOptions.IgnoreCase); public UpdatePackageProvider(IConfigFileProvider configService, IHttpProvider httpProvider, Logger logger) { @@ -32,7 +34,10 @@ namespace NzbDrone.Core.Update public IEnumerable GetAvailablePackages() { var updateList = new List(); - var updateUrl = _configService.UpdateUrl; + + var branch = _configService.Branch; + var version = BuildInfo.Version; + var updateUrl = String.Format("http://update.nzbdrone.com/v{0}/{1}/", version.Major, branch); _logger.Debug("Getting a list of updates from {0}", updateUrl);