File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -282,3 +282,35 @@ function Show-FileContent {
282282 $lineNumber ++
283283 }
284284}
285+
286+ function Install-PSModule {
287+ <#
288+ . SYNOPSIS
289+ Installs a build PS module.
290+
291+ . DESCRIPTION
292+ Installs a build PS module.
293+
294+ . EXAMPLE
295+ Install-PSModule -SourceFolderPath $ModuleFolderPath -ModuleName $moduleName
296+
297+ Installs a module located at $ModuleFolderPath with the name $moduleName.
298+ #>
299+ [CmdletBinding ()]
300+ param (
301+ # Path to the folder where the module source code is located.
302+ [Parameter (Mandatory )]
303+ [string ] $ModulePath
304+ )
305+
306+ $moduleName = Split-Path - Path $ModulePath - Leaf
307+ $manifestFilePath = Join-Path - Path $ModulePath " $moduleName .psd1"
308+ Write-Verbose " - Manifest file path: [$manifestFilePath ]" - Verbose
309+ Resolve-PSModuleDependency - ManifestFilePath $manifestFilePath
310+ $PSModulePath = $env: PSModulePath -split [System.IO.Path ]::PathSeparator | Select-Object - First 1
311+ $codePath = New-Item - Path " $PSModulePath /$moduleName /999.0.0" - ItemType Directory - Force | Select-Object - ExpandProperty FullName
312+ Copy-Item - Path " $ModulePath /*" - Destination $codePath - Recurse - Force
313+ LogGroup ' Importing module' {
314+ Import-Module - Name $moduleName - Verbose
315+ }
316+ }
You can’t perform that action at this time.
0 commit comments