mirror of https://github.com/Radarr/Radarr
Update updates ;)
This commit is contained in:
parent
88f4d15fa9
commit
6369d4f817
|
@ -40,4 +40,5 @@ NzbDrone.Web/NzbDrone.Web.Publish.xml
|
|||
*.orig
|
||||
_rawPackage/
|
||||
NzbDrone.zip
|
||||
NzbDrone.sln.DotSettings.user*
|
||||
NzbDrone.sln.DotSettings.user*
|
||||
config.xml
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.*")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.*")]
|
|
@ -35,6 +35,29 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|||
}
|
||||
|
||||
|
||||
[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>().StartUpgrade(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>().StartUpgrade(updatePackage);
|
||||
|
||||
//Assert
|
||||
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Should_download_update_package()
|
||||
|
|
|
@ -91,6 +91,7 @@ namespace NzbDrone.Core
|
|||
Kernel.Bind<IJob>().To<BacklogSearchJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<BannerDownloadJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<ConvertEpisodeJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<AppUpdateJob>().InSingletonScope();
|
||||
|
||||
Kernel.Get<JobProvider>().Initialize();
|
||||
Kernel.Get<WebTimer>().StartTimer(30);
|
||||
|
|
|
@ -217,6 +217,7 @@
|
|||
<Compile Include="Providers\Converting\AtomicParsleyProvider.cs" />
|
||||
<Compile Include="Providers\Converting\HandbrakeProvider.cs" />
|
||||
<Compile Include="Providers\ExternalNotification\Prowl.cs" />
|
||||
<Compile Include="Providers\Jobs\AppUpdateJob.cs" />
|
||||
<Compile Include="Providers\ProwlProvider.cs" />
|
||||
<Compile Include="Providers\Core\UdpProvider.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
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("0.6.0.*")]
|
||||
[assembly: AssemblyFileVersion("0.6.0.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.*")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.*")]
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.*")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.*")]
|
|
@ -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.");
|
||||
|
|
|
@ -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.*")]
|
||||
[assembly: AssemblyVersion("0.0.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
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("0.6.0.*")]
|
||||
[assembly: AssemblyFileVersion("0.6.0.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.*")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.*")]
|
Loading…
Reference in New Issue