resolve bugs around versioning

added version caching
This commit is contained in:
Kevin Marquette
2018-08-20 02:11:14 -07:00
parent de13e31542
commit 996b2d9195
2 changed files with 67 additions and 46 deletions

View File

@@ -1,20 +1,21 @@
funciton ImportModule
function ImportModule
{
param(
[string]$path,
[switch]$PassThru
)
$file = Get-ChildItem $path
$name = $file.BaseName
if (-not(Test-Path -Path $path))
{
"Cannot find [$($path.fullname)]."
Write-Error -Message "Could not find module manifest [$($path.fullname)]"
"Cannot find [$path]."
Write-Error -Message "Could not find module manifest [$path]"
}
else
{
$file = Get-Item $path
$name = $file.BaseName
$loaded = Get-Module -Name $name -All -ErrorAction Ignore
if ($loaded)
{
@@ -22,8 +23,8 @@ funciton ImportModule
$loaded | Remove-Module -Force
}
"Importing Module [$name] from [$($path.fullname)]..."
Import-Module -FullyQualifiedName $path.fullname -Force -PassThru:$PassThru
"Importing Module [$name] from [$($file.fullname)]..."
Import-Module -Name $file.fullname -Force -PassThru:$PassThru
}
}