diff --git a/.gitignore b/.gitignore index 11bfc37d5..31ea5068e 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,5 @@ NzbDrone.Web/NzbDrone.Web.Publish.xml *.orig _rawPackage/ NzbDrone.zip -NzbDrone.sln.DotSettings.user* \ No newline at end of file +NzbDrone.sln.DotSettings.user* +config.xml \ No newline at end of file diff --git a/NzbDrone.Common/LogConfiguration.cs b/NzbDrone.Common/LogConfiguration.cs index a5e32f16f..c4740a4cf 100644 --- a/NzbDrone.Common/LogConfiguration.cs +++ b/NzbDrone.Common/LogConfiguration.cs @@ -50,12 +50,18 @@ namespace NzbDrone.Common { try { - var udpTarget = new ChainsawTarget(); + var udpTarget = new NLogViewerTarget(); udpTarget.Address = "udp://127.0.0.1:20480"; udpTarget.IncludeCallSite = true; udpTarget.IncludeSourceInfo = true; udpTarget.IncludeNLogData = true; udpTarget.IncludeNdc = true; + udpTarget.Parameters.Add(new NLogViewerParameterInfo + { + Name = "Exception", + Layout = "${exception:format=ToString}" + }); + LogManager.Configuration.AddTarget(udpTarget.GetType().Name, udpTarget); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, udpTarget)); diff --git a/NzbDrone.Common/Properties/AssemblyInfo.cs b/NzbDrone.Common/Properties/AssemblyInfo.cs index 09cbe12f1..56062366d 100644 --- a/NzbDrone.Common/Properties/AssemblyInfo.cs +++ b/NzbDrone.Common/Properties/AssemblyInfo.cs @@ -12,5 +12,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.6.0.*")] -[assembly: AssemblyFileVersion("0.6.0.*")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.*")] +[assembly: AssemblyFileVersion("0.0.0.*")] \ No newline at end of file diff --git a/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/PreformUpdateFixture.cs b/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/PreformUpdateFixture.cs index 9e23e3c29..d2a9d7932 100644 --- a/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/PreformUpdateFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/PreformUpdateFixture.cs @@ -35,6 +35,29 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests } + [Test] + public void should_delete_sandbox_before_update_if_folder_exists() + { + Mocker.GetMock().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(true); + + //Act + Mocker.Resolve().StartUpgrade(updatePackage); + + //Assert + Mocker.GetMock().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true)); + } + + [Test] + public void should_not_delete_sandbox_before_update_if_folder_doesnt_exists() + { + Mocker.GetMock().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(false); + + //Act + Mocker.Resolve().StartUpgrade(updatePackage); + + //Assert + Mocker.GetMock().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never()); + } [Test] public void Should_download_update_package() diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index 6195b784d..3e12ff1c9 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -91,6 +91,7 @@ namespace NzbDrone.Core Kernel.Bind().To().InSingletonScope(); Kernel.Bind().To().InSingletonScope(); Kernel.Bind().To().InSingletonScope(); + Kernel.Bind().To().InSingletonScope(); Kernel.Get().Initialize(); Kernel.Get().StartTimer(30); diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 0704a0304..82ee618e9 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -217,6 +217,7 @@ + diff --git a/NzbDrone.Core/Properties/AssemblyInfo.cs b/NzbDrone.Core/Properties/AssemblyInfo.cs index 22129d044..0647faa1b 100644 --- a/NzbDrone.Core/Properties/AssemblyInfo.cs +++ b/NzbDrone.Core/Properties/AssemblyInfo.cs @@ -16,5 +16,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.6.0.*")] -[assembly: AssemblyFileVersion("0.6.0.*")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.*")] +[assembly: AssemblyFileVersion("0.0.0.*")] \ No newline at end of file diff --git a/NzbDrone.Core/Providers/Jobs/AppUpdateJob.cs b/NzbDrone.Core/Providers/Jobs/AppUpdateJob.cs new file mode 100644 index 000000000..58ff10345 --- /dev/null +++ b/NzbDrone.Core/Providers/Jobs/AppUpdateJob.cs @@ -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.StartUpgrade(updatePackage); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/UpdateProvider.cs b/NzbDrone.Core/Providers/UpdateProvider.cs index f2d6b66a0..454600020 100644 --- a/NzbDrone.Core/Providers/UpdateProvider.cs +++ b/NzbDrone.Core/Providers/UpdateProvider.cs @@ -13,7 +13,7 @@ using NzbDrone.Core.Providers.Core; namespace NzbDrone.Core.Providers { - class UpdateProvider + public class UpdateProvider { private readonly HttpProvider _httpProvider; private readonly ConfigProvider _configProvider; @@ -82,6 +82,12 @@ namespace NzbDrone.Core.Providers { 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); _httpProvider.DownloadFile(updatePackage.Url, packageDestination); logger.Info("Download completed for update package from [{0}]", updatePackage.FileName); diff --git a/NzbDrone.Update/Properties/AssemblyInfo.cs b/NzbDrone.Update/Properties/AssemblyInfo.cs index 5ab9d9465..0c2c44382 100644 --- a/NzbDrone.Update/Properties/AssemblyInfo.cs +++ b/NzbDrone.Update/Properties/AssemblyInfo.cs @@ -12,5 +12,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.6.0.*")] -[assembly: AssemblyFileVersion("0.6.0.*")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.*")] +[assembly: AssemblyFileVersion("0.0.0.*")] \ No newline at end of file diff --git a/NzbDrone.Web/Global.asax.cs b/NzbDrone.Web/Global.asax.cs index 407d03145..35509a499 100644 --- a/NzbDrone.Web/Global.asax.cs +++ b/NzbDrone.Web/Global.asax.cs @@ -56,12 +56,13 @@ namespace NzbDrone.Web protected override IKernel CreateKernel() { + LogManager.Configuration = new XmlLoggingConfiguration(new EnviromentProvider().GetNlogConfigPath(), false); + Common.LogConfiguration.RegisterUdpLogger(); Common.LogConfiguration.RegisterExceptioneer(); Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Web.MvcApplication"); Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch"); - - LogManager.Configuration = new XmlLoggingConfiguration(new EnviromentProvider().GetNlogConfigPath(), false); + var dispatch = new CentralDispatch(); Logger.Info("NzbDrone Starting up."); diff --git a/NzbDrone.Web/Properties/AssemblyInfo.cs b/NzbDrone.Web/Properties/AssemblyInfo.cs index 3eccefe42..eca7b7623 100644 --- a/NzbDrone.Web/Properties/AssemblyInfo.cs +++ b/NzbDrone.Web/Properties/AssemblyInfo.cs @@ -9,5 +9,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.6.0.*")] -[assembly: AssemblyFileVersion("0.6.0.*")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.*")] +[assembly: AssemblyFileVersion("0.0.0.*")] \ No newline at end of file diff --git a/NzbDrone/Properties/AssemblyInfo.cs b/NzbDrone/Properties/AssemblyInfo.cs index af21a197e..4cb98db28 100644 --- a/NzbDrone/Properties/AssemblyInfo.cs +++ b/NzbDrone/Properties/AssemblyInfo.cs @@ -11,5 +11,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.6.0.*")] -[assembly: AssemblyFileVersion("0.6.0.*")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.*")] +[assembly: AssemblyFileVersion("0.0.0.*")] \ No newline at end of file