/// <summary> /// Sets up the configuration based on arguments passed in, config file, and environment /// </summary> /// <param name="args">The arguments.</param> /// <param name="config">The configuration.</param> /// <param name="fileSystem">The file system.</param> /// <param name="xmlService">The XML service.</param> /// <param name="notifyWarnLoggingAction">Notify warn logging action</param> public static void set_up_configuration(IList <string> args, ChocolateyConfiguration config, IFileSystem fileSystem, IXmlService xmlService, Action <string> notifyWarnLoggingAction) { set_file_configuration(config, fileSystem, xmlService, notifyWarnLoggingAction); ConfigurationOptions.reset_options(); set_global_options(args, config); set_environment_options(config); }
public override void Context() { ConfigurationOptions.initialize_with(new Lazy <IConsole>(() => console.Object)); ConfigurationOptions.reset_options(); console.Setup((c) => c.Error).Returns(errorWriter); console.Setup((c) => c.Out).Returns(outputWriter); }
public override void BeforeEachSpec() { args = new List <string>(); config = new ChocolateyConfiguration(); setOptions = set => { }; afterParse = list => { }; validateConfiguration = () => { }; helpMessage = () => { }; helpMessageContents.Clear(); ConfigurationOptions.reset_options(); }
/// <summary> /// Sets up the configuration based on arguments passed in, config file, and environment /// </summary> /// <param name="args">The arguments.</param> /// <param name="config">The configuration.</param> /// <param name="container">The container.</param> /// <param name="license">The license.</param> /// <param name="notifyWarnLoggingAction">Notify warn logging action</param> public static void set_up_configuration(IList <string> args, ChocolateyConfiguration config, Container container, ChocolateyLicense license, Action <string> notifyWarnLoggingAction) { var fileSystem = container.GetInstance <IFileSystem>(); var xmlService = container.GetInstance <IXmlService>(); set_file_configuration(config, fileSystem, xmlService, notifyWarnLoggingAction); ConfigurationOptions.reset_options(); set_global_options(args, config, container); set_environment_options(config); set_license_options(config, license); set_environment_variables(config); }
/// <summary> /// Sets up the configuration based on arguments passed in, config file, and environment /// </summary> /// <param name="args">The arguments.</param> /// <param name="config">The configuration.</param> /// <param name="container">The container.</param> /// <param name="license">The license.</param> /// <param name="notifyWarnLoggingAction">Notify warn logging action</param> public static void set_up_configuration(IList <string> args, ChocolateyConfiguration config, Container container, ChocolateyLicense license, Action <string> notifyWarnLoggingAction) { var fileSystem = container.GetInstance <IFileSystem>(); var xmlService = container.GetInstance <IXmlService>(); var configFileSettings = get_config_file_settings(fileSystem, xmlService); set_file_configuration(config, configFileSettings, fileSystem, notifyWarnLoggingAction); ConfigurationOptions.reset_options(); set_global_options(args, config, container); set_environment_options(config); set_environment_variables(config); // must be done last for overrides set_licensed_options(config, license, configFileSettings); set_config_file_settings(configFileSettings, xmlService); }
/// <summary> /// Sets up the configuration based on arguments passed in, config file, and environment /// </summary> /// <param name="args">The arguments.</param> /// <param name="config">The configuration.</param> /// <param name="container">The container.</param> /// <param name="license">The license.</param> /// <param name="notifyWarnLoggingAction">Notify warn logging action</param> public static void set_up_configuration(IList <string> args, ChocolateyConfiguration config, Container container, ChocolateyLicense license, Action <string> notifyWarnLoggingAction) { var fileSystem = container.GetInstance <IFileSystem>(); var xmlService = container.GetInstance <IXmlService>(); var configFileSettings = get_config_file_settings(fileSystem, xmlService); // must be done prior to setting the file configuration add_or_remove_licensed_source(license, configFileSettings); set_file_configuration(config, configFileSettings, fileSystem, notifyWarnLoggingAction); ConfigurationOptions.reset_options(); set_global_options(args, config, container); set_environment_options(config); EnvironmentSettings.set_environment_variables(config); // must be done last for overrides set_licensed_options(config, license, configFileSettings); // save all changes if there are any set_config_file_settings(configFileSettings, xmlService, config); set_hash_provider(config, container); }
/// <summary> /// Sets up the configuration based on arguments passed in, config file, and environment /// </summary> /// <param name="args">The arguments.</param> /// <param name="config">The configuration.</param> /// <param name="container">The container.</param> /// <param name="license">The license.</param> /// <param name="notifyWarnLoggingAction">Notify warn logging action</param> public static void set_up_configuration(IList <string> args, ChocolateyConfiguration config, Container container, ChocolateyLicense license, Action <string> notifyWarnLoggingAction) { var fileSystem = container.GetInstance <IFileSystem>(); var xmlService = container.GetInstance <IXmlService>(); var configFileSettings = get_config_file_settings(fileSystem, xmlService); // must be done prior to setting the file configuration add_or_remove_licensed_source(license, configFileSettings); set_file_configuration(config, configFileSettings, fileSystem, notifyWarnLoggingAction); ConfigurationOptions.reset_options(); set_global_options(args, config, container); set_environment_options(config); set_environment_variables(config); // must be done last for overrides set_licensed_options(config, license, configFileSettings); // save all changes if there are any set_config_file_settings(configFileSettings, xmlService); if (!config.Features.UseFipsCompliantChecksums) { var hashprovider = container.GetInstance <IHashProvider>(); try { hashprovider.set_hash_algorithm(CryptoHashProviderType.Md5); } catch (Exception ex) { if (!config.CommandName.is_equal_to("feature")) { if (ex.InnerException != null && ex.InnerException.Message.contains("FIPS")) { "chocolatey".Log().Warn(ChocolateyLoggers.Important, @" FIPS Mode detected - run 'choco feature enable -n {0}' to use Chocolatey.".format_with(ApplicationParameters.Features.UseFipsCompliantChecksums)); throw new ApplicationException("When FIPS Mode is enabled, Chocolatey requires {0} feature also be enabled.".format_with(ApplicationParameters.Features.UseFipsCompliantChecksums)); } throw; } } } }