From 993904e9bf2897dc02f5f3689e7f15f04a7035fd Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 22 Jan 2015 00:18:32 -0600 Subject: [PATCH] (GH-14) Add SourceType to config Set it based on what is passed in --- .../configuration/ChocolateyConfiguration.cs | 2 ++ .../infrastructure.app/runners/GenericRunner.cs | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs index 7a4a507df8..09ca4fd5f1 100644 --- a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs +++ b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs @@ -31,6 +31,7 @@ public ChocolateyConfiguration() { RegularOuptut = true; PromptForConfirmation = true; + SourceType = SourceType.normal; Information = new InformationCommandConfiguration(); Features = new FeaturesConfiguration(); NewCommand = new NewCommandConfiguration(); @@ -103,6 +104,7 @@ private void output_tostring(StringBuilder propertyValues, IEnumerable public string Sources { get; set; } + public SourceType SourceType { get; set; } // top level commands diff --git a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs index d78835a8c9..faf6a365c2 100644 --- a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs +++ b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs @@ -20,6 +20,7 @@ namespace chocolatey.infrastructure.app.runners using SimpleInjector; using attributes; using configuration; + using domain; using infrastructure.commands; public sealed class GenericRunner @@ -50,6 +51,8 @@ public void run(ChocolateyConfiguration config, Container container, bool isCons parseArgs.Invoke(command); } + set_source_type(config); + this.Log().Debug(() => "Configuration: {0}".format_with(config.ToString())); @@ -78,5 +81,12 @@ public void run(ChocolateyConfiguration config, Container container, bool isCons } } } + + private static void set_source_type(ChocolateyConfiguration config) + { + var sourceType = SourceType.normal; + Enum.TryParse(config.Sources, true, out sourceType); + config.SourceType = sourceType; + } } } \ No newline at end of file