chocolatey / Chocolatey.Cake.Recipe

A set of convention based Cake scripts for building Chocolatey projects
Apache License 2.0
5 stars 9 forks source link

(#130) Install PowerShell Module to Current User instead of System #141

Closed corbob closed 2 months ago

corbob commented 3 months ago

Description Of Changes

Update the code that installs the PSScriptAnalyzer module to ensure the NuGet Package Provider is installed and correctly loaded for the CurrentUser. This ensures the user running the build does not need to be running as an administrator, nor do they need to already have the NuGet Package Provider installed and up to date.

Motivation and Context

If a user has not previously installed Modules, they may not be able to use the Cake Recipe file as it may fail to install modules.

Testing

  1. Use the Vagrantfile in the Chocolatey/choco repository to stand up a fresh development environment.
  2. Run build.bat without being elevated from the chocolatey/choco repository.
  3. Note that it fails to install the PowerShell Script Analyzer module.
  4. Replace the install-module.ps1 file in the tools/Chocolatey.Cake.Recipe.0.26.3 directory with the one from this PR branch.
  5. Run build.bat without being elevated again.
  6. Note that it completes the build successfully.

Operating Systems Testing

Windows 10

Change Types Made

Change Checklist

Related Issue

gep13 commented 2 months ago

@corbob I have just taken this for a spin, and this looks good to me!