Skip to content

Commit 143eda2

Browse files
Create SoftwareReport.Toolcache.psm1
1 parent a8951f1 commit 143eda2

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
2+
3+
function Get-ToolcacheRubyVersions {
4+
$toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Ruby"
5+
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
6+
}
7+
8+
function Get-ToolcachePythonVersions {
9+
$toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Python"
10+
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
11+
}
12+
13+
function Get-ToolcacheNodeVersions {
14+
$toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Node"
15+
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
16+
}
17+
18+
function Get-ToolcacheGoVersions {
19+
$toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Go"
20+
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
21+
}
22+
23+
function Build-ToolcacheSection {
24+
25+
$nodes = @()
26+
$nodes += @(
27+
[ToolVersionsListNode]::new("Ruby", $(Get-ToolcacheRubyVersions), '^\d+\.\d+', "List")
28+
[ToolVersionsListNode]::new("Python", $(Get-ToolcachePythonVersions), '^\d+\.\d+', "List"),
29+
[ToolVersionsListNode]::new("Node.js", $(Get-ToolcacheNodeVersions), '^\d+', "List"),
30+
[ToolVersionsListNode]::new("Go", $(Get-ToolcacheGoVersions), '^\d+\.\d+', "List")
31+
)
32+
33+
return $nodes
34+
}
35+
36+
function Get-PowerShellModules {
37+
$modules = ((Get-ToolsetContent).powershellModules).name
38+
$modules | ForEach-Object {
39+
$moduleName = $_
40+
$moduleVersions = Get-Module -Name $moduleName -ListAvailable | Select-Object -ExpandProperty Version | Sort-Object -Unique
41+
return [ToolVersionsListNode]::new($moduleName, $moduleVersions, '^\d+', "Inline")
42+
}
43+
}

0 commit comments

Comments
 (0)