Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 192 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,188 @@
}
}
},
{
"label": "InvokePester: PowerShell 7.3",
"type": "shell",
"command": "Set-Location ${workspaceFolder}; . ./tests/PesterConfiguration.ps1; Invoke-Pester -Configuration $PesterConfiguration",
"group": {
"kind": "test",
"isDefault": false
},
"problemMatcher": [
"$pester"
],
"presentation": {
"echo": false,
"reveal": "always",
"focus": true,
"panel": "dedicated",
"showReuseMessage": false,
"clear": true
},
"options": {
"shell": {
"executable": "C:/Program Files/PowerShell/7.3/pwsh.exe",
"args": ["-Command"]
}
}
},
{
"label": "InvokePester: PowerShell 7.2",
"type": "shell",
"command": "Set-Location ${workspaceFolder}; . ./tests/PesterConfiguration.ps1; Invoke-Pester -Configuration $PesterConfiguration",
"group": {
"kind": "test",
"isDefault": false
},
"problemMatcher": [
"$pester"
],
"presentation": {
"echo": false,
"reveal": "always",
"focus": true,
"panel": "dedicated",
"showReuseMessage": false,
"clear": true
},
"options": {
"shell": {
"executable": "C:/Program Files/PowerShell/7.2/pwsh.exe",
"args": ["-Command"]
}
}
},
{
"label": "InvokePester: PowerShell 7.1",
"type": "shell",
"command": "Set-Location ${workspaceFolder}; . ./tests/PesterConfiguration.ps1; Invoke-Pester -Configuration $PesterConfiguration",
"group": {
"kind": "test",
"isDefault": false
},
"problemMatcher": [
"$pester"
],
"presentation": {
"echo": false,
"reveal": "always",
"focus": true,
"panel": "dedicated",
"showReuseMessage": false,
"clear": true
},
"options": {
"shell": {
"executable": "C:/Program Files/PowerShell/7.1/pwsh.exe",
"args": ["-Command"]
}
}
},
{
"label": "InvokePester: PowerShell 7.0",
"type": "shell",
"command": "Set-Location ${workspaceFolder}; . ./tests/PesterConfiguration.ps1; Invoke-Pester -Configuration $PesterConfiguration",
"group": {
"kind": "test",
"isDefault": false
},
"problemMatcher": [
"$pester"
],
"presentation": {
"echo": false,
"reveal": "always",
"focus": true,
"panel": "dedicated",
"showReuseMessage": false,
"clear": true
},
"options": {
"shell": {
"executable": "C:/Program Files/PowerShell/7.0/pwsh.exe",
"args": ["-Command"]
}
}
},
{
"label": "InvokePester: PowerShell 6.2",
"type": "shell",
"command": "Set-Location ${workspaceFolder}; . ./tests/PesterConfiguration.ps1; Invoke-Pester -Configuration $PesterConfiguration",
"group": {
"kind": "test",
"isDefault": false
},
"problemMatcher": [
"$pester"
],
"presentation": {
"echo": false,
"reveal": "always",
"focus": true,
"panel": "dedicated",
"showReuseMessage": false,
"clear": true
},
"options": {
"shell": {
"executable": "C:/Program Files/PowerShell/6.2/pwsh.exe",
"args": ["-Command"]
}
}
},
{
"label": "InvokePester: PowerShell 6.1",
"type": "shell",
"command": "Set-Location ${workspaceFolder}; . ./tests/PesterConfiguration.ps1; Invoke-Pester -Configuration $PesterConfiguration",
"group": {
"kind": "test",
"isDefault": false
},
"problemMatcher": [
"$pester"
],
"presentation": {
"echo": false,
"reveal": "always",
"focus": true,
"panel": "dedicated",
"showReuseMessage": false,
"clear": true
},
"options": {
"shell": {
"executable": "C:/Program Files/PowerShell/6.1/pwsh.exe",
"args": ["-Command"]
}
}
},
{
"label": "InvokePester: PowerShell 6.0",
"type": "shell",
"command": "Set-Location ${workspaceFolder}; . ./tests/PesterConfiguration.ps1; Invoke-Pester -Configuration $PesterConfiguration",
"group": {
"kind": "test",
"isDefault": false
},
"problemMatcher": [
"$pester"
],
"presentation": {
"echo": false,
"reveal": "always",
"focus": true,
"panel": "dedicated",
"showReuseMessage": false,
"clear": true
},
"options": {
"shell": {
"executable": "C:/Program Files/PowerShell/6.0/pwsh.exe",
"args": ["-Command"]
}
}
},
{
"label": "InvokePester: Windows PowerShell 5.1",
"type": "shell",
Expand Down Expand Up @@ -134,6 +316,16 @@
},
"problemMatcher": "$pester"
},
{
"label": "InvokePester: Overall Test",
"dependsOn":["InvokePester: PowerShell 7.6", "InvokePester: PowerShell 7.5", "InvokePester: PowerShell 7.4", "InvokePester: PowerShell 7.3", "InvokePester: PowerShell 7.2", "InvokePester: PowerShell 7.1", "InvokePester: PowerShell 7.0", "InvokePester: PowerShell 6.2", "InvokePester: PowerShell 6.1", "InvokePester: PowerShell 6.0", "InvokePester: Windows PowerShell 5.1"],
"dependsOrder": "parallel",
"group": {
"kind": "test",
"isDefault": false
},
"problemMatcher": "$pester"
},
{
"label": "UpdateHelp",
"type": "shell",
Expand Down
2 changes: 1 addition & 1 deletion DiskSmartInfo.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RootModule = 'DiskSmartInfo.psm1'

# Version number of this module.
ModuleVersion = '3.0'
ModuleVersion = '3.0.1'

# Supported PSEditions
CompatiblePSEditions = @('Core', 'Desktop')
Expand Down
2 changes: 1 addition & 1 deletion functions/DiskSmartAttributeDescription.functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-DiskSmartAttributeDescription
[ValidateRange(1, 255)]
[int[]]$AttributeID,
[Parameter(Position=1)]
[ValidatePattern("^(0?[1-9A-F])|([1-9A-F])([0-9A-F])$")]
[ValidatePattern('^(0?[1-9A-F])|([1-9A-F])([0-9A-F])$')]
[string[]]$AttributeIDHex,
[Parameter(Position=2)]
[ArgumentCompleter([AttributeNameCompleter])]
Expand Down
8 changes: 4 additions & 4 deletions functions/DiskSmartInfo.completers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AttributeNameCompleter : IArgumentCompleter
$attributeNames = $Script:descriptions.AttributeName
}

