-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New PSGalleryModule with support for semver/VersionFilter/Pre-Release #96
Conversation
This should fix RamblingCookieMonster#68 adding Pre-release option Fix RamblingCookieMonster#65 by adding a filter like: `-gt 1.2 -and (-le 1.7 -or gt 2.0 )` Also supports SemVer1/2/NuGet2 versions and filter Should fix RamblingCookieMonster#44 by piping the module to Ipmo -force -scope global
I've changed and simplified the I think I'm now happy with this to be merged if you can confirm it's working as it should for you. |
Nice! I'll try to give this a quick review over the weekend, if all looks good will merge it in - thanks : D |
@gaelcolas, per #97, would recommend that if the version is pinned (not 'latest') and it already exists locally (checked with get-module), then skip the find-module step for a performance improvement. |
@gaelcolas Line 174 has Get-Module -Listavailable -All. It should just be Get-Module -Listavailable. -All returns every single module in the system (and loads all their DLLs) and it takes forever on a system with a lot of modules with no benefit. Here's the performance testing script I'm using, run it from the directory of your "new" test module remove-module psdepend -erroraction SilentlyContinue
$oldmodule = (get-module psdepend -listavailable | sort version -Descending)[0]
$psdependparams = @{
InputObject = @{
PSDependOptions = @{
Target = 'CurrentUser'
}
Pester = @{
Version = '4.4.2'
Parameters = @{
SkipPublisherCheck = $true
}
}
PowershellGet = @{
Version = '2.0.3'
Parameters = @{
SkipPublisherCheck = $true
}
}
BuildHelpers = '2.0.1'
'powershell-yaml' = '0.3.7'
'Microsoft.Powershell.Archive' = '1.2.2.0'
PSScriptAnalyzer = '1.17.1'
Plaster = '1.1.3'
}
Install = $true
Verbose = $true
}
$confirmpreference = 'none'
#Warmup
$m = ipmo $oldmodule -force -passthru
$cmd = get-command -module $m Invoke-psdepend
& $cmd @psdependparams
remove-module $m
#Test Old Module
$om = ipmo $oldmodule -force -PassThru -erroraction stop
$cmdold = get-command -module $om Invoke-psdepend
$oldtime = measure-command {& $cmdold @psdependparams} | % totalseconds
remove-module $om
#Test New Module (should be faster)
$nm = ipmo .\PSDepend.psd1 -force -PassThru -erroraction stop
$cmdnew = get-command -module $nm Invoke-psdepend
$newtime = measure-command {& $cmdnew @psdependparams} | % totalseconds
remove-module $nm
write-host -fore green "$($om.name) $($om.Version) (Old) Runtime - $oldtime"
write-host -fore green "$($nm.name) $($nm.Version) (New) Runtime - $newtime" |
Yeah, not on a PC ATM but iirc that is because only last version is returned with |
And by 'last version' I think it doesn't even comply with semver iirc... 🙄 Just doing a string compare... Like |
Hi Gael, Latest version is only returned if you don't use -listavailable. -listavailable returns all modules with the name in $psmodulepath -All looks for submodules, etc. which is not the point of PSDepend (for instance if a module has a submodule the same version I want, it will report as "installed" even if I can't call that directly). Thats why it has to load the module first and takes forever (try having all the Az modules on your system and running it) But yes, get-module in its current state in both WPS5.1 and PSCore6 is not prerelease-aware, you have to get the prerelease tag with
I'll take a look at your source branch and PR my recommendations |
-ListAvailable is also required when you want to list modules that aren't imported into the current session.
…________________________________
From: Justin Grote <[email protected]>
Sent: Tuesday, December 11, 2018 8:07:17 PM
To: RamblingCookieMonster/PSDepend
Cc: Subscribed
Subject: Re: [RamblingCookieMonster/PSDepend] New PSGalleryModule with support for semver/VersionFilter/Pre-Release (#96)
Hi Gael,
Latest version is only returned if you don't use -listavailable. -listavailable returns all modules with the name in $psmodulepath
-All looks for submodules, etc. which is not the point of PSDepend (for instance if a module has a submodule the same version I want, it will report as "installed" even if I can't call that directly). Thats why it has to load the module first and takes forever (try having all the Az modules on your system and running it)
But yes, get-module in its current state in both WPS5.1 and PSCore6 is not prerelease-aware, you have to get the prerelease tag with
(get-module powercd).privatedata.psdata.prerelease
I'll take a look at your source branch and PR my recommendations
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#96 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AQDqFphELawZGy22t-EJ_IWpNBadBipUks5u4BB1gaJpZM4Y7hHE>.
|
Worse than just this... In 5.1 (haven't checked for 6.x yet) you can't install a pre-release side by side with a normal release. You have to Will send an update soon-ish. |
@RamblingCookieMonster when will PSDepnd finally support prerelease versions of Powershell modules? @gaelcolas |
This should be closed. Was going the wrong way. Jaykul's approach is better |
Backward compatible.
This should fix #68 adding Pre-release option
Fix #65 by adding a filter like:
-gt 1.2 -and (-le 1.7 -or gt 2.0 )
Also supports SemVer1/2/NuGet2 versions and filter
Should fix #44 by piping the module to Ipmo -force -scope global
@RamblingCookieMonster might not be 100% for merging, but asking for feedback