#1460 The assembly versioning seems to work correctly now

This commit is contained in:
Jamie.Rees 2017-09-01 08:52:40 +01:00
parent 2535645a90
commit 85303626f0
3 changed files with 17 additions and 18 deletions

View file

@ -36,6 +36,7 @@ using Ombi.Api.Service;
using Ombi.Api.Slack; using Ombi.Api.Slack;
using Ombi.Core.Rule.Interfaces; using Ombi.Core.Rule.Interfaces;
using Ombi.Core.Senders; using Ombi.Core.Senders;
using Ombi.Schedule.Jobs.Ombi;
using Ombi.Schedule.Jobs.Plex; using Ombi.Schedule.Jobs.Plex;
using Ombi.Schedule.Ombi; using Ombi.Schedule.Ombi;
using Ombi.Store.Repository.Requests; using Ombi.Store.Repository.Requests;

View file

@ -9,7 +9,7 @@ namespace Ombi.Helpers
Assembly.GetEntryAssembly().GetType() Assembly.GetEntryAssembly().GetType()
.GetTypeInfo() .GetTypeInfo()
.Assembly .Assembly
.GetCustomAttribute<AssemblyProductAttribute>() .GetCustomAttribute<AssemblyInformationalVersionAttribute>()
.Product; .InformationalVersion;
} }
} }

View file

@ -2,32 +2,31 @@
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.IO.Compression;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Ombi.Api.Service; using Ombi.Api.Service;
using Ombi.Api.Service.Models; using Ombi.Api.Service.Models;
using Ombi.Helpers; using Ombi.Helpers;
using System.IO.Compression; using Ombi.Schedule.Ombi;
namespace Ombi.Schedule.Ombi namespace Ombi.Schedule.Jobs.Ombi
{ {
public class OmbiAutomaticUpdater : IOmbiAutomaticUpdater public class OmbiAutomaticUpdater : IOmbiAutomaticUpdater
{ {
public OmbiAutomaticUpdater(ILogger<OmbiAutomaticUpdater> log, IOmbiService service, IOptions<ApplicationSettings> settings) public OmbiAutomaticUpdater(ILogger<OmbiAutomaticUpdater> log, IOmbiService service)
{ {
Logger = log; Logger = log;
OmbiService = service; OmbiService = service;
Settings = settings.Value;
} }
private ILogger<OmbiAutomaticUpdater> Logger { get; } private ILogger<OmbiAutomaticUpdater> Logger { get; }
private IOmbiService OmbiService { get; } private IOmbiService OmbiService { get; }
private ApplicationSettings Settings { get; }
public async Task Update() public async Task Update()
{ {
@ -35,18 +34,17 @@ namespace Ombi.Schedule.Ombi
// IF AutoUpdateEnabled => // IF AutoUpdateEnabled =>
// ELSE Return; // ELSE Return;
var currentLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var currentLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
//var currentBranch = Settings.Branch;
var currentBranch = "BRANCH"; var productVersion = AssemblyHelper.GetRuntimeVersion();
#if DEBUG var productArray = productVersion.Split('-');
if (currentBranch == "{{BRANCH}}") var version = productArray[0];
{ var branch = productArray[1];
currentBranch = "DotNetCore";
}
#endif var updates = await OmbiService.GetUpdates(branch);
var updates = await OmbiService.GetUpdates(currentBranch);
var serverVersion = updates.UpdateVersionString.Substring(1, 6); var serverVersion = updates.UpdateVersionString.Substring(1, 6);
if (serverVersion != AssemblyHelper.GetRuntimeVersion()) if (!serverVersion.Equals(version, StringComparison.CurrentCultureIgnoreCase))
{ {
// Let's download the correct zip // Let's download the correct zip