Skip to content

Commit

Permalink
(chocolatey#23) Disable install all keyword for alternate sources
Browse files Browse the repository at this point in the history
This throws a not implemented exception if the all keyword is used with
non-nuget alternate sources. This is because the all keyword only has
handling built in for normal sources, and it is better to throw an
error than to have the source try to install a package called "all"
  • Loading branch information
TheCakeIsNaOH committed Jan 9, 2024
1 parent 0861a57 commit 0a431fd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/chocolatey/infrastructure.app/services/CygwinService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ public ConcurrentDictionary<string, PackageResult> Install(ChocolateyConfigurati

public ConcurrentDictionary<string, PackageResult> Install(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> continueAction, Action<PackageResult, ChocolateyConfiguration> beforeModifyAction)
{
if (config.PackageNames.is_equal_to(ApplicationParameters.AllPackages))
{
throw new NotImplementedException("All keyword is not available for alternate sources");
}

var args = BuildArgs(config, _installArguments);
var packageResults = new ConcurrentDictionary<string, PackageResult>(StringComparer.InvariantCultureIgnoreCase);

Expand Down
5 changes: 5 additions & 0 deletions src/chocolatey/infrastructure.app/services/PythonService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@ public ConcurrentDictionary<string, PackageResult> Install(ChocolateyConfigurati

public ConcurrentDictionary<string, PackageResult> Install(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> continueAction, Action<PackageResult, ChocolateyConfiguration> beforeModifyAction)
{
if (config.PackageNames.is_equal_to(ApplicationParameters.AllPackages))
{
throw new NotImplementedException("All keyword is not available for alternate sources");
}

EnsureExecutablePathSet();
var args = BuildArguments(config, _installArguments);
var packageResults = new ConcurrentDictionary<string, PackageResult>(StringComparer.InvariantCultureIgnoreCase);
Expand Down
5 changes: 5 additions & 0 deletions src/chocolatey/infrastructure.app/services/RubyGemsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ public ConcurrentDictionary<string, PackageResult> Install(ChocolateyConfigurati

public ConcurrentDictionary<string, PackageResult> Install(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> continueAction, Action<PackageResult, ChocolateyConfiguration> beforeModifyAction)
{
if (config.PackageNames.is_equal_to(ApplicationParameters.AllPackages))
{
throw new NotImplementedException("All keyword is not available for alternate sources");
}

var packageResults = new ConcurrentDictionary<string, PackageResult>(StringComparer.InvariantCultureIgnoreCase);
var args = ExternalCommandArgsBuilder.BuildArguments(config, _installArguments);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ public ConcurrentDictionary<string, PackageResult> Install(ChocolateyConfigurati

public ConcurrentDictionary<string, PackageResult> Install(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> continueAction, Action<PackageResult, ChocolateyConfiguration> beforeModifyAction)
{
if (config.PackageNames.is_equal_to(ApplicationParameters.AllPackages))
{
throw new NotImplementedException("All keyword is not available for alternate sources");
}

EnsureExecutablePathSet();
var args = BuildArguments(config, _installArguments);
var packageResults = new ConcurrentDictionary<string, PackageResult>(StringComparer.InvariantCultureIgnoreCase);
Expand Down

0 comments on commit 0a431fd

Please sign in to comment.