diff --git a/src/chocolatey/GetChocolatey.cs b/src/chocolatey/GetChocolatey.cs index fdf5d97878..e6487625e5 100644 --- a/src/chocolatey/GetChocolatey.cs +++ b/src/chocolatey/GetChocolatey.cs @@ -167,21 +167,24 @@ public GetChocolatey RegisterContainerComponents(Action containerSetu /// public void Run() { - //refactor - thank goodness this is temporary, cuz manifest resource streams are dumb - IList folders = new List - { - "helpers", - "functions", - "redirects", - "tools" - }; - - AssemblyFileExtractor.extract_all_resources_to_relative_directory(_container.GetInstance(), Assembly.GetAssembly(typeof(ChocolateyResourcesAssembly)), ApplicationParameters.InstallLocation, folders, ApplicationParameters.ChocolateyFileResources); + extract_resources(); var configuration = create_configuration(new List()); var runner = new GenericRunner(); runner.run(configuration, _container, isConsole: false, parseArgs: null); } + /// + /// Call this method to run chocolatey after you have set the options. + /// Commandline arguments to add to configuration. + /// + public void RunConsole(string[] args) + { + extract_resources(); + var configuration = create_configuration(new List(args)); + var runner = new ConsoleApplication(); + runner.run(args, configuration, _container); + } + private ChocolateyConfiguration create_configuration(IList args) { var configuration = new ChocolateyConfiguration(); @@ -196,6 +199,20 @@ private ChocolateyConfiguration create_configuration(IList args) } return configuration; } + + private void extract_resources() + { + //refactor - thank goodness this is temporary, cuz manifest resource streams are dumb + IList folders = new List + { + "helpers", + "functions", + "redirects", + "tools" + }; + + AssemblyFileExtractor.extract_all_resources_to_relative_directory(_container.GetInstance(), Assembly.GetAssembly(typeof(ChocolateyResourcesAssembly)), ApplicationParameters.InstallLocation, folders, ApplicationParameters.ChocolateyFileResources); + } } // ReSharper restore InconsistentNaming