Open beargle opened 6 years ago
@beargle Any chance you could look at using the method shown here: https://github.com/proxb/PoshRSJob/issues/177#issuecomment-371038089? It would be nice to keep all module importing down to a single parameter if possible. If it doesn't work out though, I can move forward to accept this PR.
@proxb Sure, I saw the comment, but am not sold on readability of pre-processing module paths before passing to Start-RSJob
.
It seems more intuitive to be able to pass a single "root" module path, so that everything (properly organized as importable, of course) gets loaded into the runspace jobs.
I totally get the usability issue with having two parameters that could be used for module import...do you think it would be confusing to wrap functionality of both InitialSessionState.ImportPSModule and InitialSessionState.ImportPSModulesFromPath into the single -ModulesToImport
parameter?
do you think it would be confusing to wrap functionality of both InitialSessionState.ImportPSModule and InitialSessionState.ImportPSModulesFromPath into the single -ModulesToImport parameter?
@beargle I think that would be a better way to go at least to support both the module name and module path requirement even though it will require a little more work to handle both of the possible values being supplied to the parameter. While I get the ease of just supplying a single root math containing all of the modules, I'm just not sure about having multiple module import parameters.
@proxb Makes sense, I've consolidated the module path import into existing -ModulesToImport
parameter, and updated the original PR text. It should accept these different ways of specifying modules for import:
Start-RSJob -ModulesToImport "PSDeploy"...
Start-RSJob -ModulesToImport ".\PSDeploy\PSDeploy.psd1"...
Start-RSJob -ModulesToImport ".\workspace\Modules"...
Start-RSJob -ModulesToImport "PSDeploy", ".\workspace\Modules"...
Let me know your thoughts, thanks!
Add
Start-RSJob
parameterModulesFromPathToImport
that accepts a single path, from which module(s) will be imported into background runspace jobs. Modules in this path are not required to be listed by name, and the path does not have to exist in$env:PSModulePath
. Fixes #177.Changes proposed in this pull request:
Start-RSJob
parameter-ModulesFromPathToImport
How to test this code: The snippet below allows manual verification of
Get-Module
output when either a full or relative module path name is passed. I'm relatively new to Pester, but would like to learn if someone has suggestions on how to setup the automated test cases.Has been tested on (remove any that don't apply):