resolve bugs around versioning
added version caching
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user