diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..620976d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +/Uninstall.psm1 -text +/MiniModules.Uninstall.psd1 text eol=lf +/Uninstall*.Tests.ps1 text eol=lf +/Uninstall.md text eol=lf +/LICENSE text eol=lf +/out/* text eol=lf +/out/Uninstall.psm1 -text diff --git a/.github/workflows/source-uninstall.yml b/.github/workflows/source-uninstall.yml new file mode 100644 index 0000000..b40ed83 --- /dev/null +++ b/.github/workflows/source-uninstall.yml @@ -0,0 +1,15 @@ +name: Uninstall source checks +on: + push: + branches: [prepare/uninstall-package] + pull_request: + branches: [Uninstall/develop] +permissions: + contents: read +jobs: + source: + uses: stadub/PowershellScripts/.github/workflows/validate-module-source.yml@42814913be33a4662a57dbf011333b96c5fa294f + with: + module: Uninstall + source_sha: ${{ github.event.pull_request.head.sha || github.sha }} + automation_sha: 42814913be33a4662a57dbf011333b96c5fa294f diff --git a/MiniModules.Uninstall.psd1 b/MiniModules.Uninstall.psd1 new file mode 100644 index 0000000..f045088 --- /dev/null +++ b/MiniModules.Uninstall.psd1 @@ -0,0 +1,20 @@ +@{ + RootModule = 'Uninstall.psm1' + ModuleVersion = '1.0.1' + GUID = '27c80b64-2c07-43ee-ae20-4d94965295eb' + Author = 'Dima Stadub' + Description = 'Windows application uninstall helper using the registry and msiexec. Importing the module does not uninstall applications.' + PowerShellVersion = '5.1' + FunctionsToExport = @('Uninstall-Application') + CmdletsToExport = @() + VariablesToExport = @() + AliasesToExport = @() + PrivateData = @{ + PSData = @{ + Tags = @('Windows', 'Uninstall', 'msiexec') + LicenseUri = 'https://github.com/stadub/PowershellScripts/blob/master/LICENSE' + ProjectUri = 'https://github.com/stadub/PowershellScripts' + ReleaseNotes = 'Prepare the existing standalone module for manifest-based packaging; uninstall implementation unchanged.' + } + } +} diff --git a/Uninstall.Tests.ps1 b/Uninstall.Tests.ps1 new file mode 100644 index 0000000..2f3210b --- /dev/null +++ b/Uninstall.Tests.ps1 @@ -0,0 +1,29 @@ +$manifest = Join-Path $PSScriptRoot 'MiniModules.Uninstall.psd1' +Describe 'Uninstall module packaging contracts' { + BeforeAll { + $script:loaded = Import-Module $manifest -Force -PassThru -ErrorAction Stop + } + AfterAll { Remove-Module $script:loaded -Force -ErrorAction SilentlyContinue } + It 'validates the manifest and unchanged public command' { + (Test-ModuleManifest $manifest).Version.ToString() | Should -BeExactly '1.0.1' + $script:loaded.Name | Should -BeExactly 'MiniModules.Uninstall' + (Import-PowerShellDataFile $manifest).RootModule | Should -BeExactly 'Uninstall.psm1' + $script:loaded.ExportedFunctions.Count | Should -Be 1 + $script:loaded.ExportedFunctions.ContainsKey('Uninstall-Application') | Should -BeTrue + } + It 'preserves the mandatory pipeline software-name parameter and Application alias' { + $command = $script:loaded.ExportedFunctions['Uninstall-Application'] + $parameter = $command.Parameters['SoftwareName'] + $parameter.Aliases | Should -Contain 'Application' + $contract = @($parameter.Attributes | Where-Object { $_ -is [Management.Automation.ParameterAttribute] })[0] + $contract.Mandatory | Should -BeTrue + $contract.ValueFromPipeline | Should -BeTrue + } + It 'imports safely without starting an uninstaller or reading registry entries' { + Mock Start-Process { throw 'Unexpected uninstaller invocation' } + Mock Get-ItemProperty { throw 'Unexpected registry access' } + Import-Module $manifest -Force -ErrorAction Stop + Assert-MockCalled Start-Process 0 -Exactly -Scope It + Assert-MockCalled Get-ItemProperty 0 -Exactly -Scope It + } +} diff --git a/Uninstall.md b/Uninstall.md new file mode 100644 index 0000000..18558d6 --- /dev/null +++ b/Uninstall.md @@ -0,0 +1,16 @@ +# MiniModules.Uninstall module preparation + +The owner-approved MiniModules.Uninstall 1.0.1 manifest wraps the existing Uninstall.psm1 without changing its +implementation. Importing it exports Uninstall-Application and performs no +uninstall operation. Execution requires Windows registry/msiexec facilities. + +The Gallery name Uninstall currently refers to an unlisted script owned by +DimaStadub, not one of the configured Stadub/MiniModules module routes. The new module uses the distinct +MiniModules.Uninstall name and the owner-selected MiniModules account; it does not +replace, relist or claim that legacy script. +No Gallery upload, relisting, ownership transfer or uninstall was performed. + +The package contains only the module, manifest, this document and the existing +repository BSD-2-Clause LICENSE. It must never include unrelated monorepo files. +Tests cover safe import and the public parameter contract; actual registry lookup +and software removal remain unvalidated legacy behavior.