|
| 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