Skip to content

Commit d477eb6

Browse files
authored
Merge pull request #707 from intersystems/ipm-deletes
Add IPM event handler that does an uninstall
2 parents e91665c + 5e58d3a commit d477eb6

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.11.0] - Unreleased
9+
10+
### Added
11+
- Pull event handler that does an IPM uninstall and load to handle deletes (#631)
12+
813
## [2.10.0] - 2025-02-10
914

1015
### Added

cls/SourceControl/Git/PullEventHandler/PackageManager.cls

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ Parameter DESCRIPTION = "Does zpm ""load <repo root>""";
88
/// Subclasses may override to customize behavior on pull.
99
Method OnPull() As %Status
1010
{
11-
quit ##class(%ZPM.PackageManager).Shell("load "_..LocalRoot)
11+
set command = "load "_..LocalRoot
12+
quit $select(
13+
$$$comClassDefined("%IPM.Main"): ##class(%IPM.Main).Shell(command),
14+
1: ##class(%ZPM.PackageManager).Shell(command)
15+
)
1216
}
1317

14-
}
18+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Class SourceControl.Git.PullEventHandler.PackageManagerReload Extends SourceControl.Git.PullEventHandler
2+
{
3+
4+
Parameter NAME = "Package Manager Reload";
5+
6+
Parameter DESCRIPTION = "Does zpm ""uninstall"", then zpm ""load <repo root>""";
7+
8+
/// Subclasses may override to customize behavior on pull.
9+
Method OnPull() As %Status
10+
{
11+
set moduleFilePath = ##class(%File).NormalizeFilename("module.xml",..LocalRoot)
12+
set sc = $System.OBJ.Load(moduleFilePath,"-d",,.internalName,1) // list-only load to get module name
13+
$$$QuitOnError(sc)
14+
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(internalName)
15+
if $isobject(context.Package) {
16+
set command = "uninstall "_context.Package.Name
17+
set sc = $select(
18+
$$$comClassDefined("%IPM.Main"): ##class(%IPM.Main).Shell(command),
19+
1: ##class(%ZPM.PackageManager).Shell(command)
20+
)
21+
$$$QuitOnError(sc)
22+
}
23+
set command = "load "_..LocalRoot
24+
quit $select(
25+
$$$comClassDefined("%IPM.Main"): ##class(%IPM.Main).Shell(command),
26+
1: ##class(%ZPM.PackageManager).Shell(command)
27+
)
28+
}
29+
30+
}

0 commit comments

Comments
 (0)