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 authored and gep13 committed Apr 23, 2024
1 parent 1c958dc commit 066f64d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
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 @@ -218,6 +218,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.IsEqualTo(ApplicationParameters.AllPackages))
{
throw new NotImplementedException("Alternative sources do not allow the use of the 'all' package name/keyword.");
}

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

Expand Down
7 changes: 6 additions & 1 deletion src/chocolatey/infrastructure.app/services/PythonService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,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.IsEqualTo(ApplicationParameters.AllPackages))
{
throw new NotImplementedException("Alternative sources do not allow the use of the 'all' package name/keyword.");
}

EnsureExecutablePathSet();
var args = BuildArguments(config, _installArguments);
var packageResults = new ConcurrentDictionary<string, PackageResult>(StringComparer.InvariantCultureIgnoreCase);
Expand Down Expand Up @@ -441,7 +446,7 @@ public ConcurrentDictionary<string, PackageResult> Upgrade(ChocolateyConfigurati
{
if (config.PackageNames.IsEqualTo(ApplicationParameters.AllPackages))
{
throw new NotImplementedException("The all keyword is not available for alternate sources");
throw new NotImplementedException("Alternative sources do not allow the use of the 'all' package name/keyword.");
}

EnsureExecutablePathSet();
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 @@ -211,6 +211,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.IsEqualTo(ApplicationParameters.AllPackages))
{
throw new NotImplementedException("Alternative sources do not allow the use of the 'all' package name/keyword.");
}

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 @@ -287,6 +287,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.IsEqualTo(ApplicationParameters.AllPackages))
{
throw new NotImplementedException("Alternative sources do not allow the use of the 'all' package name/keyword.");
}

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

0 comments on commit 066f64d

Please sign in to comment.