Skip to content

Add IPM event handler that does an uninstall #707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.11.0] - Unreleased

### Added
- Pull event handler that does an IPM uninstall and load to handle deletes (#631)

## [2.10.0] - 2025-02-10

### Added
Expand Down
8 changes: 6 additions & 2 deletions cls/SourceControl/Git/PullEventHandler/PackageManager.cls
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ Parameter DESCRIPTION = "Does zpm ""load <repo root>""";
/// Subclasses may override to customize behavior on pull.
Method OnPull() As %Status
{
quit ##class(%ZPM.PackageManager).Shell("load "_..LocalRoot)
set command = "load "_..LocalRoot
quit $select(
$$$comClassDefined("%IPM.Main"): ##class(%IPM.Main).Shell(command),
1: ##class(%ZPM.PackageManager).Shell(command)
)
}

}
}
30 changes: 30 additions & 0 deletions cls/SourceControl/Git/PullEventHandler/PackageManagerReload.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Class SourceControl.Git.PullEventHandler.PackageManagerReload Extends SourceControl.Git.PullEventHandler
{

Parameter NAME = "Package Manager Reload";

Parameter DESCRIPTION = "Does zpm ""uninstall"", then zpm ""load <repo root>""";

/// Subclasses may override to customize behavior on pull.
Method OnPull() As %Status
{
set moduleFilePath = ##class(%File).NormalizeFilename("module.xml",..LocalRoot)
set sc = $System.OBJ.Load(moduleFilePath,"-d",,.internalName,1) // list-only load to get module name
$$$QuitOnError(sc)
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(internalName)
if $isobject(context.Package) {
set command = "uninstall "_context.Package.Name
set sc = $select(
$$$comClassDefined("%IPM.Main"): ##class(%IPM.Main).Shell(command),
1: ##class(%ZPM.PackageManager).Shell(command)
)
$$$QuitOnError(sc)
}
set command = "load "_..LocalRoot
quit $select(
$$$comClassDefined("%IPM.Main"): ##class(%IPM.Main).Shell(command),
1: ##class(%ZPM.PackageManager).Shell(command)
)
}

}
Loading