mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-24 08:42:19 +02:00
Fixed spelling of enviroment provider (Environment). :)
This commit is contained in:
parent
5764059f1d
commit
a00c20c1af
@ -51,7 +51,7 @@ public void Route_should_call_install_service_when_application_mode_is_install()
|
||||
serviceProviderMock.Setup(c => c.Install(ServiceProvider.NZBDRONE_SERVICE_NAME));
|
||||
serviceProviderMock.Setup(c => c.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME)).Returns(false);
|
||||
serviceProviderMock.Setup(c => c.Start(ServiceProvider.NZBDRONE_SERVICE_NAME));
|
||||
Mocker.GetMock<EnviromentProvider>().SetupGet(c => c.IsUserInteractive).Returns(true);
|
||||
Mocker.GetMock<EnvironmentProvider>().SetupGet(c => c.IsUserInteractive).Returns(true);
|
||||
|
||||
Mocker.Resolve<Router>().Route(ApplicationMode.InstallService);
|
||||
|
||||
@ -64,7 +64,7 @@ public void Route_should_call_uninstall_service_when_application_mode_is_uninsta
|
||||
{
|
||||
var serviceProviderMock = Mocker.GetMock<ServiceProvider>();
|
||||
serviceProviderMock.Setup(c => c.UnInstall(ServiceProvider.NZBDRONE_SERVICE_NAME));
|
||||
Mocker.GetMock<EnviromentProvider>().SetupGet(c => c.IsUserInteractive).Returns(true);
|
||||
Mocker.GetMock<EnvironmentProvider>().SetupGet(c => c.IsUserInteractive).Returns(true);
|
||||
serviceProviderMock.Setup(c => c.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME)).Returns(true);
|
||||
|
||||
Mocker.Resolve<Router>().Route(ApplicationMode.UninstallService);
|
||||
@ -79,7 +79,7 @@ public void Route_should_call_console_service_when_application_mode_is_console()
|
||||
var appServerProvider = Mocker.GetMock<ApplicationServer>();
|
||||
consoleProvider.Setup(c => c.WaitForClose());
|
||||
appServerProvider.Setup(c => c.Start());
|
||||
Mocker.GetMock<EnviromentProvider>().SetupGet(c => c.IsUserInteractive).Returns(true);
|
||||
Mocker.GetMock<EnvironmentProvider>().SetupGet(c => c.IsUserInteractive).Returns(true);
|
||||
|
||||
Mocker.Resolve<Router>().Route(ApplicationMode.Console);
|
||||
|
||||
@ -93,7 +93,7 @@ public void Route_should_call_console_service_when_application_mode_is_console()
|
||||
[TestCase(ApplicationMode.Help)]
|
||||
public void Route_should_call_service_start_when_run_in_service_more(ApplicationMode applicationMode)
|
||||
{
|
||||
var envMock = Mocker.GetMock<EnviromentProvider>();
|
||||
var envMock = Mocker.GetMock<EnvironmentProvider>();
|
||||
var serviceProvider = Mocker.GetMock<ServiceProvider>();
|
||||
|
||||
envMock.SetupGet(c => c.IsUserInteractive).Returns(false);
|
||||
@ -111,7 +111,7 @@ public void show_error_on_install_if_service_already_exist()
|
||||
{
|
||||
var consoleMock = Mocker.GetMock<ConsoleProvider>();
|
||||
var serviceMock = Mocker.GetMock<ServiceProvider>();
|
||||
Mocker.GetMock<EnviromentProvider>().SetupGet(c => c.IsUserInteractive).Returns(true);
|
||||
Mocker.GetMock<EnvironmentProvider>().SetupGet(c => c.IsUserInteractive).Returns(true);
|
||||
|
||||
consoleMock.Setup(c => c.PrintServiceAlreadyExist());
|
||||
serviceMock.Setup(c => c.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME)).Returns(true);
|
||||
@ -126,7 +126,7 @@ public void show_error_on_uninstall_if_service_doesnt_exist()
|
||||
{
|
||||
var consoleMock = Mocker.GetMock<ConsoleProvider>();
|
||||
var serviceMock = Mocker.GetMock<ServiceProvider>();
|
||||
Mocker.GetMock<EnviromentProvider>().SetupGet(c => c.IsUserInteractive).Returns(true);
|
||||
Mocker.GetMock<EnvironmentProvider>().SetupGet(c => c.IsUserInteractive).Returns(true);
|
||||
|
||||
consoleMock.Setup(c => c.PrintServiceDoestExist());
|
||||
serviceMock.Setup(c => c.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME)).Returns(false);
|
||||
|
@ -19,7 +19,7 @@ public void SetUp()
|
||||
WithTempAsAppPath();
|
||||
|
||||
//Reset config file
|
||||
var configFile = Mocker.Resolve<EnviromentProvider>().GetConfigPath();
|
||||
var configFile = Mocker.Resolve<EnvironmentProvider>().GetConfigPath();
|
||||
|
||||
if (File.Exists(configFile))
|
||||
File.Delete(configFile);
|
||||
|
@ -162,7 +162,7 @@ public void empty_folder_should_return_folder_modified_date()
|
||||
[Test]
|
||||
public void folder_should_return_correct_value_for_last_write()
|
||||
{
|
||||
var appPath = new EnviromentProvider().ApplicationPath;
|
||||
var appPath = new EnvironmentProvider().ApplicationPath;
|
||||
Mocker.Resolve<DiskProvider>().GetLastDirectoryWrite(appPath).Should().BeOnOrAfter(DateTime.UtcNow.AddMinutes(-10));
|
||||
Mocker.Resolve<DiskProvider>().GetLastDirectoryWrite(appPath).Should().BeBefore(DateTime.UtcNow);
|
||||
}
|
||||
|
@ -11,61 +11,61 @@ namespace NzbDrone.Common.Test
|
||||
[TestFixture]
|
||||
public class EnviromentProviderTest : TestBase
|
||||
{
|
||||
readonly EnviromentProvider enviromentProvider = new EnviromentProvider();
|
||||
readonly EnvironmentProvider environmentProvider = new EnvironmentProvider();
|
||||
|
||||
[Test]
|
||||
public void StartupPath_should_not_be_empty()
|
||||
{
|
||||
enviromentProvider.StartUpPath.Should().NotBeBlank();
|
||||
Path.IsPathRooted(enviromentProvider.StartUpPath).Should().BeTrue("Path is not rooted");
|
||||
environmentProvider.StartUpPath.Should().NotBeBlank();
|
||||
Path.IsPathRooted(environmentProvider.StartUpPath).Should().BeTrue("Path is not rooted");
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ApplicationPath_should_not_be_empty()
|
||||
{
|
||||
enviromentProvider.ApplicationPath.Should().NotBeBlank();
|
||||
Path.IsPathRooted(enviromentProvider.ApplicationPath).Should().BeTrue("Path is not rooted");
|
||||
environmentProvider.ApplicationPath.Should().NotBeBlank();
|
||||
Path.IsPathRooted(environmentProvider.ApplicationPath).Should().BeTrue("Path is not rooted");
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void ApplicationPath_should_find_root_in_current_folder()
|
||||
{
|
||||
Directory.CreateDirectory(EnviromentProvider.ROOT_MARKER);
|
||||
enviromentProvider.ApplicationPath.Should().BeEquivalentTo(Directory.GetCurrentDirectory());
|
||||
Directory.CreateDirectory(EnvironmentProvider.ROOT_MARKER);
|
||||
environmentProvider.ApplicationPath.Should().BeEquivalentTo(Directory.GetCurrentDirectory());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void crawl_should_return_null_if_cant_find_root()
|
||||
{
|
||||
enviromentProvider.CrawlToRoot("C:\\").Should().BeNullOrEmpty();
|
||||
environmentProvider.CrawlToRoot("C:\\").Should().BeNullOrEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_go_up_the_tree_to_find_iis()
|
||||
{
|
||||
enviromentProvider.ApplicationPath.Should().NotBe(Environment.CurrentDirectory);
|
||||
enviromentProvider.ApplicationPath.Should().NotBe(enviromentProvider.StartUpPath);
|
||||
environmentProvider.ApplicationPath.Should().NotBe(Environment.CurrentDirectory);
|
||||
environmentProvider.ApplicationPath.Should().NotBe(environmentProvider.StartUpPath);
|
||||
}
|
||||
[Test]
|
||||
public void IsProduction_should_return_false_when_run_within_nunit()
|
||||
{
|
||||
EnviromentProvider.IsProduction.Should().BeFalse();
|
||||
EnvironmentProvider.IsProduction.Should().BeFalse();
|
||||
}
|
||||
|
||||
[TestCase("0.0.0.0")]
|
||||
[TestCase("1.0.0.0")]
|
||||
public void Application_version_should_not_be_default(string version)
|
||||
{
|
||||
enviromentProvider.Version.Should().NotBe(new Version(version));
|
||||
environmentProvider.Version.Should().NotBe(new Version(version));
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
if (Directory.Exists(EnviromentProvider.ROOT_MARKER))
|
||||
Directory.Delete(EnviromentProvider.ROOT_MARKER);
|
||||
if (Directory.Exists(EnvironmentProvider.ROOT_MARKER))
|
||||
Directory.Delete(EnvironmentProvider.ROOT_MARKER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ namespace NzbDrone.Common.Test
|
||||
public class PathExtentionFixture : TestBase
|
||||
{
|
||||
|
||||
private EnviromentProvider GetEnviromentProvider()
|
||||
private EnvironmentProvider GetEnviromentProvider()
|
||||
{
|
||||
var envMoq = new Mock<EnviromentProvider>();
|
||||
var envMoq = new Mock<EnvironmentProvider>();
|
||||
|
||||
envMoq.SetupGet(c => c.ApplicationPath).Returns(@"C:\NzbDrone\");
|
||||
|
||||
|
@ -68,7 +68,7 @@ public void report_parse_error_should_send_multiple_reports_if_titles_are_diffre
|
||||
[Test]
|
||||
public void report_parse_error()
|
||||
{
|
||||
ReportingService.RestProvider = new RestProvider(new EnviromentProvider());
|
||||
ReportingService.RestProvider = new RestProvider(new EnvironmentProvider());
|
||||
ReportingService.ReportParseError("Test error");
|
||||
|
||||
}
|
||||
|
@ -11,16 +11,16 @@ namespace NzbDrone.Common
|
||||
{
|
||||
public class ConfigFileProvider
|
||||
{
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly string _configFile;
|
||||
|
||||
[Inject]
|
||||
public ConfigFileProvider(EnviromentProvider enviromentProvider)
|
||||
public ConfigFileProvider(EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_configFile = _enviromentProvider.GetConfigPath();
|
||||
_environmentProvider = environmentProvider;
|
||||
_configFile = _environmentProvider.GetConfigPath();
|
||||
|
||||
CreateDefaultConfigFile();
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
namespace NzbDrone.Common
|
||||
{
|
||||
public class EnviromentProvider
|
||||
public class EnvironmentProvider
|
||||
{
|
||||
public const string NZBDRONE_PATH = "NZBDRONE_PATH";
|
||||
public const string NZBDRONE_PID = "NZBDRONE_PID";
|
||||
@ -13,7 +13,7 @@ public class EnviromentProvider
|
||||
|
||||
private static readonly string processName = Process.GetCurrentProcess().ProcessName.ToLower();
|
||||
|
||||
private static readonly EnviromentProvider instance = new EnviromentProvider();
|
||||
private static readonly EnvironmentProvider instance = new EnvironmentProvider();
|
||||
|
||||
public static bool IsProduction
|
||||
{
|
@ -12,15 +12,15 @@ public class IISProvider
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly ConfigFileProvider _configFileProvider;
|
||||
private readonly ProcessProvider _processProvider;
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
|
||||
|
||||
[Inject]
|
||||
public IISProvider(ConfigFileProvider configFileProvider, ProcessProvider processProvider, EnviromentProvider enviromentProvider)
|
||||
public IISProvider(ConfigFileProvider configFileProvider, ProcessProvider processProvider, EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_configFileProvider = configFileProvider;
|
||||
_processProvider = processProvider;
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
}
|
||||
|
||||
public IISProvider()
|
||||
@ -42,9 +42,9 @@ public void StartServer()
|
||||
|
||||
var startInfo = new ProcessStartInfo();
|
||||
|
||||
startInfo.FileName = _enviromentProvider.GetIISExe();
|
||||
startInfo.Arguments = String.Format("/config:\"{0}\" /trace:i", _enviromentProvider.GetIISConfigPath());
|
||||
startInfo.WorkingDirectory = _enviromentProvider.ApplicationPath;
|
||||
startInfo.FileName = _environmentProvider.GetIISExe();
|
||||
startInfo.Arguments = String.Format("/config:\"{0}\" /trace:i", _environmentProvider.GetIISConfigPath());
|
||||
startInfo.WorkingDirectory = _environmentProvider.ApplicationPath;
|
||||
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
@ -52,12 +52,12 @@ public void StartServer()
|
||||
startInfo.CreateNoWindow = true;
|
||||
|
||||
|
||||
startInfo.EnvironmentVariables[EnviromentProvider.NZBDRONE_PATH] = _enviromentProvider.ApplicationPath;
|
||||
startInfo.EnvironmentVariables[EnviromentProvider.NZBDRONE_PID] = Process.GetCurrentProcess().Id.ToString();
|
||||
startInfo.EnvironmentVariables[EnvironmentProvider.NZBDRONE_PATH] = _environmentProvider.ApplicationPath;
|
||||
startInfo.EnvironmentVariables[EnvironmentProvider.NZBDRONE_PID] = Process.GetCurrentProcess().Id.ToString();
|
||||
|
||||
try
|
||||
{
|
||||
_configFileProvider.UpdateIISConfig(_enviromentProvider.GetIISConfigPath());
|
||||
_configFileProvider.UpdateIISConfig(_environmentProvider.GetIISConfigPath());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -102,7 +102,7 @@ public virtual void StopServer()
|
||||
foreach (var process in _processProvider.GetProcessByName("IISExpress"))
|
||||
{
|
||||
Logger.Info("[{0}]IIS Process found. Path:{1}", process.Id, process.StartPath);
|
||||
if (DiskProvider.PathEquals(process.StartPath, _enviromentProvider.GetIISExe()))
|
||||
if (DiskProvider.PathEquals(process.StartPath, _environmentProvider.GetIISExe()))
|
||||
{
|
||||
Logger.Info("[{0}]Process is considered orphaned.", process.Id);
|
||||
_processProvider.Kill(process.Id);
|
||||
|
@ -10,7 +10,7 @@ public static class LogConfiguration
|
||||
{
|
||||
static LogConfiguration()
|
||||
{
|
||||
if (EnviromentProvider.IsProduction)
|
||||
if (EnvironmentProvider.IsProduction)
|
||||
{
|
||||
LogManager.ThrowExceptions = false;
|
||||
}
|
||||
|
@ -11,11 +11,11 @@ public class ExceptioneerTarget : Target
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private static readonly Version version = new EnviromentProvider().Version;
|
||||
private static readonly Version version = new EnvironmentProvider().Version;
|
||||
|
||||
protected override void Write(LogEventInfo logEvent)
|
||||
{
|
||||
if (logEvent == null || logEvent.Exception == null || !EnviromentProvider.IsProduction) return;
|
||||
if (logEvent == null || logEvent.Exception == null || !EnvironmentProvider.IsProduction) return;
|
||||
|
||||
Logger.Trace("Sending Exception to Exceptioneer. Process Name: {0}", Process.GetCurrentProcess().ProcessName);
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
||||
<Compile Include="Model\AuthenticationType.cs" />
|
||||
<Compile Include="PathExtentions.cs" />
|
||||
<Compile Include="DiskProvider.cs" />
|
||||
<Compile Include="EnviromentProvider.cs" />
|
||||
<Compile Include="EnvironmentProvider.cs" />
|
||||
<Compile Include="NlogTargets\ExceptioneerTarget.cs" />
|
||||
<Compile Include="LogConfiguration.cs" />
|
||||
<Compile Include="Model\ProcessInfo.cs" />
|
||||
|
@ -42,119 +42,119 @@ public static string NormalizePath(this string path)
|
||||
}
|
||||
|
||||
|
||||
public static string GetIISFolder(this EnviromentProvider enviromentProvider)
|
||||
public static string GetIISFolder(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.ApplicationPath, IIS_FOLDER);
|
||||
return Path.Combine(environmentProvider.ApplicationPath, IIS_FOLDER);
|
||||
}
|
||||
|
||||
public static string GetIISExe(this EnviromentProvider enviromentProvider)
|
||||
public static string GetIISExe(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetIISFolder(), IIS_EXE);
|
||||
return Path.Combine(environmentProvider.GetIISFolder(), IIS_EXE);
|
||||
}
|
||||
|
||||
public static string GetIISConfigPath(this EnviromentProvider enviromentProvider)
|
||||
public static string GetIISConfigPath(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetIISFolder(), "AppServer", "applicationhost.config");
|
||||
return Path.Combine(environmentProvider.GetIISFolder(), "AppServer", "applicationhost.config");
|
||||
}
|
||||
|
||||
public static string GetWebRoot(this EnviromentProvider enviromentProvider)
|
||||
public static string GetWebRoot(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.ApplicationPath, WEB_FOLDER);
|
||||
return Path.Combine(environmentProvider.ApplicationPath, WEB_FOLDER);
|
||||
}
|
||||
|
||||
public static string GetAppDataPath(this EnviromentProvider enviromentProvider)
|
||||
public static string GetAppDataPath(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetWebRoot(), APP_DATA);
|
||||
return Path.Combine(environmentProvider.GetWebRoot(), APP_DATA);
|
||||
}
|
||||
|
||||
public static string GetNlogConfigPath(this EnviromentProvider enviromentProvider)
|
||||
public static string GetNlogConfigPath(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetWebRoot(), LOG_CONFIG_FILE);
|
||||
return Path.Combine(environmentProvider.GetWebRoot(), LOG_CONFIG_FILE);
|
||||
}
|
||||
|
||||
public static string GetConfigPath(this EnviromentProvider enviromentProvider)
|
||||
public static string GetConfigPath(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.ApplicationPath, APP_CONFIG_FILE);
|
||||
return Path.Combine(environmentProvider.ApplicationPath, APP_CONFIG_FILE);
|
||||
}
|
||||
|
||||
public static string GetNzbDronoeDbFile(this EnviromentProvider enviromentProvider)
|
||||
public static string GetNzbDronoeDbFile(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetAppDataPath(), NZBDRONE_DB_FILE);
|
||||
return Path.Combine(environmentProvider.GetAppDataPath(), NZBDRONE_DB_FILE);
|
||||
}
|
||||
|
||||
public static string GetLogDbFileDbFile(this EnviromentProvider enviromentProvider)
|
||||
public static string GetLogDbFileDbFile(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetAppDataPath(), LOG_DB_FILE);
|
||||
return Path.Combine(environmentProvider.GetAppDataPath(), LOG_DB_FILE);
|
||||
}
|
||||
|
||||
public static string GetMediaCoverPath(this EnviromentProvider enviromentProvider)
|
||||
public static string GetMediaCoverPath(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetWebRoot(), "MediaCover");
|
||||
return Path.Combine(environmentProvider.GetWebRoot(), "MediaCover");
|
||||
}
|
||||
|
||||
public static string GetBannerPath(this EnviromentProvider enviromentProvider)
|
||||
public static string GetBannerPath(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetMediaCoverPath(), "Banners");
|
||||
return Path.Combine(environmentProvider.GetMediaCoverPath(), "Banners");
|
||||
}
|
||||
|
||||
public static string GetFanArtPath(this EnviromentProvider enviromentProvider)
|
||||
public static string GetFanArtPath(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetMediaCoverPath(), "Fanarts");
|
||||
return Path.Combine(environmentProvider.GetMediaCoverPath(), "Fanarts");
|
||||
}
|
||||
|
||||
public static string GetCacheFolder(this EnviromentProvider enviromentProvider)
|
||||
public static string GetCacheFolder(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetWebRoot(), "Cache");
|
||||
return Path.Combine(environmentProvider.GetWebRoot(), "Cache");
|
||||
}
|
||||
|
||||
public static string GetUpdateLogFolder(this EnviromentProvider enviromentProvider)
|
||||
public static string GetUpdateLogFolder(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.ApplicationPath, UPDATE_LOG_FOLDER_NAME);
|
||||
return Path.Combine(environmentProvider.ApplicationPath, UPDATE_LOG_FOLDER_NAME);
|
||||
}
|
||||
|
||||
public static string GetUpdateSandboxFolder(this EnviromentProvider enviromentProvider)
|
||||
public static string GetUpdateSandboxFolder(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.SystemTemp, UPDATE_SANDBOX_FOLDER_NAME);
|
||||
return Path.Combine(environmentProvider.SystemTemp, UPDATE_SANDBOX_FOLDER_NAME);
|
||||
}
|
||||
|
||||
public static string GetUpdateBackUpFolder(this EnviromentProvider enviromentProvider)
|
||||
public static string GetUpdateBackUpFolder(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_BACKUP_FOLDER_NAME);
|
||||
return Path.Combine(environmentProvider.GetUpdateSandboxFolder(), UPDATE_BACKUP_FOLDER_NAME);
|
||||
}
|
||||
|
||||
public static string GetUpdatePackageFolder(this EnviromentProvider enviromentProvider)
|
||||
public static string GetUpdatePackageFolder(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_PACKAGE_FOLDER_NAME);
|
||||
return Path.Combine(environmentProvider.GetUpdateSandboxFolder(), UPDATE_PACKAGE_FOLDER_NAME);
|
||||
}
|
||||
|
||||
public static string GetUpdateClientFolder(this EnviromentProvider enviromentProvider)
|
||||
public static string GetUpdateClientFolder(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetUpdatePackageFolder(), UPDATE_CLIENT_FOLDER_NAME);
|
||||
return Path.Combine(environmentProvider.GetUpdatePackageFolder(), UPDATE_CLIENT_FOLDER_NAME);
|
||||
}
|
||||
|
||||
public static string GetUpdateClientExePath(this EnviromentProvider enviromentProvider)
|
||||
public static string GetUpdateClientExePath(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_CLIENT_EXE);
|
||||
return Path.Combine(environmentProvider.GetUpdateSandboxFolder(), UPDATE_CLIENT_EXE);
|
||||
}
|
||||
|
||||
public static string GetSandboxLogFolder(this EnviromentProvider enviromentProvider)
|
||||
public static string GetSandboxLogFolder(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_LOG_FOLDER_NAME);
|
||||
return Path.Combine(environmentProvider.GetUpdateSandboxFolder(), UPDATE_LOG_FOLDER_NAME);
|
||||
}
|
||||
|
||||
public static string GetLogFileName(this EnviromentProvider enviromentProvider)
|
||||
public static string GetLogFileName(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.ApplicationPath, "nzbdrone.log.txt");
|
||||
return Path.Combine(environmentProvider.ApplicationPath, "nzbdrone.log.txt");
|
||||
}
|
||||
|
||||
public static string GetArchivedLogFileName(this EnviromentProvider enviromentProvider)
|
||||
public static string GetArchivedLogFileName(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.ApplicationPath, "nzbdrone.log.0.txt");
|
||||
return Path.Combine(environmentProvider.ApplicationPath, "nzbdrone.log.0.txt");
|
||||
}
|
||||
|
||||
public static string GetConfigBackupFile(this EnviromentProvider enviromentProvider)
|
||||
public static string GetConfigBackupFile(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetAppDataPath(), BACKUP_ZIP_FILE);
|
||||
return Path.Combine(environmentProvider.GetAppDataPath(), BACKUP_ZIP_FILE);
|
||||
}
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ public static void ReportParseError(string title)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (!EnviromentProvider.IsProduction)
|
||||
if (!EnvironmentProvider.IsProduction)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
@ -70,7 +70,7 @@ public static void ReportException(LogEventInfo logEvent)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (!EnviromentProvider.IsProduction)
|
||||
if (!EnvironmentProvider.IsProduction)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
@ -84,10 +84,10 @@ private static void VerifyRestProvider()
|
||||
{
|
||||
if(RestProvider == null)
|
||||
{
|
||||
if(EnviromentProvider.IsProduction)
|
||||
if(EnvironmentProvider.IsProduction)
|
||||
{
|
||||
logger.Warn("Rest provider wasn't provided. creating new one!");
|
||||
RestProvider = new RestProvider(new EnviromentProvider());
|
||||
RestProvider = new RestProvider(new EnvironmentProvider());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -16,13 +16,13 @@ public class RestProvider
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
|
||||
|
||||
[Inject]
|
||||
public RestProvider(EnviromentProvider enviromentProvider)
|
||||
public RestProvider(EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
}
|
||||
|
||||
public RestProvider()
|
||||
@ -35,9 +35,9 @@ public RestProvider()
|
||||
|
||||
public virtual void PostData(string url, ReportBase reportBase)
|
||||
{
|
||||
reportBase.UGuid = EnviromentProvider.UGuid;
|
||||
reportBase.Version = _enviromentProvider.Version.ToString();
|
||||
reportBase.IsProduction = EnviromentProvider.IsProduction;
|
||||
reportBase.UGuid = EnvironmentProvider.UGuid;
|
||||
reportBase.Version = _environmentProvider.Version.ToString();
|
||||
reportBase.IsProduction = EnvironmentProvider.IsProduction;
|
||||
|
||||
PostData(url, reportBase as object);
|
||||
}
|
||||
|
@ -13,15 +13,15 @@ public class SecurityProvider
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly ConfigFileProvider _configFileProvider;
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private readonly ProcessProvider _processProvider;
|
||||
|
||||
[Inject]
|
||||
public SecurityProvider(ConfigFileProvider configFileProvider, EnviromentProvider enviromentProvider,
|
||||
public SecurityProvider(ConfigFileProvider configFileProvider, EnvironmentProvider environmentProvider,
|
||||
ProcessProvider processProvider)
|
||||
{
|
||||
_configFileProvider = configFileProvider;
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
_processProvider = processProvider;
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ public virtual void MakeAccessible()
|
||||
}
|
||||
|
||||
//Skip Url Register if not Vista or 7
|
||||
if (_enviromentProvider.GetOsVersion().Major < 6)
|
||||
if (_environmentProvider.GetOsVersion().Major < 6)
|
||||
return;
|
||||
|
||||
//Unregister Url (if port != 0)
|
||||
|
@ -106,7 +106,7 @@ public void JobProvider_should_be_singletone()
|
||||
public void app_should_be_marked_as_new_install_if_db_is_initilized_for_the_first_time()
|
||||
{
|
||||
WithRealDb();
|
||||
EnviromentProvider.RegisterNewInstall.Should().Be(true);
|
||||
EnvironmentProvider.RegisterNewInstall.Should().Be(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ static CoreTest()
|
||||
}
|
||||
|
||||
//Delete App_data folder
|
||||
var appData = new EnviromentProvider().GetAppDataPath();
|
||||
var appData = new EnvironmentProvider().GetAppDataPath();
|
||||
|
||||
if (Directory.Exists(appData))
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ public void should_be_able_to_get_daily_series_ids()
|
||||
[Test]
|
||||
public void should_be_able_to_submit_exceptions()
|
||||
{
|
||||
ReportingService.RestProvider = new RestProvider(new EnviromentProvider());
|
||||
ReportingService.RestProvider = new RestProvider(new EnvironmentProvider());
|
||||
|
||||
var log = new LogEventInfo();
|
||||
log.LoggerName = "LoggerName.LoggerName.LoggerName.LoggerName";
|
||||
|
@ -33,7 +33,7 @@ internal class AppUpdateJobFixture : CoreTest
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<EnviromentProvider>().SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\");
|
||||
Mocker.GetMock<EnvironmentProvider>().SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\");
|
||||
Mocker.GetMock<ConfigFileProvider>().SetupGet(c => c.Guid).Returns(_clientGuid);
|
||||
Mocker.GetMock<UpdateProvider>().Setup(c => c.GetAvilableUpdate(It.IsAny<Version>())).Returns(updatePackage);
|
||||
}
|
||||
@ -93,7 +93,7 @@ public void Should_extract_update_package()
|
||||
[Test]
|
||||
public void Should_copy_update_client_to_root_of_sandbox()
|
||||
{
|
||||
var updateClientFolder = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateClientFolder();
|
||||
var updateClientFolder = Mocker.GetMock<EnvironmentProvider>().Object.GetUpdateClientFolder();
|
||||
|
||||
//Act
|
||||
StartUpdate();
|
||||
@ -107,9 +107,9 @@ public void Should_copy_update_client_to_root_of_sandbox()
|
||||
public void should_start_update_client()
|
||||
{
|
||||
//Setup
|
||||
var updateClientPath = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateClientExePath();
|
||||
var updateClientPath = Mocker.GetMock<EnvironmentProvider>().Object.GetUpdateClientExePath();
|
||||
|
||||
Mocker.GetMock<EnviromentProvider>()
|
||||
Mocker.GetMock<EnvironmentProvider>()
|
||||
.SetupGet(c => c.NzbDroneProcessIdFromEnviroment).Returns(12);
|
||||
|
||||
//Act
|
||||
@ -138,9 +138,9 @@ public void when_no_updates_are_available_should_return_without_error_or_warning
|
||||
public void Should_download_and_extract_to_temp_folder()
|
||||
{
|
||||
|
||||
Mocker.GetMock<EnviromentProvider>().SetupGet(c => c.SystemTemp).Returns(TempFolder);
|
||||
Mocker.GetMock<EnvironmentProvider>().SetupGet(c => c.SystemTemp).Returns(TempFolder);
|
||||
|
||||
var updateSubFolder = new DirectoryInfo(Mocker.GetMock<EnviromentProvider>().Object.GetUpdateSandboxFolder());
|
||||
var updateSubFolder = new DirectoryInfo(Mocker.GetMock<EnvironmentProvider>().Object.GetUpdateSandboxFolder());
|
||||
|
||||
|
||||
//Act
|
||||
|
@ -53,7 +53,7 @@ public void checkpoint_should_not_stop_existing_if_not_started()
|
||||
[Test]
|
||||
public void new_install_should_be_registered()
|
||||
{
|
||||
EnviromentProvider.RegisterNewInstall = true;
|
||||
EnvironmentProvider.RegisterNewInstall = true;
|
||||
|
||||
var provider = Mocker.Resolve<AnalyticsProvider>();
|
||||
|
||||
@ -65,7 +65,7 @@ public void new_install_should_be_registered()
|
||||
[Test]
|
||||
public void new_install_should_only_be_registered_on_first_call()
|
||||
{
|
||||
EnviromentProvider.RegisterNewInstall = true;
|
||||
EnvironmentProvider.RegisterNewInstall = true;
|
||||
|
||||
var provider = Mocker.Resolve<AnalyticsProvider>();
|
||||
|
||||
@ -79,7 +79,7 @@ public void new_install_should_only_be_registered_on_first_call()
|
||||
[Test]
|
||||
public void upgrade_should_not_register_install()
|
||||
{
|
||||
EnviromentProvider.RegisterNewInstall = false;
|
||||
EnvironmentProvider.RegisterNewInstall = false;
|
||||
|
||||
var provider = Mocker.Resolve<AnalyticsProvider>();
|
||||
|
||||
@ -92,7 +92,7 @@ public void upgrade_should_not_register_install()
|
||||
[Test]
|
||||
public void shouldnt_register_anything_if_not_on_master_branch()
|
||||
{
|
||||
EnviromentProvider.RegisterNewInstall = false;
|
||||
EnvironmentProvider.RegisterNewInstall = false;
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.UpdateUrl).Returns("http://update.nzbdrone.com/master_auto/");
|
||||
|
||||
@ -104,7 +104,7 @@ public void shouldnt_register_anything_if_not_on_master_branch()
|
||||
[Test]
|
||||
public void new_install_shouldnt_register_anything_if_not_on_master_branch()
|
||||
{
|
||||
EnviromentProvider.RegisterNewInstall = true;
|
||||
EnvironmentProvider.RegisterNewInstall = true;
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.UpdateUrl).Returns("http://update.nzbdrone.com/master_auto/");
|
||||
|
||||
@ -116,7 +116,7 @@ public void new_install_shouldnt_register_anything_if_not_on_master_branch()
|
||||
[Test]
|
||||
public void should_be_able_to_call_deskmetrics_using_test_appid()
|
||||
{
|
||||
EnviromentProvider.RegisterNewInstall = true;
|
||||
EnvironmentProvider.RegisterNewInstall = true;
|
||||
Mocker.Resolve<AnalyticsProvider>().Checkpoint();
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public void setup()
|
||||
{
|
||||
WithTempAsAppPath();
|
||||
|
||||
UpdateLogFolder = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateLogFolder();
|
||||
UpdateLogFolder = Mocker.GetMock<EnvironmentProvider>().Object.GetUpdateLogFolder();
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(c => c.GetFiles(UpdateLogFolder, SearchOption.TopDirectoryOnly))
|
||||
|
@ -24,13 +24,13 @@ namespace NzbDrone.Core
|
||||
public class CentralDispatch
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
|
||||
public StandardKernel Kernel { get; private set; }
|
||||
|
||||
public CentralDispatch()
|
||||
{
|
||||
_enviromentProvider = new EnviromentProvider();
|
||||
_environmentProvider = new EnvironmentProvider();
|
||||
|
||||
logger.Debug("Initializing Kernel:");
|
||||
Kernel = new StandardKernel();
|
||||
@ -52,7 +52,7 @@ private void InitDatabase()
|
||||
{
|
||||
logger.Info("Initializing Database...");
|
||||
|
||||
var appDataPath = _enviromentProvider.GetAppDataPath();
|
||||
var appDataPath = _environmentProvider.GetAppDataPath();
|
||||
if (!Directory.Exists(appDataPath)) Directory.CreateDirectory(appDataPath);
|
||||
|
||||
var connection = Kernel.Get<Connection>();
|
||||
@ -67,15 +67,15 @@ private void InitDatabase()
|
||||
|
||||
private void InitReporting()
|
||||
{
|
||||
EnviromentProvider.UGuid = Kernel.Get<ConfigProvider>().UGuid;
|
||||
EnvironmentProvider.UGuid = Kernel.Get<ConfigProvider>().UGuid;
|
||||
ReportingService.RestProvider = Kernel.Get<RestProvider>();
|
||||
|
||||
var appId = AnalyticsProvider.DESKMETRICS_TEST_ID;
|
||||
|
||||
if (EnviromentProvider.IsProduction)
|
||||
if (EnvironmentProvider.IsProduction)
|
||||
appId = AnalyticsProvider.DESKMETRICS_PRODUCTION_ID;
|
||||
|
||||
var deskMetricsClient = new DeskMetricsClient(Kernel.Get<ConfigProvider>().UGuid.ToString(), appId, _enviromentProvider.Version);
|
||||
var deskMetricsClient = new DeskMetricsClient(Kernel.Get<ConfigProvider>().UGuid.ToString(), appId, _environmentProvider.Version);
|
||||
Kernel.Bind<IDeskMetricsClient>().ToConstant(deskMetricsClient);
|
||||
|
||||
Kernel.Get<AnalyticsProvider>().Checkpoint();
|
||||
@ -149,7 +149,7 @@ public void DedicateToHost()
|
||||
{
|
||||
try
|
||||
{
|
||||
var pid = _enviromentProvider.NzbDroneProcessIdFromEnviroment;
|
||||
var pid = _environmentProvider.NzbDroneProcessIdFromEnviroment;
|
||||
|
||||
logger.Debug("Attaching to parent process ({0}) for automatic termination.", pid);
|
||||
|
||||
|
@ -10,7 +10,7 @@ namespace NzbDrone.Core.Datastore
|
||||
{
|
||||
public class Connection
|
||||
{
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
|
||||
static Connection()
|
||||
{
|
||||
@ -23,16 +23,16 @@ static Connection()
|
||||
, "System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
|
||||
}
|
||||
|
||||
public Connection(EnviromentProvider enviromentProvider)
|
||||
public Connection(EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
}
|
||||
|
||||
public String MainConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetConnectionString(_enviromentProvider.GetNzbDronoeDbFile());
|
||||
return GetConnectionString(_environmentProvider.GetNzbDronoeDbFile());
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ public String LogConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetConnectionString(_enviromentProvider.GetLogDbFileDbFile());
|
||||
return GetConnectionString(_environmentProvider.GetLogDbFileDbFile());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ public class Migration20110707 : NzbDroneMigration
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
//This should not run unless for a clean install
|
||||
EnviromentProvider.RegisterNewInstall = true;
|
||||
EnvironmentProvider.RegisterNewInstall = true;
|
||||
|
||||
Database.AddTable("Series", new[]
|
||||
{
|
||||
|
@ -12,17 +12,17 @@ public class LogProvider
|
||||
private readonly IDatabase _database;
|
||||
private readonly LogDbContext _logDbContext;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
|
||||
|
||||
public LogProvider(IDatabase database, LogDbContext logDbContext, DiskProvider diskProvider, EnviromentProvider enviromentProvider)
|
||||
public LogProvider(IDatabase database, LogDbContext logDbContext, DiskProvider diskProvider, EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_database = database;
|
||||
_logDbContext = logDbContext;
|
||||
_diskProvider = diskProvider;
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
}
|
||||
|
||||
public IQueryable<Log> GetAllLogs()
|
||||
@ -52,8 +52,8 @@ public Page<Log> GetPagedLogs(int pageNumber, int pageSize)
|
||||
public void DeleteAll()
|
||||
{
|
||||
_database.Delete<Log>("");
|
||||
_diskProvider.DeleteFile(_enviromentProvider.GetLogFileName());
|
||||
_diskProvider.DeleteFile(_enviromentProvider.GetArchivedLogFileName());
|
||||
_diskProvider.DeleteFile(_environmentProvider.GetLogFileName());
|
||||
_diskProvider.DeleteFile(_environmentProvider.GetArchivedLogFileName());
|
||||
Logger.Info("Cleared Log History");
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace NzbDrone.Core.Jobs
|
||||
public class AppUpdateJob : IJob
|
||||
{
|
||||
private readonly UpdateProvider _updateProvider;
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private readonly HttpProvider _httpProvider;
|
||||
private readonly ProcessProvider _processProvider;
|
||||
@ -24,11 +24,11 @@ public class AppUpdateJob : IJob
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public AppUpdateJob(UpdateProvider updateProvider, EnviromentProvider enviromentProvider, DiskProvider diskProvider,
|
||||
public AppUpdateJob(UpdateProvider updateProvider, EnvironmentProvider environmentProvider, DiskProvider diskProvider,
|
||||
HttpProvider httpProvider, ProcessProvider processProvider, ArchiveProvider archiveProvider, ConfigFileProvider configFileProvider)
|
||||
{
|
||||
_updateProvider = updateProvider;
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
_diskProvider = diskProvider;
|
||||
_httpProvider = httpProvider;
|
||||
_processProvider = processProvider;
|
||||
@ -50,18 +50,18 @@ public virtual void Start(ProgressNotification notification, int targetId, int s
|
||||
{
|
||||
notification.CurrentMessage = "Checking for updates";
|
||||
|
||||
var updatePackage = _updateProvider.GetAvilableUpdate(_enviromentProvider.Version);
|
||||
var updatePackage = _updateProvider.GetAvilableUpdate(_environmentProvider.Version);
|
||||
|
||||
//No updates available
|
||||
if (updatePackage == null)
|
||||
return;
|
||||
|
||||
var packageDestination = Path.Combine(_enviromentProvider.GetUpdateSandboxFolder(), updatePackage.FileName);
|
||||
var packageDestination = Path.Combine(_environmentProvider.GetUpdateSandboxFolder(), updatePackage.FileName);
|
||||
|
||||
if (_diskProvider.FolderExists(_enviromentProvider.GetUpdateSandboxFolder()))
|
||||
if (_diskProvider.FolderExists(_environmentProvider.GetUpdateSandboxFolder()))
|
||||
{
|
||||
logger.Info("Deleting old update files");
|
||||
_diskProvider.DeleteFolder(_enviromentProvider.GetUpdateSandboxFolder(), true);
|
||||
_diskProvider.DeleteFolder(_environmentProvider.GetUpdateSandboxFolder(), true);
|
||||
}
|
||||
|
||||
logger.Info("Downloading update package from [{0}] to [{1}]", updatePackage.Url, packageDestination);
|
||||
@ -71,19 +71,19 @@ public virtual void Start(ProgressNotification notification, int targetId, int s
|
||||
|
||||
logger.Info("Extracting Update package");
|
||||
notification.CurrentMessage = "Extracting Update";
|
||||
_archiveProvider.ExtractArchive(packageDestination, _enviromentProvider.GetUpdateSandboxFolder());
|
||||
_archiveProvider.ExtractArchive(packageDestination, _environmentProvider.GetUpdateSandboxFolder());
|
||||
logger.Info("Update package extracted successfully");
|
||||
|
||||
logger.Info("Preparing client");
|
||||
notification.CurrentMessage = "Preparing to start Update";
|
||||
_diskProvider.MoveDirectory(_enviromentProvider.GetUpdateClientFolder(), _enviromentProvider.GetUpdateSandboxFolder());
|
||||
_diskProvider.MoveDirectory(_environmentProvider.GetUpdateClientFolder(), _environmentProvider.GetUpdateSandboxFolder());
|
||||
|
||||
|
||||
logger.Info("Starting update client");
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = _enviromentProvider.GetUpdateClientExePath(),
|
||||
Arguments = string.Format("{0} {1}", _enviromentProvider.NzbDroneProcessIdFromEnviroment, _configFileProvider.Guid)
|
||||
FileName = _environmentProvider.GetUpdateClientExePath(),
|
||||
Arguments = string.Format("{0} {1}", _environmentProvider.NzbDroneProcessIdFromEnviroment, _configFileProvider.Guid)
|
||||
};
|
||||
|
||||
var process = _processProvider.Start(startInfo);
|
||||
|
@ -37,10 +37,10 @@ public virtual void Checkpoint()
|
||||
if (!IsOnMasterBranch())
|
||||
return;
|
||||
|
||||
if (EnviromentProvider.RegisterNewInstall)
|
||||
if (EnvironmentProvider.RegisterNewInstall)
|
||||
{
|
||||
_deskMetricsClient.RegisterInstall();
|
||||
EnviromentProvider.RegisterNewInstall = false;
|
||||
EnvironmentProvider.RegisterNewInstall = false;
|
||||
}
|
||||
|
||||
if (_deskMetricsClient.Started)
|
||||
@ -52,7 +52,7 @@ public virtual void Checkpoint()
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (!EnviromentProvider.IsProduction)
|
||||
if (!EnvironmentProvider.IsProduction)
|
||||
throw;
|
||||
|
||||
logger.WarnException("Error while sending analytics data.", e);
|
||||
|
@ -9,13 +9,13 @@ namespace NzbDrone.Core.Providers
|
||||
{
|
||||
public class BackupProvider
|
||||
{
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public BackupProvider(EnviromentProvider enviromentProvider)
|
||||
public BackupProvider(EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
}
|
||||
|
||||
public BackupProvider()
|
||||
@ -25,9 +25,9 @@ public BackupProvider()
|
||||
|
||||
public virtual string CreateBackupZip()
|
||||
{
|
||||
var dbFile = _enviromentProvider.GetNzbDronoeDbFile();
|
||||
var configFile = _enviromentProvider.GetConfigPath();
|
||||
var zipFile = _enviromentProvider.GetConfigBackupFile();
|
||||
var dbFile = _environmentProvider.GetNzbDronoeDbFile();
|
||||
var configFile = _environmentProvider.GetConfigPath();
|
||||
var zipFile = _environmentProvider.GetConfigBackupFile();
|
||||
|
||||
using (var zip = new ZipFile())
|
||||
{
|
||||
|
@ -13,17 +13,17 @@ namespace NzbDrone.Core.Providers
|
||||
public class BannerProvider
|
||||
{
|
||||
private readonly HttpProvider _httpProvider;
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private const string BANNER_URL_PREFIX = "http://www.thetvdb.com/banners/";
|
||||
|
||||
public BannerProvider(HttpProvider httpProvider, EnviromentProvider enviromentProvider,
|
||||
public BannerProvider(HttpProvider httpProvider, EnvironmentProvider environmentProvider,
|
||||
DiskProvider diskProvider)
|
||||
{
|
||||
_httpProvider = httpProvider;
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
_diskProvider = diskProvider;
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ public BannerProvider()
|
||||
|
||||
public virtual bool Download(ProgressNotification notification, Series series)
|
||||
{
|
||||
var bannerPath = _enviromentProvider.GetBannerPath();
|
||||
var bannerPath = _environmentProvider.GetBannerPath();
|
||||
|
||||
logger.Trace("Ensuring Banner Folder exists: ", bannerPath);
|
||||
_diskProvider.CreateDirectory(bannerPath);
|
||||
@ -62,7 +62,7 @@ public virtual bool Download(ProgressNotification notification, Series series)
|
||||
|
||||
public virtual bool Delete(int seriesId)
|
||||
{
|
||||
var bannerPath = _enviromentProvider.GetBannerPath();
|
||||
var bannerPath = _environmentProvider.GetBannerPath();
|
||||
var bannerFilename = Path.Combine(bannerPath, seriesId.ToString()) + ".jpg";
|
||||
|
||||
try
|
||||
|
@ -13,17 +13,17 @@ namespace NzbDrone.Core.Providers
|
||||
{
|
||||
public class TvDbProvider
|
||||
{
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private const string TVDB_APIKEY = "5D2D188E86E07F4F";
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly TvdbHandler _handler;
|
||||
|
||||
[Inject]
|
||||
public TvDbProvider(EnviromentProvider enviromentProvider)
|
||||
public TvDbProvider(EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_handler = new TvdbHandler(new XmlCacheProvider(_enviromentProvider.GetCacheFolder()), TVDB_APIKEY);
|
||||
_environmentProvider = environmentProvider;
|
||||
_handler = new TvdbHandler(new XmlCacheProvider(_environmentProvider.GetCacheFolder()), TVDB_APIKEY);
|
||||
}
|
||||
|
||||
public TvDbProvider()
|
||||
|
@ -18,7 +18,7 @@ public class UpdateProvider
|
||||
{
|
||||
private readonly HttpProvider _httpProvider;
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
@ -29,11 +29,11 @@ public class UpdateProvider
|
||||
|
||||
[Inject]
|
||||
public UpdateProvider(HttpProvider httpProvider, ConfigProvider configProvider,
|
||||
EnviromentProvider enviromentProvider, DiskProvider diskProvider)
|
||||
EnvironmentProvider environmentProvider, DiskProvider diskProvider)
|
||||
{
|
||||
_httpProvider = httpProvider;
|
||||
_configProvider = configProvider;
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
_diskProvider = diskProvider;
|
||||
}
|
||||
|
||||
@ -80,9 +80,9 @@ public virtual Dictionary<DateTime, string> UpdateLogFile()
|
||||
var list = new Dictionary<DateTime, string>();
|
||||
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||
|
||||
if (_diskProvider.FolderExists(_enviromentProvider.GetUpdateLogFolder()))
|
||||
if (_diskProvider.FolderExists(_environmentProvider.GetUpdateLogFolder()))
|
||||
{
|
||||
var files = _diskProvider.GetFiles(_enviromentProvider.GetUpdateLogFolder(), SearchOption.TopDirectoryOnly).ToList();
|
||||
var files = _diskProvider.GetFiles(_environmentProvider.GetUpdateLogFolder(), SearchOption.TopDirectoryOnly).ToList();
|
||||
|
||||
foreach (var file in files.Select(c => new FileInfo(c)).OrderByDescending(c => c.Name))
|
||||
{
|
||||
|
@ -15,8 +15,8 @@ public static class Logging
|
||||
|
||||
public static void PreStart()
|
||||
{
|
||||
string logPath = string.Format("C:\\NLog\\{0}\\{1}\\${{shortdate}}-${{logger}}.log", HostingEnvironment.SiteName, new EnviromentProvider().Version);
|
||||
string error = string.Format("C:\\NLog\\{0}\\{1}\\${{shortdate}}_Error.log", HostingEnvironment.SiteName, new EnviromentProvider().Version);
|
||||
string logPath = string.Format("C:\\NLog\\{0}\\{1}\\${{shortdate}}-${{logger}}.log", HostingEnvironment.SiteName, new EnvironmentProvider().Version);
|
||||
string error = string.Format("C:\\NLog\\{0}\\{1}\\${{shortdate}}_Error.log", HostingEnvironment.SiteName, new EnvironmentProvider().Version);
|
||||
|
||||
LogConfiguration.RegisterUdpLogger();
|
||||
LogConfiguration.RegisterFileLogger(logPath, LogLevel.Trace);
|
||||
|
@ -9,12 +9,12 @@ namespace NzbDrone.Services.Service.Controllers
|
||||
{
|
||||
public class HealthController : Controller
|
||||
{
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private readonly IDatabase _database;
|
||||
|
||||
public HealthController(EnviromentProvider enviromentProvider, IDatabase database)
|
||||
public HealthController(EnvironmentProvider environmentProvider, IDatabase database)
|
||||
{
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
_database = database;
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ public JsonResult Echo()
|
||||
{
|
||||
var stat = new
|
||||
{
|
||||
Service = _enviromentProvider.Version.ToString(),
|
||||
Service = _environmentProvider.Version.ToString(),
|
||||
Schema = _database.Fetch<SchemaInfo>().OrderByDescending(c => c.Version).First()
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@ public static class HtmlIncludeExtentions
|
||||
|
||||
static HtmlIncludeExtentions()
|
||||
{
|
||||
versionString = new EnviromentProvider().Version.ToString().Replace('.', '_');
|
||||
versionString = new EnvironmentProvider().Version.ToString().Replace('.', '_');
|
||||
isProduction = true;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ protected string VirtualPath
|
||||
[SetUp]
|
||||
public void TestBaseSetup()
|
||||
{
|
||||
EnviromentProvider.RegisterNewInstall = true;
|
||||
EnvironmentProvider.RegisterNewInstall = true;
|
||||
|
||||
MockedRestProvider = new Mock<RestProvider>();
|
||||
ReportingService.RestProvider = MockedRestProvider.Object;
|
||||
@ -75,7 +75,7 @@ protected void WithStrictMocker()
|
||||
|
||||
protected void WithTempAsAppPath()
|
||||
{
|
||||
Mocker.GetMock<EnviromentProvider>()
|
||||
Mocker.GetMock<EnvironmentProvider>()
|
||||
.SetupGet(c => c.ApplicationPath)
|
||||
.Returns(VirtualPath);
|
||||
}
|
||||
|
@ -19,16 +19,16 @@ class UpdateProviderStartFixture : TestBase
|
||||
private const string TARGET_FOLDER = @"C:\NzbDrone\";
|
||||
private const string UPDATE_LOG_FOLDER = @"C:\NzbDrone\UpdateLogs\";
|
||||
|
||||
Mock<EnviromentProvider> _enviromentProvider;
|
||||
Mock<EnvironmentProvider> _environmentProvider;
|
||||
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
|
||||
_enviromentProvider = Mocker.GetMock<EnviromentProvider>();
|
||||
_environmentProvider = Mocker.GetMock<EnvironmentProvider>();
|
||||
|
||||
_enviromentProvider.SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\");
|
||||
_environmentProvider.SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\");
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(c => c.FolderExists(UPDATE_FOLDER))
|
||||
|
@ -18,10 +18,10 @@ class UpdateProviderVerifyFixture : TestBase
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<EnviromentProvider>()
|
||||
Mocker.GetMock<EnvironmentProvider>()
|
||||
.Setup(c => c.StartUpPath).Returns(@"C:\Temp\NzbDrone_update\");
|
||||
|
||||
Mocker.GetMock<EnviromentProvider>()
|
||||
Mocker.GetMock<EnvironmentProvider>()
|
||||
.Setup(c => c.SystemTemp).Returns(@"C:\Temp\");
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public static void Main(string[] args)
|
||||
|
||||
|
||||
|
||||
logger.Info("Updating NzbDrone to version {0}", _kernel.Get<EnviromentProvider>().Version);
|
||||
logger.Info("Updating NzbDrone to version {0}", _kernel.Get<EnvironmentProvider>().Version);
|
||||
_kernel.Get<Program>().Start(args);
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -48,10 +48,10 @@ private static void TransferUpdateLogs()
|
||||
{
|
||||
try
|
||||
{
|
||||
var enviromentProvider = _kernel.Get<EnviromentProvider>();
|
||||
var environmentProvider = _kernel.Get<EnvironmentProvider>();
|
||||
var diskProvider = _kernel.Get<DiskProvider>();
|
||||
logger.Info("Copying log files to application directory.");
|
||||
diskProvider.CopyDirectory(enviromentProvider.GetSandboxLogFolder(), enviromentProvider.GetUpdateLogFolder());
|
||||
diskProvider.CopyDirectory(environmentProvider.GetSandboxLogFolder(), environmentProvider.GetUpdateLogFolder());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -68,7 +68,7 @@ private static void InitLoggers()
|
||||
LogConfiguration.RegisterConsoleLogger(LogLevel.Trace);
|
||||
LogConfiguration.RegisterUdpLogger();
|
||||
|
||||
var logPath = Path.Combine(new EnviromentProvider().GetSandboxLogFolder(), DateTime.Now.ToString("yyyy.MM.dd-H-mm") + ".txt");
|
||||
var logPath = Path.Combine(new EnvironmentProvider().GetSandboxLogFolder(), DateTime.Now.ToString("yyyy.MM.dd-H-mm") + ".txt");
|
||||
LogConfiguration.RegisterFileLogger(logPath, LogLevel.Info);
|
||||
|
||||
LogConfiguration.Reload();
|
||||
|
@ -12,17 +12,17 @@ public class UpdateProvider
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private readonly ServiceProvider _serviceProvider;
|
||||
private readonly ProcessProvider _processProvider;
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private readonly IISProvider _iisProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public UpdateProvider(DiskProvider diskProvider, ServiceProvider serviceProvider,
|
||||
ProcessProvider processProvider, EnviromentProvider enviromentProvider, IISProvider iisProvider)
|
||||
ProcessProvider processProvider, EnvironmentProvider environmentProvider, IISProvider iisProvider)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_serviceProvider = serviceProvider;
|
||||
_processProvider = processProvider;
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
_iisProvider = iisProvider;
|
||||
}
|
||||
|
||||
@ -41,8 +41,8 @@ private void Verify(string targetFolder)
|
||||
throw new DirectoryNotFoundException("Target folder doesn't exist " + targetFolder);
|
||||
|
||||
logger.Info("Verifying Update Folder");
|
||||
if (!_diskProvider.FolderExists(_enviromentProvider.GetUpdatePackageFolder()))
|
||||
throw new DirectoryNotFoundException("Update folder doesn't exist " + _enviromentProvider.GetUpdatePackageFolder());
|
||||
if (!_diskProvider.FolderExists(_environmentProvider.GetUpdatePackageFolder()))
|
||||
throw new DirectoryNotFoundException("Update folder doesn't exist " + _environmentProvider.GetUpdatePackageFolder());
|
||||
|
||||
}
|
||||
|
||||
@ -73,17 +73,17 @@ public virtual void Start(string targetFolder)
|
||||
_iisProvider.StopServer();
|
||||
|
||||
logger.Info("Creating backup of existing installation");
|
||||
_diskProvider.CopyDirectory(targetFolder, _enviromentProvider.GetUpdateBackUpFolder());
|
||||
_diskProvider.CopyDirectory(targetFolder, _environmentProvider.GetUpdateBackUpFolder());
|
||||
|
||||
|
||||
logger.Info("Moving update package to target");
|
||||
|
||||
try
|
||||
{
|
||||
_diskProvider.CopyDirectory(_enviromentProvider.GetUpdatePackageFolder(), targetFolder);
|
||||
_diskProvider.CopyDirectory(_environmentProvider.GetUpdatePackageFolder(), targetFolder);
|
||||
|
||||
logger.Trace("Deleting Update Package.");
|
||||
_diskProvider.DeleteFolder(_enviromentProvider.GetUpdatePackageFolder(), true);
|
||||
_diskProvider.DeleteFolder(_environmentProvider.GetUpdatePackageFolder(), true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -106,7 +106,7 @@ private void RollBack(string targetFolder)
|
||||
{
|
||||
//TODO:this should ignore single file failures.
|
||||
logger.Info("Attempting to rollback upgrade");
|
||||
_diskProvider.CopyDirectory(_enviromentProvider.GetUpdateBackUpFolder(), targetFolder);
|
||||
_diskProvider.CopyDirectory(_environmentProvider.GetUpdateBackUpFolder(), targetFolder);
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace NzbDrone.Web.UI.Automation
|
||||
[TestFixture(Category = "Automation")]
|
||||
public abstract class AutomationTestBase
|
||||
{
|
||||
private static readonly EnviromentProvider enviromentProvider = new EnviromentProvider();
|
||||
private static readonly EnvironmentProvider environmentProvider = new EnvironmentProvider();
|
||||
|
||||
private readonly string _clonePackagePath;
|
||||
private readonly string _masterPackagePath;
|
||||
@ -30,7 +30,7 @@ protected string AppUrl
|
||||
|
||||
protected AutomationTestBase()
|
||||
{
|
||||
var rawPackagePath = Path.Combine(enviromentProvider.ApplicationPath, "_rawPackage");
|
||||
var rawPackagePath = Path.Combine(environmentProvider.ApplicationPath, "_rawPackage");
|
||||
_clonePackagePath = Path.Combine(rawPackagePath, "NzbDrone_Automation");
|
||||
_masterPackagePath = Path.Combine(rawPackagePath, "NzbDrone");
|
||||
}
|
||||
@ -197,7 +197,7 @@ private string CreatePackage()
|
||||
|
||||
StopNzbDrone();
|
||||
|
||||
var rootDirectory = new DirectoryInfo(enviromentProvider.ApplicationPath);
|
||||
var rootDirectory = new DirectoryInfo(environmentProvider.ApplicationPath);
|
||||
|
||||
if (rootDirectory.GetDirectories("_rawPackage").Any())
|
||||
{
|
||||
@ -212,7 +212,7 @@ private string CreatePackage()
|
||||
|
||||
Process.Start(startInfo).WaitForExit();
|
||||
|
||||
var testFolder = Path.Combine(enviromentProvider.SystemTemp, "NzbDroneAutomation");
|
||||
var testFolder = Path.Combine(environmentProvider.SystemTemp, "NzbDroneAutomation");
|
||||
|
||||
if (Directory.Exists(testFolder))
|
||||
{
|
||||
@ -239,12 +239,12 @@ private static void CleanBinFolder()
|
||||
{
|
||||
var folderName = "Debug";
|
||||
|
||||
if (EnviromentProvider.IsDebug)
|
||||
if (EnvironmentProvider.IsDebug)
|
||||
{
|
||||
folderName = "Release";
|
||||
}
|
||||
|
||||
var dirs = Directory.GetDirectories(enviromentProvider.ApplicationPath, folderName, SearchOption.AllDirectories);
|
||||
var dirs = Directory.GetDirectories(environmentProvider.ApplicationPath, folderName, SearchOption.AllDirectories);
|
||||
|
||||
|
||||
foreach (var dir in dirs)
|
||||
|
@ -13,15 +13,15 @@ public static class Logging
|
||||
{
|
||||
public static void PreStart()
|
||||
{
|
||||
var enviromentProvider = new EnviromentProvider();
|
||||
var environmentProvider = new EnvironmentProvider();
|
||||
|
||||
LogManager.Configuration = new XmlLoggingConfiguration(enviromentProvider.GetNlogConfigPath(), false);
|
||||
LogManager.Configuration = new XmlLoggingConfiguration(environmentProvider.GetNlogConfigPath(), false);
|
||||
|
||||
LogConfiguration.RegisterUdpLogger();
|
||||
LogConfiguration.RegisterRemote();
|
||||
LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Web.MvcApplication");
|
||||
LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch");
|
||||
LogConfiguration.RegisterRollingFileLogger(enviromentProvider.GetLogFileName(), LogLevel.Trace);
|
||||
LogConfiguration.RegisterRollingFileLogger(environmentProvider.GetLogFileName(), LogLevel.Trace);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public void Init(HttpApplication context)
|
||||
// so authenticated users are always profiled
|
||||
//if (request.IsLocal) { MiniProfiler.Start(); }
|
||||
|
||||
if (!EnviromentProvider.IsProduction || ProfilerHelper.Enabled())
|
||||
if (!EnvironmentProvider.IsProduction || ProfilerHelper.Enabled())
|
||||
{
|
||||
var requestPath = ((HttpApplication)sender).Request.AppRelativeCurrentExecutionFilePath.ToLower();
|
||||
if (!requestPath.StartsWith("~/signalr") && !requestPath.EndsWith("notification/comet"))
|
||||
|
@ -13,13 +13,13 @@ namespace NzbDrone.Web.Controllers
|
||||
public class LogController : Controller
|
||||
{
|
||||
private readonly LogProvider _logProvider;
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
|
||||
public LogController(LogProvider logProvider, EnviromentProvider enviromentProvider, DiskProvider diskProvider)
|
||||
public LogController(LogProvider logProvider, EnvironmentProvider environmentProvider, DiskProvider diskProvider)
|
||||
{
|
||||
_logProvider = logProvider;
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
_diskProvider = diskProvider;
|
||||
}
|
||||
|
||||
@ -32,12 +32,12 @@ public FileContentResult File()
|
||||
{
|
||||
string log = string.Empty;
|
||||
|
||||
if (_diskProvider.FileExists(_enviromentProvider.GetArchivedLogFileName()))
|
||||
if (_diskProvider.FileExists(_environmentProvider.GetArchivedLogFileName()))
|
||||
{
|
||||
log = _diskProvider.ReadAllText(_enviromentProvider.GetArchivedLogFileName());
|
||||
log = _diskProvider.ReadAllText(_environmentProvider.GetArchivedLogFileName());
|
||||
}
|
||||
|
||||
log += _diskProvider.ReadAllText(_enviromentProvider.GetLogFileName());
|
||||
log += _diskProvider.ReadAllText(_environmentProvider.GetLogFileName());
|
||||
|
||||
return new FileContentResult(Encoding.ASCII.GetBytes(log), "text/plain");
|
||||
}
|
||||
|
@ -6,11 +6,11 @@ namespace NzbDrone.Web.Controllers
|
||||
{
|
||||
public class SharedController : Controller
|
||||
{
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
|
||||
public SharedController(EnviromentProvider enviromentProvider)
|
||||
public SharedController(EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
@ -22,7 +22,7 @@ public ActionResult Index()
|
||||
[OutputCache(Duration = 3600)]
|
||||
public ActionResult Footer()
|
||||
{
|
||||
return PartialView(new FooterModel { BuildTime = _enviromentProvider.BuildDateTime, Version = _enviromentProvider.Version });
|
||||
return PartialView(new FooterModel { BuildTime = _environmentProvider.BuildDateTime, Version = _environmentProvider.Version });
|
||||
}
|
||||
}
|
||||
}
|
@ -12,24 +12,24 @@ public class UpdateController : Controller
|
||||
{
|
||||
private readonly UpdateProvider _updateProvider;
|
||||
private readonly JobProvider _jobProvider;
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
|
||||
public UpdateController(UpdateProvider updateProvider, JobProvider jobProvider,
|
||||
EnviromentProvider enviromentProvider, DiskProvider diskProvider)
|
||||
EnvironmentProvider environmentProvider, DiskProvider diskProvider)
|
||||
{
|
||||
_updateProvider = updateProvider;
|
||||
_jobProvider = jobProvider;
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
_diskProvider = diskProvider;
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
var updateModel = new UpdateModel();
|
||||
updateModel.UpdatePackage = _updateProvider.GetAvilableUpdate(_enviromentProvider.Version);
|
||||
updateModel.UpdatePackage = _updateProvider.GetAvilableUpdate(_environmentProvider.Version);
|
||||
updateModel.LogFiles = _updateProvider.UpdateLogFile();
|
||||
updateModel.LogFolder = _enviromentProvider.GetUpdateLogFolder();
|
||||
updateModel.LogFolder = _environmentProvider.GetUpdateLogFolder();
|
||||
|
||||
return View(updateModel);
|
||||
}
|
||||
@ -51,7 +51,7 @@ public ActionResult ViewLog( string filepath)
|
||||
public ActionResult Post(string expectedVersion)
|
||||
{
|
||||
var model = new PostUpgradeModel();
|
||||
model.CurrentVersion = _enviromentProvider.Version;
|
||||
model.CurrentVersion = _environmentProvider.Version;
|
||||
model.ExpectedVersion = Version.Parse(expectedVersion);
|
||||
model.Success = model.CurrentVersion >= model.ExpectedVersion;
|
||||
|
||||
|
@ -13,8 +13,8 @@ public static class HtmlIncludeExtentions
|
||||
|
||||
static HtmlIncludeExtentions()
|
||||
{
|
||||
versionString = new EnviromentProvider().Version.ToString().Replace('.', '_');
|
||||
isProduction = EnviromentProvider.IsProduction;
|
||||
versionString = new EnvironmentProvider().Version.ToString().Replace('.', '_');
|
||||
isProduction = EnvironmentProvider.IsProduction;
|
||||
}
|
||||
|
||||
public static MvcHtmlString IncludeScript(this HtmlHelper helper, string filename)
|
||||
|
@ -10,8 +10,8 @@ public static class ProfilerHelper
|
||||
{
|
||||
public static bool Enabled()
|
||||
{
|
||||
var enviromentProvider = new EnviromentProvider();
|
||||
var configFileProvider = new ConfigFileProvider(enviromentProvider);
|
||||
var environmentProvider = new EnvironmentProvider();
|
||||
var configFileProvider = new ConfigFileProvider(environmentProvider);
|
||||
|
||||
return configFileProvider.EnableProfiler;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
ViewBag.Title = String.Format("{0} - NzbDrone", ViewBag.Title);
|
||||
}
|
||||
<title>@ViewBag.Title</title>
|
||||
@if (!EnviromentProvider.IsProduction || ProfilerHelper.Enabled())
|
||||
@if (!EnvironmentProvider.IsProduction || ProfilerHelper.Enabled())
|
||||
{
|
||||
@MvcMiniProfiler.MiniProfiler.RenderIncludes()
|
||||
}
|
||||
@ -51,7 +51,7 @@
|
||||
@RenderSection("Scripts", required: false)
|
||||
@Html.IncludeScript("jquery.signalR.min.js")
|
||||
<script src="@Url.Content("~/signalr/hubs")" type="text/javascript"></script>
|
||||
@if (EnviromentProvider.IsProduction)
|
||||
@if (EnvironmentProvider.IsProduction)
|
||||
{
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
|
@ -14,7 +14,7 @@ public class ApplicationServer : ServiceBase
|
||||
|
||||
private readonly ConfigFileProvider _configFileProvider;
|
||||
private readonly DebuggerProvider _debuggerProvider;
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private readonly IISProvider _iisProvider;
|
||||
private readonly ProcessProvider _processProvider;
|
||||
private readonly MonitoringProvider _monitoringProvider;
|
||||
@ -22,13 +22,13 @@ public class ApplicationServer : ServiceBase
|
||||
|
||||
[Inject]
|
||||
public ApplicationServer(ConfigFileProvider configFileProvider, IISProvider iisProvider,
|
||||
DebuggerProvider debuggerProvider, EnviromentProvider enviromentProvider,
|
||||
DebuggerProvider debuggerProvider, EnvironmentProvider environmentProvider,
|
||||
ProcessProvider processProvider, MonitoringProvider monitoringProvider, SecurityProvider securityProvider)
|
||||
{
|
||||
_configFileProvider = configFileProvider;
|
||||
_iisProvider = iisProvider;
|
||||
_debuggerProvider = debuggerProvider;
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
_processProvider = processProvider;
|
||||
_monitoringProvider = monitoringProvider;
|
||||
_securityProvider = securityProvider;
|
||||
@ -52,7 +52,7 @@ public virtual void Start()
|
||||
|
||||
_debuggerProvider.Attach();
|
||||
|
||||
if (_enviromentProvider.IsUserInteractive && _configFileProvider.LaunchBrowser)
|
||||
if (_environmentProvider.IsUserInteractive && _configFileProvider.LaunchBrowser)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ private static void BindKernel()
|
||||
_kernel.Bind<ConfigFileProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<ConsoleProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<DebuggerProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<EnviromentProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<EnvironmentProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<IISProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<MonitoringProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<ProcessProvider>().ToSelf().InSingletonScope();
|
||||
@ -43,16 +43,16 @@ private static void BindKernel()
|
||||
|
||||
private static void InitilizeApp()
|
||||
{
|
||||
var enviromentProvider = _kernel.Get<EnviromentProvider>();
|
||||
var environmentProvider = _kernel.Get<EnvironmentProvider>();
|
||||
|
||||
ReportingService.RestProvider = _kernel.Get<RestProvider>();
|
||||
|
||||
LogConfiguration.RegisterRollingFileLogger(enviromentProvider.GetLogFileName(), LogLevel.Info);
|
||||
LogConfiguration.RegisterRollingFileLogger(environmentProvider.GetLogFileName(), LogLevel.Info);
|
||||
LogConfiguration.RegisterConsoleLogger(LogLevel.Debug);
|
||||
LogConfiguration.RegisterUdpLogger();
|
||||
LogConfiguration.RegisterRemote();
|
||||
LogConfiguration.Reload();
|
||||
Logger.Info("Start-up Path:'{0}'", enviromentProvider.ApplicationPath);
|
||||
Logger.Info("Start-up Path:'{0}'", environmentProvider.ApplicationPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public static void AppDomainException(Exception excepion)
|
||||
{
|
||||
Console.WriteLine("EPIC FAIL: {0}", excepion);
|
||||
|
||||
if (EnviromentProvider.IsProduction)
|
||||
if (EnvironmentProvider.IsProduction)
|
||||
{
|
||||
new Client
|
||||
{
|
||||
|
@ -14,14 +14,14 @@ public class Router
|
||||
private readonly ApplicationServer _applicationServer;
|
||||
private readonly ServiceProvider _serviceProvider;
|
||||
private readonly ConsoleProvider _consoleProvider;
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
|
||||
public Router(ApplicationServer applicationServer, ServiceProvider serviceProvider, ConsoleProvider consoleProvider, EnviromentProvider enviromentProvider)
|
||||
public Router(ApplicationServer applicationServer, ServiceProvider serviceProvider, ConsoleProvider consoleProvider, EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_applicationServer = applicationServer;
|
||||
_serviceProvider = serviceProvider;
|
||||
_consoleProvider = consoleProvider;
|
||||
_enviromentProvider = enviromentProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
}
|
||||
|
||||
public void Route(IEnumerable<string> args)
|
||||
@ -35,7 +35,7 @@ public void Route(ApplicationMode applicationMode)
|
||||
logger.Info("Application mode: {0}", applicationMode);
|
||||
|
||||
//TODO:move this outside, it should be one of application modes (ApplicationMode.Service?)
|
||||
if (!_enviromentProvider.IsUserInteractive)
|
||||
if (!_environmentProvider.IsUserInteractive)
|
||||
{
|
||||
_serviceProvider.Run(_applicationServer);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user