$result = New-Object -TypeName "System.Collections.Generic.List[CompletionResult]"
$result = New-Object -TypeName 'System.Collections.Generic.List[CompletionResult]'

[System.Collections.Generic.List[String]]$valuesToExclude = $null

Expand Down Expand Up @@ -66,7 +66,7 @@ class AttributeNameCompleter : IArgumentCompleter
$id = ($Script:descriptions.Find([Predicate[PSCustomObject]]{$args[0].AttributeName -eq $completionResult})).AttributeID
}

if ($completionResult.Contains(" "))
if ($completionResult.Contains(' '))
{
$result.Add([CompletionResult]::new("'$completionResult'", $completionResult, [CompletionResultType]::ParameterValue, "${id}: $completionResult"))
}
Expand All @@ -90,7 +90,7 @@ class DiskCompleter : IArgumentCompleter
[System.Collections.IDictionary] $fakeBoundParameters
)
{
$result = New-Object -TypeName "System.Collections.Generic.List[CompletionResult]"
$result = New-Object -TypeName 'System.Collections.Generic.List[CompletionResult]'
[System.Collections.Generic.List[String]]$valuesToExclude = $null

$instanceParameters = @{
Expand Down Expand Up @@ -201,7 +201,7 @@ class DiskCompleter : IArgumentCompleter
if ($completionResult -like "$wordToComplete*" -and $completionResult -notin $valuesToExclude)
{
$index = ($diskDrives.Where{$_.Model -eq $completionResult}).Index
if ($completionResult.Contains(" "))
if ($completionResult.Contains(' '))
{
$result.Add([CompletionResult]::new("'$completionResult'", $completionResult, [CompletionResultType]::ParameterValue, "${index}: $completionResult"))
}
Expand Down
6 changes: 3 additions & 3 deletions functions/DiskSmartInfo.functions.archive.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function inUpdateArchive

if ($attributes)
{
$hash.Add("SmartData", $attributes)
$hash.Add('SmartData', $attributes)
$archiveData.Add([PSCustomObject]$hash)
}
}
Expand Down Expand Up @@ -81,7 +81,7 @@ function inGetArchiveDataFileName
$filename = "localhost$($dateTime.ToString('_yyyy-MM-dd_HH-mm-ss')).json"
}

if ($IsCoreCLR)
if ($IsCoreCLR -and ($PSVersionTable.PSVersion.Major -ge 7 -or $PSVersionTable.PSVersion.Minor -ge 1))
{
if ([System.IO.Path]::IsPathFullyQualified($Config.ArchivePath))
{
Expand All @@ -92,7 +92,7 @@ function inGetArchiveDataFileName
$folder = Join-Path -Path (Split-Path -Path $PSScriptRoot) -ChildPath $Config.ArchivePath
}
}
# .NET Framework version 4 and lower does not have [System.IO.Path]::IsPathFullyQualified method
# .NET Framework 4 (Windows PowerShell 5.1) and .NET Core 2.0 (PowerShell 6.0) and lower do not have [System.IO.Path]::IsPathFullyQualified method
else
{
$pathroot = [System.IO.Path]::GetPathRoot($Config.ArchivePath)
Expand Down
10 changes: 5 additions & 5 deletions functions/DiskSmartInfo.functions.history.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function inUpdateHistoricalData

if ($attributes)
{
$hash.Add("SmartData", $attributes)
$hash.Add('SmartData', $attributes)
$historicalData.Add([PSCustomObject]$hash)
}
}
Expand Down Expand Up @@ -69,11 +69,11 @@ function inGetHistoricalData
{
$sourceHostHistoricalData = ConvertFrom-Json -InputObject $historicalDataFileContent

if ($IsCoreCLR)
if ($IsCoreCLR -and (($PSVersionTable.PSVersion.Major -eq 7 -and $PSVersionTable.PSVersion.Minor -ge 2) -or $PSVersionTable.PSVersion.Major -gt 7))
{
$timestamp = $sourceHostHistoricalData.TimeStamp
}
# Windows PowerShell 5.1 ConvertTo-Json converts DateTime objects differently
# Windows PowerShell 5.1 and PowerShell < 7.2 ConvertTo-Json converts DateTime objects differently
else
{
$timestamp = $sourceHostHistoricalData.TimeStamp.DateTime
Expand Down Expand Up @@ -172,7 +172,7 @@ function inGetHistoricalDataFileName
$filename = 'localhost.json'
}

if ($IsCoreCLR)
if ($IsCoreCLR -and ($PSVersionTable.PSVersion.Major -ge 7 -or $PSVersionTable.PSVersion.Minor -ge 1))
{
if ([System.IO.Path]::IsPathFullyQualified($Config.DataHistoryPath))
{
Expand All @@ -183,7 +183,7 @@ function inGetHistoricalDataFileName
$folder = Join-Path -Path (Split-Path -Path $PSScriptRoot) -ChildPath $Config.DataHistoryPath
}
}
# .NET Framework version 4 and lower does not have [System.IO.Path]::IsPathFullyQualified method
# .NET Framework 4 (Windows PowerShell 5.1) and .NET Core 2.0 (PowerShell 6.0) and lower do not have [System.IO.Path]::IsPathFullyQualified method
else
{
$pathroot = [System.IO.Path]::GetPathRoot($Config.DataHistoryPath)
Expand Down
Loading