Install PsGet module using the powershell_module resource
Steps to Reproduce:
Use the example as described in the README, e.g.
powershell_module "posh-git" do
package_name "posh-git"
source "https://github.com/dahlbyk/posh-git/zipball/master"
end
Expected Result:
The module should be installed in C:\Program Files\WindowsPowerShell\Modules\posh-git so that Windows PowerShell will find it when the command Import-Module posh-git is run.
Actual Result:
If the above example is run then the module is installed to C:\Program Files\WindowsPowerShell\Modules\dahlbyk-posh-git-fba883f so the Import-Module posh-git does not work.
I thought that the package_name attribute would correctly set the directory, but this does not appear to be the case.
The situation is improved slightly if the URL for a released zip is used, so the following:
powershell_module "posh-git" do
package_name "posh-git"
source "https://github.com/dahlbyk/posh-git/releases/tag/v0.6.1"
end
Will put the module in C:\Program Files\WindowsPowerShell\Modules\posh-git-0.6.1 so additional code could be written to move this to posh-git. This is a necessary step as the folder name must match the name of the PowerShell Data File in the module .psd1 file, if not then it will not be imported.
There is a work around that will allow a module to be imported, e.g.
But this breaks the auto importing that PowerShell can do when modules are in paths set in the $env:PSModulePath variable and is a pain to have to type.
Cookbook version
v0.6.1
Chef-client version
12.16.42
Platform Details
Windows 2012 R2 - Test Kitchen Vagrant
Scenario:
Install PsGet module using the
powershell_module
resourceSteps to Reproduce:
Use the example as described in the README, e.g.
Expected Result:
The module should be installed in
C:\Program Files\WindowsPowerShell\Modules\posh-git
so that Windows PowerShell will find it when the commandImport-Module posh-git
is run.Actual Result:
If the above example is run then the module is installed to
C:\Program Files\WindowsPowerShell\Modules\dahlbyk-posh-git-fba883f
so theImport-Module posh-git
does not work.I thought that the
package_name
attribute would correctly set the directory, but this does not appear to be the case.The situation is improved slightly if the URL for a released zip is used, so the following:
Will put the module in
C:\Program Files\WindowsPowerShell\Modules\posh-git-0.6.1
so additional code could be written to move this toposh-git
. This is a necessary step as the folder name must match the name of the PowerShell Data File in the module.psd1
file, if not then it will not be imported.There is a work around that will allow a module to be imported, e.g.
But this breaks the auto importing that PowerShell can do when modules are in paths set in the
$env:PSModulePath
variable and is a pain to have to type.