Closed vexx32 closed 1 month ago
@vexx32 one other thing that I thought about yesterday, but didn't mention...
Can you update your commit messages to provide more information? If/when reviewing the commits directly, we won't have the same context that exists in this PR. I am thinking that all the information in the PR description should make its way into the commit messages.
Thoughts?
That sounds like rather a lot, but I don't disagree, I'll look to do that too.
EDIT: Done.
@vexx32 can you let me know when the last remaining unresolved comments have been worked on? I would like to get this merged, so that we can continue with testing. Thanks
NOTE: I will mention here again, I forced pushed this PR on the head of develop, as I thought that it was ready for merging. You will need to reset you clone before continuing.
@gep13 I think I have everything sorted out, apologies for the wait on the last little bits here. :3
@vexx32 thank you very much for your work on this! It is great to see this getting added!
Description Of Changes
chocolateyInstaller.psm1
module to ensure that licensed cmdlets can be preferentially used instead of open-source cmdlets or functions, regardless of any name collisions that may occur.update-cmdlet-documentation.ps1
script which will use PlatyPS to read the cmdlet metadata and keep documentation up to date.-NewCommand
switch to allow easier additions of documentation pages for any new cmdlets (PlatyPS does not add newly added commands by default).Motivation and Context
Partially, we just want to finally add Uninstall-ChocolateyPath. However, given overall contribution rates to the powershell functions are quite low, the decision has been made to rewrite our helper functions into C# cmdlets.
This PR serves as the initial set of cmdlets, a handful of useful example cases to prove out the viability of this approach, as well as ensuring that we have a better path forward for both OSS commands and any licensed commands we want to use in the future. It also opens up the possibility of more easily overriding the OSS cmdlets with a licensed command, and there are provisions in the
chocolateyInstaller.psm1
module script to ensure that can work seamlessly.Testing
.nupkg
), attempt to install and uninstall the package running the chocolatey.console project in Visual Studio, specifying package parameters as/Path=C:\test /Scope=Machine
(or other paths, or with/Scope=User
).$env:ChocolateyInstall
to this folder, and attempt to run the same tests as before with thechoco.exe
in this folder. You should notice that any attempts to write to theMachine
scope path fail with an error.Import-Module $env:ChocolateyInstall/helpers/chocolateyInstaller.psm1
and check theGet-Help
results forInstall-ChocolateyPath
,Uninstall-ChocolateyPath
, and the other provided cmdlets. None of the cmdlets added/rewritten here should be missing help.There will be a related PR to the licensed extension repository with some additional instructions to confirm the command overriding behaviour works and inheritance from this new assembly can function correctly.
For documentation generation:
update-cmdlet-documentation.ps1
script, optionally providing the path to the docs repo folder with-DocsRepositoryPath
if it is cloned in a folder that is not../docs
relative to thechoco
repository.For the present I have included the XML rendition of the help in the repository, and I think it makes sufficient sense to just update this file whenever we need to; the markdown help can remain in the docs repository, and updating the XML help for this PowerShell module can be done as-needed and just committed to this repository.
The
Invoke-Tests.ps1
file should also run the included Pester tests for these commands.Operating Systems Testing
Win10
Change Types Made
Change Checklist
Related Issue
Fixes #310
Fixes #3318