Fixed perfromance and a bug
This commit is contained in:
parent
b0ec8e1780
commit
b1a24fde1a
|
@ -79,7 +79,12 @@ catch {
|
||||||
Join-Path $(Join-Path $PackagePath profile.d) 'classes.ps1' |
|
Join-Path $(Join-Path $PackagePath profile.d) 'classes.ps1' |
|
||||||
Where-Object { Test-Path $_ } | ForEach-Object { . $_ }
|
Where-Object { Test-Path $_ } | ForEach-Object { . $_ }
|
||||||
}
|
}
|
||||||
$local:myPackages = Get-MyPackages -ReturnFullPath -IncludeRoot | Get-Item
|
|
||||||
|
# This is a hack that for some reason reduces (at least on one machine)
|
||||||
|
# this next line from running over 27 seconds, to under 5 seconds.
|
||||||
|
Invoke-Expression "function __GetMyPackages{$(Get-Content $(Join-Path $(Join-Path $MyPSScriptRoot "base") "Get-MyPackages.ps1") | Out-String )}"
|
||||||
|
$local:myPackages = __GetMyPackages -ReturnFullPath -IncludeRoot | Get-Item
|
||||||
|
Remove-Item function:__GetMyPackages
|
||||||
|
|
||||||
$local:myAliases = [ordered]@{}
|
$local:myAliases = [ordered]@{}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ class Packagesz { #: System.Management.Automation.IValidateSetValuesGenerator {
|
||||||
$local:currentSys = [SystemName]::_GetValidValues('',$true,$true);
|
$local:currentSys = [SystemName]::_GetValidValues('',$true,$true);
|
||||||
$local:hostname = $(hostname)
|
$local:hostname = $(hostname)
|
||||||
$local:allCmdlets = Get-Command -ListImported | Select-Object -ExpandProperty Name -Unique
|
$local:allCmdlets = Get-Command -ListImported | Select-Object -ExpandProperty Name -Unique
|
||||||
$local:allModules = Get-Module -ListAvailable | Select-Object -ExpandProperty Name -Unique
|
|
||||||
|
|
||||||
$local:username = $( if( $env:USER ) { $env:USER } else { $env:USERNAME } )
|
$local:username = $( if( $env:USER ) { $env:USER } else { $env:USERNAME } )
|
||||||
|
|
||||||
|
@ -49,7 +48,7 @@ class Packagesz { #: System.Management.Automation.IValidateSetValuesGenerator {
|
||||||
$v = $v -and -not $($c.CmdletExists | Where-Object { $allCmdlets -notcontains $_ })
|
$v = $v -and -not $($c.CmdletExists | Where-Object { $allCmdlets -notcontains $_ })
|
||||||
}
|
}
|
||||||
if( $v -and $c.ModuleExists ) {
|
if( $v -and $c.ModuleExists ) {
|
||||||
$v = $v -and -not $($c.ModuleExists | Where-Object { $allModules -notcontains $_ })
|
$v = $v -and -not $($c.ModuleExists | Where-Object { -not (Get-Module -ListAvailable $_ -ErrorAction Ignore) })
|
||||||
}
|
}
|
||||||
if( $v -and $c.AppExeExists ) {
|
if( $v -and $c.AppExeExists ) {
|
||||||
$v = $v -and -not $($c.AppExeExists | Where-Object {
|
$v = $v -and -not $($c.AppExeExists | Where-Object {
|
||||||
|
|
Loading…
Reference in New Issue