Skip to content

Commit

Permalink
(chocolateyGH-10) packages.config search
Browse files Browse the repository at this point in the history
  • Loading branch information
ferventcoder committed Feb 4, 2015
1 parent 6be7c15 commit 7733bdf
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,35 @@ private IEnumerable<ChocolateyConfiguration> set_config_from_package_names_and_p
{
config.PackageNames = config.PackageNames.Replace(packageConfigFile, string.Empty);

foreach (var package in get_packages_from_config(packageConfigFile, packageInstalls).or_empty_list_if_null())
{
var packageConfig = config.deep_copy();
packageConfig.PackageNames = package;

yield return packageConfig;
}
}

yield return config;
}

private IEnumerable<string> get_packages_from_config(string packageConfigFile, ConcurrentDictionary<string, PackageResult> packageInstalls)
{
IList<string> packages = new List<string>();

if (!_fileSystem.file_exists(_fileSystem.get_full_path(packageConfigFile)))
{
var logMessage = "Could not find '{0}' in the location specified.".format_with(packageConfigFile);
this.Log().Error(ChocolateyLoggers.Important, logMessage);
var results = packageInstalls.GetOrAdd(packageConfigFile, new PackageResult(packageConfigFile, null, null));
results.Messages.Add(new ResultMessage(ResultType.Error, logMessage));

return packages;
}

return packages;
}

public void upgrade_noop(ChocolateyConfiguration config)
{
_nugetService.upgrade_noop(config, (pkg) => _powershellService.install_noop(pkg));
Expand Down

0 comments on commit 7733bdf

Please sign in to comment.