mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-25 11:13:39 +02:00
Merge branch 'kay.one' of github.com:NzbDrone/NzbDrone into markus
This commit is contained in:
commit
d5a602c4eb
64
NzbDrone.App.Test/IISProviderFixture.cs
Normal file
64
NzbDrone.App.Test/IISProviderFixture.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using FluentAssertions;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Ninject;
|
||||||
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Common.Model;
|
||||||
|
using NzbDrone.Providers;
|
||||||
|
using NzbDrone.Test.Common;
|
||||||
|
using NzbDrone.Test.Dummy;
|
||||||
|
|
||||||
|
namespace NzbDrone.App.Test
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class IISProviderFixture : TestBase
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void should_update_pid_env_varibles()
|
||||||
|
{
|
||||||
|
WithTempAsAppPath();
|
||||||
|
|
||||||
|
var dummy = StartDummyProcess();
|
||||||
|
|
||||||
|
Environment.SetEnvironmentVariable(EnviromentProvider.NZBDRONE_PID, "0");
|
||||||
|
Environment.SetEnvironmentVariable(EnviromentProvider.NZBDRONE_PATH, "Test");
|
||||||
|
|
||||||
|
Mocker.GetMock<ProcessProvider>()
|
||||||
|
.Setup(c => c.Start(It.IsAny<ProcessStartInfo>()))
|
||||||
|
.Returns(dummy);
|
||||||
|
|
||||||
|
Mocker.Resolve<IISProvider>().StartServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_set_iis_procces_id()
|
||||||
|
{
|
||||||
|
WithTempAsAppPath();
|
||||||
|
var dummy = StartDummyProcess();
|
||||||
|
|
||||||
|
Mocker.GetMock<ProcessProvider>()
|
||||||
|
.Setup(c => c.Start(It.IsAny<ProcessStartInfo>()))
|
||||||
|
.Returns(dummy);
|
||||||
|
|
||||||
|
//act
|
||||||
|
Mocker.Resolve<IISProvider>().StartServer();
|
||||||
|
|
||||||
|
//assert
|
||||||
|
Mocker.Resolve<IISProvider>().IISProcessId.Should().Be(dummy.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Process StartDummyProcess()
|
||||||
|
{
|
||||||
|
var startInfo = new ProcessStartInfo(DummyApp.DUMMY_PROCCESS_NAME + ".exe");
|
||||||
|
startInfo.UseShellExecute = false;
|
||||||
|
startInfo.RedirectStandardOutput = true;
|
||||||
|
startInfo.RedirectStandardError = true;
|
||||||
|
startInfo.CreateNoWindow = true;
|
||||||
|
return new ProcessProvider().Start(startInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -30,6 +30,7 @@
|
|||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="FizzWare.NBuilder">
|
<Reference Include="FizzWare.NBuilder">
|
||||||
@ -65,6 +66,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="CentralDispatchTests.cs" />
|
<Compile Include="CentralDispatchTests.cs" />
|
||||||
|
<Compile Include="IISProviderFixture.cs" />
|
||||||
<Compile Include="RouterTest.cs" />
|
<Compile Include="RouterTest.cs" />
|
||||||
<Compile Include="MonitoringProviderTest.cs" />
|
<Compile Include="MonitoringProviderTest.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
@ -35,11 +35,7 @@ namespace NzbDrone.Common.Test
|
|||||||
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
BinFolder.Refresh();
|
VerifyCopy();
|
||||||
BinFolderCopy.Refresh();
|
|
||||||
|
|
||||||
BinFolder.GetFiles("*.*", SearchOption.AllDirectories)
|
|
||||||
.Should().HaveSameCount(BinFolderCopy.GetFiles("*.*", SearchOption.AllDirectories));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -51,16 +47,24 @@ namespace NzbDrone.Common.Test
|
|||||||
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
||||||
|
|
||||||
//Delete Random File
|
//Delete Random File
|
||||||
BinFolderCopy.GetFiles().First().Delete();
|
BinFolderCopy.Refresh();
|
||||||
|
BinFolderCopy.GetFiles("*.*", SearchOption.AllDirectories).First().Delete();
|
||||||
|
|
||||||
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
|
VerifyCopy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void VerifyCopy()
|
||||||
|
{
|
||||||
BinFolder.Refresh();
|
BinFolder.Refresh();
|
||||||
BinFolderCopy.Refresh();
|
BinFolderCopy.Refresh();
|
||||||
|
|
||||||
BinFolder.GetFiles("*.*", SearchOption.AllDirectories)
|
BinFolderCopy.GetFiles("*.*", SearchOption.AllDirectories)
|
||||||
.Should().HaveSameCount(BinFolderCopy.GetFiles("*.*", SearchOption.AllDirectories));
|
.Should().HaveSameCount(BinFolder.GetFiles("*.*", SearchOption.AllDirectories));
|
||||||
|
|
||||||
|
BinFolderCopy.GetDirectories().Should().HaveSameCount(BinFolder.GetDirectories());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="FluentAssertions, Version=1.6.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
|
<Reference Include="FluentAssertions, Version=1.6.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
|
||||||
|
@ -13,8 +13,11 @@ namespace NzbDrone.Common.Test
|
|||||||
private EnviromentProvider GetEnviromentProvider()
|
private EnviromentProvider GetEnviromentProvider()
|
||||||
{
|
{
|
||||||
var envMoq = new Mock<EnviromentProvider>();
|
var envMoq = new Mock<EnviromentProvider>();
|
||||||
|
|
||||||
envMoq.SetupGet(c => c.ApplicationPath).Returns(@"C:\NzbDrone\");
|
envMoq.SetupGet(c => c.ApplicationPath).Returns(@"C:\NzbDrone\");
|
||||||
|
|
||||||
|
envMoq.SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\");
|
||||||
|
|
||||||
return envMoq.Object;
|
return envMoq.Object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,5 +52,29 @@ namespace NzbDrone.Common.Test
|
|||||||
{
|
{
|
||||||
GetEnviromentProvider().GetNlogConfigPath().Should().BeEquivalentTo(@"C:\NzbDrone\NzbDrone.Web\log.config");
|
GetEnviromentProvider().GetNlogConfigPath().Should().BeEquivalentTo(@"C:\NzbDrone\NzbDrone.Web\log.config");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Sanbox()
|
||||||
|
{
|
||||||
|
GetEnviromentProvider().GetUpdateSandboxFolder().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetUpdatePackageFolder()
|
||||||
|
{
|
||||||
|
GetEnviromentProvider().GetUpdatePackageFolder().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\NzbDrone\");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetUpdateClientFolder()
|
||||||
|
{
|
||||||
|
GetEnviromentProvider().GetUpdateClientFolder().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\NzbDrone\NzbDrone.Update\");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetUpdateClientExePath()
|
||||||
|
{
|
||||||
|
GetEnviromentProvider().GetUpdateClientExePath().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\NzbDrone\NzbDrone.Update\NzbDrone.Update.exe");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,26 +4,27 @@ using System.Linq;
|
|||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
|
using NzbDrone.Test.Dummy;
|
||||||
|
|
||||||
namespace NzbDrone.Common.Test
|
namespace NzbDrone.Common.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class ProcessProviderTests : TestBase
|
public class ProcessProviderTests : TestBase
|
||||||
{
|
{
|
||||||
private const string DummyProccessName = "NzbDrone.Test.Dummy";
|
|
||||||
ProcessProvider _processProvider;
|
ProcessProvider _processProvider;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Process.GetProcessesByName(DummyProccessName).ToList().ForEach(c => c.Kill());
|
Process.GetProcessesByName(DummyApp.DUMMY_PROCCESS_NAME).ToList().ForEach(c => c.Kill());
|
||||||
_processProvider = new ProcessProvider();
|
_processProvider = new ProcessProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TearDown]
|
[TearDown]
|
||||||
public void TearDown()
|
public void TearDown()
|
||||||
{
|
{
|
||||||
Process.GetProcessesByName(DummyProccessName).ToList().ForEach(c => c.Kill());
|
Process.GetProcessesByName(DummyApp.DUMMY_PROCCESS_NAME).ToList().ForEach(c => c.Kill());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase(0)]
|
[TestCase(0)]
|
||||||
@ -58,20 +59,20 @@ namespace NzbDrone.Common.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void Should_be_able_to_start_process()
|
public void Should_be_able_to_start_process()
|
||||||
{
|
{
|
||||||
var startInfo = new ProcessStartInfo(DummyProccessName + ".exe");
|
var startInfo = new ProcessStartInfo(DummyApp.DUMMY_PROCCESS_NAME + ".exe");
|
||||||
|
|
||||||
//Act/Assert
|
//Act/Assert
|
||||||
_processProvider.GetProcessByName(DummyProccessName).Should()
|
_processProvider.GetProcessByName(DummyApp.DUMMY_PROCCESS_NAME).Should()
|
||||||
.BeEmpty("Dummy process is already running");
|
.BeEmpty("Dummy process is already running");
|
||||||
_processProvider.Start(startInfo).Should().NotBeNull();
|
_processProvider.Start(startInfo).Should().NotBeNull();
|
||||||
|
|
||||||
_processProvider.GetProcessByName(DummyProccessName).Should()
|
_processProvider.GetProcessByName(DummyApp.DUMMY_PROCCESS_NAME).Should()
|
||||||
.HaveCount(1, "excepted one dummy process to be already running");
|
.HaveCount(1, "excepted one dummy process to be already running");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Process StartDummyProcess()
|
public Process StartDummyProcess()
|
||||||
{
|
{
|
||||||
var startInfo = new ProcessStartInfo(DummyProccessName + ".exe");
|
var startInfo = new ProcessStartInfo(DummyApp.DUMMY_PROCCESS_NAME + ".exe");
|
||||||
return _processProvider.Start(startInfo);
|
return _processProvider.Start(startInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using System.Xml.XPath;
|
using System.Xml.XPath;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using Ninject;
|
||||||
using NzbDrone.Common.Model;
|
using NzbDrone.Common.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Common
|
namespace NzbDrone.Common
|
||||||
@ -14,6 +15,8 @@ namespace NzbDrone.Common
|
|||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
private readonly string _configFile;
|
private readonly string _configFile;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
public ConfigFileProvider(EnviromentProvider enviromentProvider)
|
public ConfigFileProvider(EnviromentProvider enviromentProvider)
|
||||||
{
|
{
|
||||||
_enviromentProvider = enviromentProvider;
|
_enviromentProvider = enviromentProvider;
|
||||||
@ -22,6 +25,11 @@ namespace NzbDrone.Common
|
|||||||
CreateDefaultConfigFile();
|
CreateDefaultConfigFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConfigFileProvider()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public virtual Guid Guid
|
public virtual Guid Guid
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -67,7 +67,12 @@ namespace NzbDrone.Common
|
|||||||
targetFolder.Create();
|
targetFolder.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var file in sourceFolder.GetFiles("*.*", SearchOption.AllDirectories))
|
foreach (var subDir in sourceFolder.GetDirectories())
|
||||||
|
{
|
||||||
|
CopyDirectory(subDir.FullName, Path.Combine(target, subDir.Name));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var file in sourceFolder.GetFiles("*.*", SearchOption.TopDirectoryOnly))
|
||||||
{
|
{
|
||||||
var destFile = Path.Combine(target, file.Name);
|
var destFile = Path.Combine(target, file.Name);
|
||||||
file.CopyTo(destFile, true);
|
file.CopyTo(destFile, true);
|
||||||
|
@ -9,6 +9,9 @@ namespace NzbDrone.Common
|
|||||||
{
|
{
|
||||||
public const string IIS_FOLDER_NAME = "iisexpress";
|
public const string IIS_FOLDER_NAME = "iisexpress";
|
||||||
|
|
||||||
|
public const string NZBDRONE_PATH = "NZBDRONE_PATH";
|
||||||
|
public const string NZBDRONE_PID = "NZBDRONE_PID";
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
private static readonly bool isInDebug = true;
|
private static readonly bool isInDebug = true;
|
||||||
#else
|
#else
|
||||||
@ -98,7 +101,7 @@ namespace NzbDrone.Common
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var id = Convert.ToInt32(Environment.GetEnvironmentVariable("NZBDRONE_PID"));
|
var id = Convert.ToInt32(Environment.GetEnvironmentVariable(NZBDRONE_PID));
|
||||||
|
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
throw new InvalidOperationException("NZBDRONE_PID isn't a valid environment variable.");
|
throw new InvalidOperationException("NZBDRONE_PID isn't a valid environment variable.");
|
||||||
|
@ -50,12 +50,18 @@ namespace NzbDrone.Common
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var udpTarget = new ChainsawTarget();
|
var udpTarget = new NLogViewerTarget();
|
||||||
udpTarget.Address = "udp://127.0.0.1:20480";
|
udpTarget.Address = "udp://127.0.0.1:20480";
|
||||||
udpTarget.IncludeCallSite = true;
|
udpTarget.IncludeCallSite = true;
|
||||||
udpTarget.IncludeSourceInfo = true;
|
udpTarget.IncludeSourceInfo = true;
|
||||||
udpTarget.IncludeNLogData = true;
|
udpTarget.IncludeNLogData = true;
|
||||||
udpTarget.IncludeNdc = true;
|
udpTarget.IncludeNdc = true;
|
||||||
|
udpTarget.Parameters.Add(new NLogViewerParameterInfo
|
||||||
|
{
|
||||||
|
Name = "Exception",
|
||||||
|
Layout = "${exception:format=ToString}"
|
||||||
|
});
|
||||||
|
|
||||||
LogManager.Configuration.AddTarget(udpTarget.GetType().Name, udpTarget);
|
LogManager.Configuration.AddTarget(udpTarget.GetType().Name, udpTarget);
|
||||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, udpTarget));
|
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, udpTarget));
|
||||||
|
|
||||||
@ -68,7 +74,6 @@ namespace NzbDrone.Common
|
|||||||
if (LogManager.ThrowExceptions)
|
if (LogManager.ThrowExceptions)
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RegisterExceptioneer()
|
public static void RegisterExceptioneer()
|
||||||
|
@ -30,11 +30,15 @@
|
|||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Exceptioneer.WindowsFormsClient">
|
<Reference Include="Exceptioneer.WindowsFormsClient">
|
||||||
<HintPath>..\Libraries\Exceptioneer.WindowsFormsClient.dll</HintPath>
|
<HintPath>..\Libraries\Exceptioneer.WindowsFormsClient.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Ninject">
|
||||||
|
<HintPath>..\packages\Ninject.2.2.1.4\lib\net40-Full\Ninject.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="NLog">
|
<Reference Include="NLog">
|
||||||
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
|
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -20,6 +20,7 @@ namespace NzbDrone.Common
|
|||||||
private const string UPDATE_PACKAGE_FOLDER_NAME = "nzbdrone\\";
|
private const string UPDATE_PACKAGE_FOLDER_NAME = "nzbdrone\\";
|
||||||
private const string UPDATE_BACKUP_FOLDER_NAME = "nzbdrone_backup\\";
|
private const string UPDATE_BACKUP_FOLDER_NAME = "nzbdrone_backup\\";
|
||||||
private const string UPDATE_CLIENT_EXE = "nzbdrone.update.exe";
|
private const string UPDATE_CLIENT_EXE = "nzbdrone.update.exe";
|
||||||
|
private const string UPDATE_CLIENT_FOLDER_NAME = "NzbDrone.Update\\";
|
||||||
|
|
||||||
public static string GetIISFolder(this EnviromentProvider enviromentProvider)
|
public static string GetIISFolder(this EnviromentProvider enviromentProvider)
|
||||||
{
|
{
|
||||||
@ -91,9 +92,14 @@ namespace NzbDrone.Common
|
|||||||
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_PACKAGE_FOLDER_NAME);
|
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_PACKAGE_FOLDER_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetUpdateClientFolder(this EnviromentProvider enviromentProvider)
|
||||||
|
{
|
||||||
|
return Path.Combine(enviromentProvider.GetUpdatePackageFolder(), UPDATE_CLIENT_FOLDER_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetUpdateClientExePath(this EnviromentProvider enviromentProvider)
|
public static string GetUpdateClientExePath(this EnviromentProvider enviromentProvider)
|
||||||
{
|
{
|
||||||
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_CLIENT_EXE);
|
return Path.Combine(enviromentProvider.GetUpdateClientFolder(), UPDATE_CLIENT_EXE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,5 +12,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.6.0.*")]
|
[assembly: AssemblyVersion("0.0.0.*")]
|
||||||
[assembly: AssemblyFileVersion("0.6.0.*")]
|
[assembly: AssemblyFileVersion("0.0.0.*")]
|
@ -93,7 +93,7 @@
|
|||||||
<Compile Include="JobTests\SearchJobTest.cs" />
|
<Compile Include="JobTests\SearchJobTest.cs" />
|
||||||
<Compile Include="ProviderTests\PostDownloadProviderTests\ProcessDownloadFixture.cs" />
|
<Compile Include="ProviderTests\PostDownloadProviderTests\ProcessDownloadFixture.cs" />
|
||||||
<Compile Include="ProviderTests\JobProviderTests\TestJobs.cs" />
|
<Compile Include="ProviderTests\JobProviderTests\TestJobs.cs" />
|
||||||
<Compile Include="ProviderTests\UpdateProviderTests\PreformUpdateFixture.cs" />
|
<Compile Include="ProviderTests\UpdateProviderTests\StartUpdateFixture.cs" />
|
||||||
<Compile Include="ProviderTests\UpdateProviderTests\GetAvilableUpdateFixture.cs" />
|
<Compile Include="ProviderTests\UpdateProviderTests\GetAvilableUpdateFixture.cs" />
|
||||||
<Compile Include="SortHelperTest.cs" />
|
<Compile Include="SortHelperTest.cs" />
|
||||||
<Compile Include="ProviderTests\EpisodeProviderTest_DeleteInvalidEpisodes.cs" />
|
<Compile Include="ProviderTests\EpisodeProviderTest_DeleteInvalidEpisodes.cs" />
|
||||||
|
@ -14,10 +14,12 @@ using NzbDrone.Core.Test.Framework;
|
|||||||
namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
internal class PreformUpdateFixture : CoreTest
|
internal class StartUpdateFixture : CoreTest
|
||||||
{
|
{
|
||||||
private const string SANDBOX_FOLDER = @"C:\Temp\nzbdrone_update\";
|
private const string SANDBOX_FOLDER = @"C:\Temp\nzbdrone_update\";
|
||||||
|
|
||||||
|
private readonly Guid _clientGuid = Guid.NewGuid();
|
||||||
|
|
||||||
private readonly UpdatePackage updatePackage = new UpdatePackage
|
private readonly UpdatePackage updatePackage = new UpdatePackage
|
||||||
{
|
{
|
||||||
FileName = "NzbDrone.kay.one.0.6.0.2031.zip",
|
FileName = "NzbDrone.kay.one.0.6.0.2031.zip",
|
||||||
@ -29,9 +31,33 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<EnviromentProvider>().SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\");
|
Mocker.GetMock<EnviromentProvider>().SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\");
|
||||||
|
Mocker.GetMock<ConfigFileProvider>().SetupGet(c => c.Guid).Returns(_clientGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_delete_sandbox_before_update_if_folder_exists()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(true);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_not_delete_sandbox_before_update_if_folder_doesnt_exists()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(false);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never());
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Should_download_update_package()
|
public void Should_download_update_package()
|
||||||
@ -39,7 +65,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|||||||
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
Mocker.GetMock<HttpProvider>().Verify(
|
Mocker.GetMock<HttpProvider>().Verify(
|
||||||
@ -47,33 +73,49 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Should_call_download_and_extract_using_correct_arguments()
|
public void Should_extract_update_package()
|
||||||
{
|
{
|
||||||
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
Mocker.GetMock<ArchiveProvider>().Verify(
|
Mocker.GetMock<ArchiveProvider>().Verify(
|
||||||
c => c.ExtractArchive(updateArchive, SANDBOX_FOLDER));
|
c => c.ExtractArchive(updateArchive, SANDBOX_FOLDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Should_copy_update_client_to_root_of_sandbox()
|
||||||
|
{
|
||||||
|
var updateClientFolder = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateClientFolder();
|
||||||
|
|
||||||
|
//Act
|
||||||
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Mocker.GetMock<DiskProvider>().Verify(
|
||||||
|
c => c.CopyDirectory(updateClientFolder, SANDBOX_FOLDER));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_start_update_client()
|
public void should_start_update_client()
|
||||||
{
|
{
|
||||||
//Setup
|
//Setup
|
||||||
var updateClientPath = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateClientExePath();
|
var updateClientPath = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateClientExePath();
|
||||||
|
|
||||||
|
Mocker.GetMock<EnviromentProvider>()
|
||||||
|
.SetupGet(c => c.NzbDroneProcessIdFromEnviroment).Returns(12);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
Mocker.GetMock<ProcessProvider>().Verify(
|
Mocker.GetMock<ProcessProvider>().Verify(
|
||||||
c => c.Start(It.Is<ProcessStartInfo>(p =>
|
c => c.Start(It.Is<ProcessStartInfo>(p =>
|
||||||
p.FileName == updateClientPath &&
|
p.FileName == updateClientPath &&
|
||||||
p.Arguments == "/12 /"
|
p.Arguments == "12 " + _clientGuid.ToString())
|
||||||
)));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -92,7 +134,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|||||||
Mocker.Resolve<HttpProvider>();
|
Mocker.Resolve<HttpProvider>();
|
||||||
Mocker.Resolve<DiskProvider>();
|
Mocker.Resolve<DiskProvider>();
|
||||||
Mocker.Resolve<ArchiveProvider>();
|
Mocker.Resolve<ArchiveProvider>();
|
||||||
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
||||||
updateSubFolder.Refresh();
|
updateSubFolder.Refresh();
|
||||||
//Assert
|
//Assert
|
||||||
|
|
@ -92,6 +92,7 @@ namespace NzbDrone.Core
|
|||||||
Kernel.Bind<IJob>().To<BacklogSearchJob>().InSingletonScope();
|
Kernel.Bind<IJob>().To<BacklogSearchJob>().InSingletonScope();
|
||||||
Kernel.Bind<IJob>().To<BannerDownloadJob>().InSingletonScope();
|
Kernel.Bind<IJob>().To<BannerDownloadJob>().InSingletonScope();
|
||||||
Kernel.Bind<IJob>().To<ConvertEpisodeJob>().InSingletonScope();
|
Kernel.Bind<IJob>().To<ConvertEpisodeJob>().InSingletonScope();
|
||||||
|
Kernel.Bind<IJob>().To<AppUpdateJob>().InSingletonScope();
|
||||||
|
|
||||||
Kernel.Get<JobProvider>().Initialize();
|
Kernel.Get<JobProvider>().Initialize();
|
||||||
Kernel.Get<WebTimer>().StartTimer(30);
|
Kernel.Get<WebTimer>().StartTimer(30);
|
||||||
|
@ -220,6 +220,7 @@
|
|||||||
<Compile Include="Providers\Indexer\Newznab.cs" />
|
<Compile Include="Providers\Indexer\Newznab.cs" />
|
||||||
<Compile Include="Providers\NewznzbProvider.cs" />
|
<Compile Include="Providers\NewznzbProvider.cs" />
|
||||||
<Compile Include="Providers\ExternalNotification\Prowl.cs" />
|
<Compile Include="Providers\ExternalNotification\Prowl.cs" />
|
||||||
|
<Compile Include="Providers\Jobs\AppUpdateJob.cs" />
|
||||||
<Compile Include="Providers\ProwlProvider.cs" />
|
<Compile Include="Providers\ProwlProvider.cs" />
|
||||||
<Compile Include="Providers\Core\UdpProvider.cs" />
|
<Compile Include="Providers\Core\UdpProvider.cs" />
|
||||||
<Compile Include="Providers\ExternalNotification\Growl.cs" />
|
<Compile Include="Providers\ExternalNotification\Growl.cs" />
|
||||||
|
@ -16,5 +16,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.6.0.*")]
|
[assembly: AssemblyVersion("0.0.0.*")]
|
||||||
[assembly: AssemblyFileVersion("0.6.0.*")]
|
[assembly: AssemblyFileVersion("0.0.0.*")]
|
33
NzbDrone.Core/Providers/Jobs/AppUpdateJob.cs
Normal file
33
NzbDrone.Core/Providers/Jobs/AppUpdateJob.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using NzbDrone.Core.Model.Notification;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Providers.Jobs
|
||||||
|
{
|
||||||
|
public class AppUpdateJob : IJob
|
||||||
|
{
|
||||||
|
private readonly UpdateProvider _updateProvider;
|
||||||
|
|
||||||
|
public AppUpdateJob(UpdateProvider updateProvider)
|
||||||
|
{
|
||||||
|
_updateProvider = updateProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "Update Application Job"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int DefaultInterval
|
||||||
|
{
|
||||||
|
get { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
|
||||||
|
{
|
||||||
|
notification.CurrentMessage = "Updating NzbDrone";
|
||||||
|
|
||||||
|
var updatePackage = _updateProvider.GetAvilableUpdate();
|
||||||
|
|
||||||
|
_updateProvider.StartUpdate(updatePackage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@ -12,12 +13,15 @@ using NzbDrone.Core.Providers.Core;
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
class UpdateProvider
|
public class UpdateProvider
|
||||||
{
|
{
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly ConfigProvider _configProvider;
|
||||||
|
private readonly ConfigFileProvider _configFileProvider;
|
||||||
private readonly EnviromentProvider _enviromentProvider;
|
private readonly EnviromentProvider _enviromentProvider;
|
||||||
private readonly ArchiveProvider _archiveProvider;
|
private readonly ArchiveProvider _archiveProvider;
|
||||||
|
private readonly ProcessProvider _processProvider;
|
||||||
|
private readonly DiskProvider _diskProvider;
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
private static readonly Regex parseRegex = new Regex(@"(?:\>)(?<filename>NzbDrone.+?(?<version>\d+\.\d+\.\d+\.\d+).+?)(?:\<\/A\>)", RegexOptions.IgnoreCase);
|
private static readonly Regex parseRegex = new Regex(@"(?:\>)(?<filename>NzbDrone.+?(?<version>\d+\.\d+\.\d+\.\d+).+?)(?:\<\/A\>)", RegexOptions.IgnoreCase);
|
||||||
@ -25,13 +29,16 @@ namespace NzbDrone.Core.Providers
|
|||||||
|
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
public UpdateProvider(HttpProvider httpProvider, ConfigProvider configProvider,
|
public UpdateProvider(HttpProvider httpProvider, ConfigProvider configProvider, ConfigFileProvider configFileProvider,
|
||||||
EnviromentProvider enviromentProvider, ArchiveProvider archiveProvider)
|
EnviromentProvider enviromentProvider, ArchiveProvider archiveProvider, ProcessProvider processProvider, DiskProvider diskProvider)
|
||||||
{
|
{
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
|
_configFileProvider = configFileProvider;
|
||||||
_enviromentProvider = enviromentProvider;
|
_enviromentProvider = enviromentProvider;
|
||||||
_archiveProvider = archiveProvider;
|
_archiveProvider = archiveProvider;
|
||||||
|
_processProvider = processProvider;
|
||||||
|
_diskProvider = diskProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UpdateProvider()
|
public UpdateProvider()
|
||||||
@ -71,10 +78,16 @@ namespace NzbDrone.Core.Providers
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void StartUpgrade(UpdatePackage updatePackage)
|
public virtual void StartUpdate(UpdatePackage updatePackage)
|
||||||
{
|
{
|
||||||
var packageDestination = Path.Combine(_enviromentProvider.GetUpdateSandboxFolder(), updatePackage.FileName);
|
var packageDestination = Path.Combine(_enviromentProvider.GetUpdateSandboxFolder(), updatePackage.FileName);
|
||||||
|
|
||||||
|
if (_diskProvider.FolderExists(_enviromentProvider.GetUpdateSandboxFolder()))
|
||||||
|
{
|
||||||
|
logger.Info("Deleting old update files");
|
||||||
|
_diskProvider.DeleteFolder(_enviromentProvider.GetUpdateSandboxFolder(), true);
|
||||||
|
}
|
||||||
|
|
||||||
logger.Info("Downloading update package from [{0}] to [{1}]", updatePackage.Url, packageDestination);
|
logger.Info("Downloading update package from [{0}] to [{1}]", updatePackage.Url, packageDestination);
|
||||||
_httpProvider.DownloadFile(updatePackage.Url, packageDestination);
|
_httpProvider.DownloadFile(updatePackage.Url, packageDestination);
|
||||||
logger.Info("Download completed for update package from [{0}]", updatePackage.FileName);
|
logger.Info("Download completed for update package from [{0}]", updatePackage.FileName);
|
||||||
@ -82,6 +95,20 @@ namespace NzbDrone.Core.Providers
|
|||||||
logger.Info("Extracting Update package");
|
logger.Info("Extracting Update package");
|
||||||
_archiveProvider.ExtractArchive(packageDestination, _enviromentProvider.GetUpdateSandboxFolder());
|
_archiveProvider.ExtractArchive(packageDestination, _enviromentProvider.GetUpdateSandboxFolder());
|
||||||
logger.Info("Update package extracted successfully");
|
logger.Info("Update package extracted successfully");
|
||||||
|
|
||||||
|
logger.Info("Preparing client");
|
||||||
|
_diskProvider.CopyDirectory(_enviromentProvider.GetUpdateClientFolder(), _enviromentProvider.GetUpdateSandboxFolder());
|
||||||
|
|
||||||
|
|
||||||
|
logger.Info("Starting update client");
|
||||||
|
var startInfo = new ProcessStartInfo()
|
||||||
|
{
|
||||||
|
FileName = _enviromentProvider.GetUpdateClientExePath(),
|
||||||
|
Arguments = string.Format("{0} {1}", _enviromentProvider.NzbDroneProcessIdFromEnviroment, _configFileProvider.Guid)
|
||||||
|
};
|
||||||
|
|
||||||
|
_processProvider.Start(startInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.Practices.ServiceLocation">
|
<Reference Include="Microsoft.Practices.ServiceLocation">
|
||||||
|
@ -3,8 +3,10 @@ using System.Diagnostics;
|
|||||||
|
|
||||||
namespace NzbDrone.Test.Dummy
|
namespace NzbDrone.Test.Dummy
|
||||||
{
|
{
|
||||||
class Program
|
public class DummyApp
|
||||||
{
|
{
|
||||||
|
public const string DUMMY_PROCCESS_NAME = "NzbDrone.Test.Dummy";
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Dummy process. ID:{0} Path:{1}", Process.GetCurrentProcess().Id, Process.GetCurrentProcess().MainModule.FileName);
|
Console.WriteLine("Dummy process. ID:{0} Path:{1}", Process.GetCurrentProcess().Id, Process.GetCurrentProcess().MainModule.FileName);
|
@ -43,7 +43,7 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="DummyApp.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
@ -48,7 +48,9 @@
|
|||||||
<Reference Include="Moq">
|
<Reference Include="Moq">
|
||||||
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
|
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL" />
|
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="nunit.framework">
|
<Reference Include="nunit.framework">
|
||||||
<HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
|
<HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -64,7 +64,7 @@ namespace NzbDrone.Update.Test
|
|||||||
_program.Start(new[] { "12", "" });
|
_program.Start(new[] { "12", "" });
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
Mocker.GetMock<UpdateProvider>().Verify(c => c.Start(ProcessPath), Times.Once());
|
Mocker.GetMock<UpdateProvider>().Verify(c => c.Start(@"C:\NzbDrone"), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
<RootNamespace>NzbDrone.Update</RootNamespace>
|
<RootNamespace>NzbDrone.Update</RootNamespace>
|
||||||
<AssemblyName>NzbDrone.Update</AssemblyName>
|
<AssemblyName>NzbDrone.Update</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
<TargetFrameworkProfile>
|
||||||
|
</TargetFrameworkProfile>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||||
@ -49,6 +50,7 @@
|
|||||||
<Compile Include="Providers\UpdateProvider.cs" />
|
<Compile Include="Providers\UpdateProvider.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
@ -52,7 +53,8 @@ namespace NzbDrone.Update
|
|||||||
VerfityArguments(args);
|
VerfityArguments(args);
|
||||||
int processId = ParseProcessId(args);
|
int processId = ParseProcessId(args);
|
||||||
|
|
||||||
string appPath = _processProvider.GetProcessById(processId).StartPath;
|
FileInfo exeFileInfo = new FileInfo(_processProvider.GetProcessById(processId).StartPath);
|
||||||
|
string appPath = exeFileInfo.Directory.FullName;
|
||||||
|
|
||||||
logger.Info("Starting update process");
|
logger.Info("Starting update process");
|
||||||
_updateProvider.Start(appPath);
|
_updateProvider.Start(appPath);
|
||||||
|
@ -12,5 +12,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.6.0.*")]
|
[assembly: AssemblyVersion("0.0.0.*")]
|
||||||
[assembly: AssemblyFileVersion("0.6.0.*")]
|
[assembly: AssemblyFileVersion("0.0.0.*")]
|
3
NzbDrone.Update/app.config
Normal file
3
NzbDrone.Update/app.config
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration>
|
||||||
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
@ -56,12 +56,13 @@ namespace NzbDrone.Web
|
|||||||
|
|
||||||
protected override IKernel CreateKernel()
|
protected override IKernel CreateKernel()
|
||||||
{
|
{
|
||||||
|
LogManager.Configuration = new XmlLoggingConfiguration(new EnviromentProvider().GetNlogConfigPath(), false);
|
||||||
|
|
||||||
Common.LogConfiguration.RegisterUdpLogger();
|
Common.LogConfiguration.RegisterUdpLogger();
|
||||||
Common.LogConfiguration.RegisterExceptioneer();
|
Common.LogConfiguration.RegisterExceptioneer();
|
||||||
Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Web.MvcApplication");
|
Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Web.MvcApplication");
|
||||||
Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch");
|
Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch");
|
||||||
|
|
||||||
LogManager.Configuration = new XmlLoggingConfiguration(new EnviromentProvider().GetNlogConfigPath(), false);
|
|
||||||
|
|
||||||
var dispatch = new CentralDispatch();
|
var dispatch = new CentralDispatch();
|
||||||
Logger.Info("NzbDrone Starting up.");
|
Logger.Info("NzbDrone Starting up.");
|
||||||
|
@ -9,5 +9,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.6.0.*")]
|
[assembly: AssemblyVersion("0.0.0.*")]
|
||||||
[assembly: AssemblyFileVersion("0.6.0.*")]
|
[assembly: AssemblyFileVersion("0.0.0.*")]
|
@ -11,5 +11,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.6.0.*")]
|
[assembly: AssemblyVersion("0.0.0.*")]
|
||||||
[assembly: AssemblyFileVersion("0.6.0.*")]
|
[assembly: AssemblyFileVersion("0.0.0.*")]
|
@ -53,9 +53,9 @@ namespace NzbDrone.Providers
|
|||||||
startInfo.RedirectStandardError = true;
|
startInfo.RedirectStandardError = true;
|
||||||
startInfo.CreateNoWindow = true;
|
startInfo.CreateNoWindow = true;
|
||||||
|
|
||||||
//Set Variables for the config file.
|
|
||||||
startInfo.EnvironmentVariables.Add("NZBDRONE_PATH", _enviromentProvider.ApplicationPath);
|
startInfo.EnvironmentVariables[EnviromentProvider.NZBDRONE_PATH] = _enviromentProvider.ApplicationPath;
|
||||||
startInfo.EnvironmentVariables.Add("NZBDRONE_PID", Process.GetCurrentProcess().Id.ToString());
|
startInfo.EnvironmentVariables[EnviromentProvider.NZBDRONE_PID] = Process.GetCurrentProcess().Id.ToString();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -117,7 +117,7 @@ namespace NzbDrone.Providers
|
|||||||
}.Submit();
|
}.Submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.FatalException("EPIC FAIL: {0}", excepion);
|
Logger.FatalException("EPIC FAIL: " + excepion.Message, excepion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,10 +4,12 @@ SET TARGET=%PACKAGEROOT%\NzbDrone
|
|||||||
rd %TARGET% /S /Q
|
rd %TARGET% /S /Q
|
||||||
del nzbdrone*.zip /Q /F
|
del nzbdrone*.zip /Q /F
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
xcopy IISExpress %TARGET%\IISExpress /E /V /I /Y
|
xcopy IISExpress %TARGET%\IISExpress /E /V /I /Y
|
||||||
xcopy NzbDrone\bin\Release\*.* %TARGET%\ /E /V /I /Y
|
xcopy NzbDrone\bin\Release\*.* %TARGET%\ /E /V /I /Y
|
||||||
|
|
||||||
|
xcopy NzbDrone.Update\bin\Release\*.* %TARGET%\NzbDrone.Update\ /E /V /I /Y
|
||||||
|
|
||||||
xcopy NzbDrone.Web\bin\*.* %TARGET%\NzbDrone.Web\bin\ /E /V /I /Y
|
xcopy NzbDrone.Web\bin\*.* %TARGET%\NzbDrone.Web\bin\ /E /V /I /Y
|
||||||
xcopy NzbDrone.Web\App_GlobalResources\*.* %TARGET%\NzbDrone.Web\App_GlobalResources\ /E /V /I /Y
|
xcopy NzbDrone.Web\App_GlobalResources\*.* %TARGET%\NzbDrone.Web\App_GlobalResources\ /E /V /I /Y
|
||||||
@ -15,7 +17,8 @@ xcopy NzbDrone.Web\Content\*.* %TARGET%\NzbDrone.Web\Content\ /E /V /I /Y
|
|||||||
xcopy NzbDrone.Web\Scripts\*.* %TARGET%\NzbDrone.Web\Scripts\ /E /V /I /Y
|
xcopy NzbDrone.Web\Scripts\*.* %TARGET%\NzbDrone.Web\Scripts\ /E /V /I /Y
|
||||||
xcopy NzbDrone.Web\Views\*.* %TARGET%\NzbDrone.Web\Views\ /E /V /I /Y
|
xcopy NzbDrone.Web\Views\*.* %TARGET%\NzbDrone.Web\Views\ /E /V /I /Y
|
||||||
|
|
||||||
del %TARGET%\NzbDrone.Web\bin\*.xml /q
|
del %TARGET%\NzbDrone.Web\bin\*.xml /Q /F
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
xcopy NzbDrone.Web\log.config %TARGET%\NzbDrone.Web\
|
xcopy NzbDrone.Web\log.config %TARGET%\NzbDrone.Web\
|
||||||
@ -27,6 +30,8 @@ xcopy NzbDrone.Web\web.config %TARGET%\NzbDrone.Web\
|
|||||||
CD %PACKAGEROOT%
|
CD %PACKAGEROOT%
|
||||||
|
|
||||||
del nlog.xml /Q /F /S
|
del nlog.xml /Q /F /S
|
||||||
|
del nlog.pdb /Q /F /S
|
||||||
|
del Twitterizer2.pdb /Q /F /S
|
||||||
del *.vshost.exe.* /Q /F /S
|
del *.vshost.exe.* /Q /F /S
|
||||||
del ninject*.pdb /Q /F /S
|
del ninject*.pdb /Q /F /S
|
||||||
del ninject*.xml /Q /F /S
|
del ninject*.xml /Q /F /S
|
||||||
|
Loading…
x
Reference in New Issue
Block a user