Skip to content

Commit 0b7b19d

Browse files
Justin GroteJustin Grote
authored andcommitted
Cleanups of semantic version
1 parent cd6044f commit 0b7b19d

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

ModuleFast.ps1

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,6 @@ function Get-ModuleFastPlan {
373373
}
374374
}
375375

376-
# Use invoke-webrequest outfile to save every modulespec to the modules directory
377-
378-
379-
# Parallel
380-
381376
function Install-ModuleFast {
382377
[CmdletBinding(SupportsShouldProcess)]
383378
param(
@@ -434,7 +429,7 @@ function Install-ModuleFast {
434429
Install-ModuleFastHelper @installHelperParams
435430
}
436431

437-
# #endregion Main
432+
#endregion Main
438433

439434
function Install-ModuleFastHelper {
440435
[CmdletBinding()]
@@ -506,7 +501,7 @@ function Install-ModuleFastHelper {
506501
#Named parameters require a hack so we will just do these in order
507502
ArgumentList = @(
508503
$context.Module.Name,
509-
$context.Module.Version, #TODO: Somehow use version from package, as this may not be normalized
504+
$context.Module.Version,
510505
$context.DownloadPath,
511506
$Destination
512507
)
@@ -588,9 +583,9 @@ class ModuleFastSpec : IComparable {
588583
}
589584

590585
#ModuleSpecification Compatible Aliases
591-
hidden [SemanticVersion]Get_RequiredVersion() { return $this.Required }
592-
hidden [SemanticVersion]Get_Version() { return $this.Min }
593-
hidden [SemanticVersion]Get_MaximumVersion() { return $this.Max }
586+
hidden [SemanticVersion]Get_RequiredVersion() { return [ModuleFastSpec]::ParseSemanticVersion($this.Required) }
587+
hidden [SemanticVersion]Get_Version() { return [ModuleFastSpec]::ParseSemanticVersion($this.Min) }
588+
hidden [SemanticVersion]Get_MaximumVersion() { return [ModuleFastSpec]::ParseSemanticVersion($this.Max) }
594589

595590
#Constructors
596591

@@ -1072,8 +1067,8 @@ function Find-LocalModule {
10721067
foreach ($modulePath in $modulePaths) {
10731068
if ($moduleSpec.Required) {
10741069
#We can speed up the search for explicit requiredVersion matches
1075-
#HACK: We assume a release version can satisfy a prerelease version constraint here.
1076-
$manifestPath = Join-Path $modulePath $ModuleSpec.Name $($ModuleSpec.Required) "$($ModuleSpec.Name).psd1"
1070+
$moduleVersion = $ModuleSpec.Version #We want to search using a nuget translated path
1071+
$manifestPath = Join-Path $modulePath $ModuleSpec.Name $moduleVersion "$($ModuleSpec.Name).psd1"
10771072
if ([File]::Exists($manifestPath)) { return $manifestPath }
10781073
} else {
10791074
#Get all the version folders for the moduleName

0 commit comments

Comments
 (0)