Skip to content

Commit

Permalink
(chocolateyGH-1655) make virtual methods for outdated / package service
Browse files Browse the repository at this point in the history
Ensure methods are virtual for licensed extension, which may extend
these methods.
  • Loading branch information
ferventcoder committed Mar 11, 2019
1 parent 738f036 commit 8822afb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ public ChocolateyPackageService(INugetService nugetService, IPowershellService p
_configTransformService = configTransformService;
}

public void ensure_source_app_installed(ChocolateyConfiguration config)
public virtual void ensure_source_app_installed(ChocolateyConfiguration config)
{
perform_source_runner_action(config, r => r.ensure_source_app_installed(config, (packageResult) => handle_package_result(packageResult, config, CommandNameType.install)));
}

public int count_run(ChocolateyConfiguration config)
public virtual int count_run(ChocolateyConfiguration config)
{
return perform_source_runner_function(config, r => r.count_run(config));
}
Expand Down Expand Up @@ -164,7 +164,7 @@ public void list_noop(ChocolateyConfiguration config)
randomly_notify_about_pro_business(config, PRO_BUSINESS_LIST_MESSAGE);
}

public IEnumerable<PackageResult> list_run(ChocolateyConfiguration config)
public virtual IEnumerable<PackageResult> list_run(ChocolateyConfiguration config)
{
if (string.IsNullOrWhiteSpace(config.Sources) && !config.ListCommand.LocalOnly)
{
Expand Down Expand Up @@ -251,7 +251,7 @@ public void pack_noop(ChocolateyConfiguration config)
randomly_notify_about_pro_business(config);
}

public void pack_run(ChocolateyConfiguration config)
public virtual void pack_run(ChocolateyConfiguration config)
{
if (config.SourceType != SourceType.normal)
{
Expand All @@ -275,7 +275,7 @@ public void push_noop(ChocolateyConfiguration config)
randomly_notify_about_pro_business(config);
}

public void push_run(ChocolateyConfiguration config)
public virtual void push_run(ChocolateyConfiguration config)
{
if (config.SourceType != SourceType.normal)
{
Expand Down Expand Up @@ -333,7 +333,7 @@ public void randomly_notify_about_pro_business(ChocolateyConfiguration config, s
}
}

public void handle_package_result(PackageResult packageResult, ChocolateyConfiguration config, CommandNameType commandName)
public virtual void handle_package_result(PackageResult packageResult, ChocolateyConfiguration config, CommandNameType commandName)
{
EnvironmentSettings.reset_environment_variables(config);
set_pending(packageResult, config);
Expand Down Expand Up @@ -558,7 +558,7 @@ private string capture_arguments(ChocolateyConfiguration config, PackageResult p
return NugetEncryptionUtility.EncryptString(arguments.to_string());
}

public ConcurrentDictionary<string, PackageResult> install_run(ChocolateyConfiguration config)
public virtual ConcurrentDictionary<string, PackageResult> install_run(ChocolateyConfiguration config)
{
this.Log().Info(is_packages_config_file(config.PackageNames) ? @"Installing from config file:" : @"Installing the following packages:");
this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(config.PackageNames));
Expand Down Expand Up @@ -616,7 +616,7 @@ Would have determined packages that are out of date based on what is
installed and what versions are available for upgrade.");
}

public void outdated_run(ChocolateyConfiguration config)
public virtual void outdated_run(ChocolateyConfiguration config)
{
if (config.SourceType != SourceType.normal)
{
Expand Down Expand Up @@ -742,7 +742,7 @@ public void upgrade_noop(ChocolateyConfiguration config)
randomly_notify_about_pro_business(config);
}

public ConcurrentDictionary<string, PackageResult> upgrade_run(ChocolateyConfiguration config)
public virtual ConcurrentDictionary<string, PackageResult> upgrade_run(ChocolateyConfiguration config)
{
this.Log().Info(@"Upgrading the following packages:");
this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(config.PackageNames));
Expand Down Expand Up @@ -820,7 +820,7 @@ public void uninstall_noop(ChocolateyConfiguration config)
randomly_notify_about_pro_business(config);
}

public ConcurrentDictionary<string, PackageResult> uninstall_run(ChocolateyConfiguration config)
public virtual ConcurrentDictionary<string, PackageResult> uninstall_run(ChocolateyConfiguration config)
{
this.Log().Info(@"Uninstalling the following packages:");
this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(config.PackageNames));
Expand Down Expand Up @@ -959,7 +959,7 @@ The recent package changes indicate a reboot is necessary.
return failures;
}

public void handle_package_uninstall(PackageResult packageResult, ChocolateyConfiguration config)
public virtual void handle_package_uninstall(PackageResult packageResult, ChocolateyConfiguration config)
{
if (!_fileSystem.directory_exists(packageResult.InstallLocation))
{
Expand Down Expand Up @@ -1290,7 +1290,7 @@ private void remove_rollback_if_exists(PackageResult packageResult)
_nugetService.remove_rollback_directory_if_exists(packageResult.Name);
}

public void set_pending(PackageResult packageResult, ChocolateyConfiguration config)
public virtual void set_pending(PackageResult packageResult, ChocolateyConfiguration config)
{
var packageDirectory = packageResult.InstallLocation;
if (string.IsNullOrWhiteSpace(packageDirectory)) return;
Expand All @@ -1314,7 +1314,7 @@ public void set_pending(PackageResult packageResult, ChocolateyConfiguration con
}
}

public void remove_pending(PackageResult packageResult, ChocolateyConfiguration config)
public virtual void remove_pending(PackageResult packageResult, ChocolateyConfiguration config)
{
var packageDirectory = packageResult.InstallLocation;
if (string.IsNullOrWhiteSpace(packageDirectory)) return;
Expand Down
2 changes: 1 addition & 1 deletion src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ public virtual ConcurrentDictionary<string, PackageResult> upgrade_run(Chocolate
return packageInstalls;
}

public ConcurrentDictionary<string, PackageResult> get_outdated(ChocolateyConfiguration config)
public virtual ConcurrentDictionary<string, PackageResult> get_outdated(ChocolateyConfiguration config)
{
var packageManager = NugetCommon.GetPackageManager(
config,
Expand Down

0 comments on commit 8822afb

Please sign in to comment.