Skip to content

Commit

Permalink
(chocolateyGH-14) Add SourceType to config
Browse files Browse the repository at this point in the history
Set it based on what is passed in
  • Loading branch information
ferventcoder committed Jan 22, 2015
1 parent f196cf6 commit 385ed7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public ChocolateyConfiguration()
{
RegularOuptut = true;
PromptForConfirmation = true;
SourceType = SourceType.normal;
Information = new InformationCommandConfiguration();
Features = new FeaturesConfiguration();
NewCommand = new NewCommandConfiguration();
Expand Down Expand Up @@ -103,6 +104,7 @@ private void output_tostring(StringBuilder propertyValues, IEnumerable<PropertyI
/// One or more source locations set by configuration or by command line. Separated by semi-colon
/// </summary>
public string Sources { get; set; }
public SourceType SourceType { get; set; }

// top level commands

Expand Down
10 changes: 10 additions & 0 deletions src/chocolatey/infrastructure.app/runners/GenericRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace chocolatey.infrastructure.app.runners
using SimpleInjector;
using attributes;
using configuration;
using domain;
using infrastructure.commands;

public sealed class GenericRunner
Expand Down Expand Up @@ -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()));


Expand Down Expand Up @@ -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;
}
}
}

0 comments on commit 385ed7a

Please sign in to comment.