Skip to content

Conversation

@AshokThangavel
Copy link
Contributor

Summary

This PR introduces the ability to physically remove a module's source directory (orphaned folder) during the uninstallation process. It provides both manual control via a new command-line flag and environment-wide control via a global configuration setting.
fixes: #1033

Changes

CLI Enhancements

  • Added -c and -clean modifiers to the uninstall command.
  • When active, the command deletes the physical directory associated with the module after its logic is removed from the database.

Global Configuration

  • Added a new setting: CleanOnUninstall in UniversalSettings.
  • config set CleanOnUninstall 1: Enables automatic filesystem cleanup for all uninstalls.
  • config set CleanOnUninstall 0: Default behavior (keeps folders).

Recursive Logic

  • The cleanup process is fully compatible with the -r (recursive) flag, ensuring that an entire dependency tree and all associated directories are removed in a single command.

Verification & Test Results

A comprehensive unit test suite was executed to validate manual flags, global policy enforcement, and recursive cleanup.

Test Statistics:

  • Status: PASSED ✅
  • Assertions: 30
  • Execution Time: 13.34s

Test Case Breakdown

ID Test Scenario Expected Result Status
1 Standard Uninstall Logic removed; Directory remains Pass ✅
2 Uninstall with -c Logic removed; Directory deleted Pass ✅
3 Config CleanOnUninstall=1 Logic removed; Directory deleted (no flag) Pass ✅
4 Recursive -r -c Entire tree and all directories deleted Pass ✅

Unit Test Log Snippet

zpm:USER>uninstall objectscript-math -c -v

[USER|objectscript-math]        Clean START
[USER|objectscript-math]        Unconfigure START
[USER|objectscript-math]        Unconfigure SUCCESS
Deleting class Math.Math
Deleting class Math.Utils
Deleting Math.INC
[USER|objectscript-math]        Cleanup: Removing source directory
[USER|objectscript-math]        Found source directory: /usr/irissys/ipm/objectscript-math/0.0.5/
[USER|objectscript-math]        Source directory successfully deleted
[USER|objectscript-math]        Clean SUCCESS

…y removal

- Implemented '-c' / '-clean' flag for the uninstall command.
- Added 'CleanOnUninstall' global configuration in UniversalSettings.
- Added recursive support for cleaning dependency directories.
- Included verbose logging to show specific paths being deleted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support -clean flag to remove Source Directory during Uninstall

1 participant