diff --git a/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs index 43317e0198..8d502128a5 100644 --- a/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs @@ -88,9 +88,9 @@ public override void Context() var expectedResult = new ConcurrentDictionary(); expectedResult.TryAdd("test-feature", new PackageResult(package.Object, "windowsfeatures", null)); - FeaturesRunner.Setup(r => r.install_run(It.IsAny(), It.IsAny>())) + FeaturesRunner.Setup(r => r.install_run(It.IsAny(), It.IsAny>(), It.IsAny>())) .Returns(expectedResult); - NormalRunner.Setup(r => r.install_run(It.IsAny(), It.IsAny>())) + NormalRunner.Setup(r => r.install_run(It.IsAny(), It.IsAny>(), It.IsAny>())) .Returns(new ConcurrentDictionary()); SourceRunners.AddRange(new[] { NormalRunner.Object, FeaturesRunner.Object }); @@ -125,20 +125,20 @@ public void should_return_package_that_should_have_been_installed() [Test] public void should_have_called_runner_for_windows_features_source() { - FeaturesRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames == "test-feature"), It.IsAny>()), Times.Once); + FeaturesRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames == "test-feature"), It.IsAny>(), It.IsAny>()), Times.Once); } [Test] public void should_not_have_called_runner_for_windows_features_source_with_other_package_names() { - FeaturesRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames != "test-feature"), It.IsAny>()), Times.Never); + FeaturesRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames != "test-feature"), It.IsAny>(), It.IsAny>()), Times.Never); } [Test] public void should_not_have_called_normal_source_runner_for_non_empty_packages() { // The normal source runners will be called with an argument - NormalRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames != string.Empty), It.IsAny>()), Times.Never); + NormalRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames != string.Empty), It.IsAny>(), It.IsAny>()), Times.Never); } } } diff --git a/src/chocolatey/infrastructure.app/services/CygwinService.cs b/src/chocolatey/infrastructure.app/services/CygwinService.cs index cae6dbd651..a3e56f6fee 100644 --- a/src/chocolatey/infrastructure.app/services/CygwinService.cs +++ b/src/chocolatey/infrastructure.app/services/CygwinService.cs @@ -234,6 +234,11 @@ public void install_noop(ChocolateyConfiguration config, Action c } public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + { + return install_run(config, continueAction, beforeModifyAction: null); + } + + public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction) { var args = build_args(config, _installArguments); var packageResults = new ConcurrentDictionary(StringComparer.InvariantCultureIgnoreCase); diff --git a/src/chocolatey/infrastructure.app/services/ISourceRunner.cs b/src/chocolatey/infrastructure.app/services/ISourceRunner.cs index 3a1aaac649..6b7431b297 100644 --- a/src/chocolatey/infrastructure.app/services/ISourceRunner.cs +++ b/src/chocolatey/infrastructure.app/services/ISourceRunner.cs @@ -77,6 +77,15 @@ public interface ISourceRunner /// results of installs ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction); + /// + /// Installs packages from the source feed + /// + /// The configuration. + /// The action to continue with when install is successful. + /// The action (if any) to run on any currently installed package dependencies before triggering the install or updating those dependencies. + /// results of installs + ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction); + /// /// Run upgrade in noop mode /// @@ -89,7 +98,7 @@ public interface ISourceRunner /// /// The configuration. /// The action to continue with when upgrade is successful. - /// The action (if any) to run on any currently installed package before triggering the upgrade. + /// The action (if any) to run on any currently installed package or its dependencies before triggering the upgrade. /// results of installs ConcurrentDictionary upgrade_run(ChocolateyConfiguration config, Action continueAction, Action beforeUpgradeAction = null); diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 158662e00a..8c49c9b9eb 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -384,6 +384,11 @@ public void install_noop(ChocolateyConfiguration config, Action c } public virtual ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + { + return install_run(config, continueAction, beforeModifyAction: null); + } + + public virtual ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction) { _fileSystem.create_directory_if_not_exists(ApplicationParameters.PackagesLocation); var packageInstalls = new ConcurrentDictionary(StringComparer.InvariantCultureIgnoreCase); diff --git a/src/chocolatey/infrastructure.app/services/PythonService.cs b/src/chocolatey/infrastructure.app/services/PythonService.cs index 4e59ed8b50..a8d040d0a5 100644 --- a/src/chocolatey/infrastructure.app/services/PythonService.cs +++ b/src/chocolatey/infrastructure.app/services/PythonService.cs @@ -337,6 +337,11 @@ public void install_noop(ChocolateyConfiguration config, Action c } public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + { + return install_run(config, continueAction, beforeModifyAction: null); + } + + public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction) { set_executable_path_if_not_set(); var args = build_args(config, _installArguments); diff --git a/src/chocolatey/infrastructure.app/services/RubyGemsService.cs b/src/chocolatey/infrastructure.app/services/RubyGemsService.cs index 8cfed8d964..7a99268321 100644 --- a/src/chocolatey/infrastructure.app/services/RubyGemsService.cs +++ b/src/chocolatey/infrastructure.app/services/RubyGemsService.cs @@ -196,6 +196,11 @@ public void install_noop(ChocolateyConfiguration config, Action c } public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + { + return install_run(config, continueAction, beforeModifyAction: null); + } + + public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction) { var packageResults = new ConcurrentDictionary(StringComparer.InvariantCultureIgnoreCase); var args = ExternalCommandArgsBuilder.build_arguments(config, _installArguments); diff --git a/src/chocolatey/infrastructure.app/services/WebPiService.cs b/src/chocolatey/infrastructure.app/services/WebPiService.cs index 96b70382ad..c5c2fe3e92 100644 --- a/src/chocolatey/infrastructure.app/services/WebPiService.cs +++ b/src/chocolatey/infrastructure.app/services/WebPiService.cs @@ -214,6 +214,11 @@ public void install_noop(ChocolateyConfiguration config, Action c } public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + { + return install_run(config, continueAction, beforeModifyAction: null); + } + + public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction) { write_deprecation_warning(); var packageResults = new ConcurrentDictionary(StringComparer.InvariantCultureIgnoreCase); diff --git a/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs b/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs index a960c1e9ca..5161741070 100644 --- a/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs +++ b/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs @@ -258,6 +258,11 @@ public void install_noop(ChocolateyConfiguration config, Action c } public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + { + return install_run(config, continueAction, beforeModifyAction: null); + } + + public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction) { set_executable_path_if_not_set(); var args = build_args(config, _installArguments);