PSDeploy icon indicating copy to clipboard operation
PSDeploy copied to clipboard

[Suggestion] Using name instead of path parameter in PSGalleryModule deployment type

Open Geogboe opened this issue 6 years ago • 0 comments

Overview

When Publish-Module is invoked by this deployment type the path parameter is being used instead of the name param. The path param seems to require a directory and if you give it a directory that does not NOT match the name of your module ( for instance name Src ) or you give it the path to your module's psd1 you'll get errors like below:

Publish-Module : The specified path 'C:\dev\MyRepo\Src\MyModule.psd1' is not a valid directory.
At C:\Program Files\WindowsPowerShell\Modules\PSDeploy\1.0.1\PSDeployScripts\PSGalleryModule.ps1:54 char:9
+         Publish-Module @params
+         ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (...:String) [Publish-Module], ArgumentException
    + FullyQualifiedErrorId : PathIsNotADirectory,Publish-Module

or, if using the Src dir

Publish-Module : The specified module with path 'C:\dev\MyRepo\Src\` was not published because no valid module was found with that path.
At C:\Program Files\WindowsPowerShell\Modules\PSDeploy\1.0.1\PSDeployScripts\PSGalleryModule.ps1:54 char:9
+         Publish-Module @params
+         ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (..., ArgumentException
    + FullyQualifiedErrorId : InvalidModulePathToPublish,Publish-Module

https://github.com/RamblingCookieMonster/PSDeploy/blob/072a1bf5f7ece402c3a8fbbb1042c3c76c3ef85a/PSDeploy/PSDeployScripts/PSGalleryModule.ps1#L45

I could be missing something but it seems like an easy fix would just be to use name instead of path. The name param will accept a dir path, a name, or a file path. When I make this change locally, things work fine.

Thanks for all your work on this! Love this tool.

Geogboe avatar Sep 25 '18 20:09 Geogboe