Minor improvements for macOS Documentation (#6721)

* Minor improvements

* fix typos

* fix brew rendering
This commit is contained in:
Maxim Lobanov
2022-12-08 19:14:16 +01:00
committed by GitHub
parent f28afb3069
commit 479d7175f6
3 changed files with 32 additions and 14 deletions

View File

@@ -1,3 +1,7 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion
function Get-BashVersion { function Get-BashVersion {
$version = bash -c 'echo ${BASH_VERSION}' $version = bash -c 'echo ${BASH_VERSION}'
return $version return $version
@@ -76,7 +80,7 @@ function Get-RustupVersion {
function Get-VcpkgVersion { function Get-VcpkgVersion {
$vcpkgVersion = Run-Command "vcpkg version" | Select-Object -First 1 | Take-Part -Part 5 | Take-Part -Part 0 -Delimiter "-" $vcpkgVersion = Run-Command "vcpkg version" | Select-Object -First 1 | Take-Part -Part 5 | Take-Part -Part 0 -Delimiter "-"
$commitId = git -C "/usr/local/share/vcpkg" rev-parse --short HEAD $commitId = git -C "/usr/local/share/vcpkg" rev-parse --short HEAD
return "$vcpkgVersion (build from master \<$commitId>)" return "$vcpkgVersion (build from commit $commitId)"
} }
function Get-GccVersions { function Get-GccVersions {
@@ -109,7 +113,7 @@ function Get-ClangLLVMVersions {
return @( return @(
[ToolNode]::new("Clang/LLVM", $defaultClangVersion) [ToolNode]::new("Clang/LLVM", $defaultClangVersion)
[ToolNode]::new("Clang/LLVM (Homebrew)", "$homebrewClangVersion - available on ```'$homebrewClangPath`'``") [ToolNode]::new("Clang/LLVM (Homebrew)", "$homebrewClangVersion - available on ``$homebrewClangPath``")
) )
} }
@@ -144,8 +148,8 @@ function Get-NVMNodeVersionList {
$nvmInitCommand = ". ${nvmPath} > /dev/null 2>&1 || true" $nvmInitCommand = ". ${nvmPath} > /dev/null 2>&1 || true"
$nodejsVersionsRaw = Run-Command "${nvmInitCommand} && nvm ls" $nodejsVersionsRaw = Run-Command "${nvmInitCommand} && nvm ls"
$nodeVersions = $nodejsVersionsRaw | ForEach-Object { $_.TrimStart(" ").TrimEnd(" *") } | Where-Object { $_.StartsWith("v") } $nodeVersions = $nodejsVersionsRaw | ForEach-Object { $_.TrimStart(" ").TrimEnd(" *") } | Where-Object { $_.StartsWith("v") }
$result = [string]::Join(" ", $nodeVersions) $formattedNodeVersions = $nodeVersions | ForEach-Object { $_.TrimStart("v") }
return $result return [string]::Join(" ", $formattedNodeVersions)
} }
function Build-OSInfoSection { function Build-OSInfoSection {
@@ -156,29 +160,36 @@ function Build-OSInfoSection {
$fieldsToInclude = @("System Version:", "Kernel Version:") $fieldsToInclude = @("System Version:", "Kernel Version:")
$rawSystemInfo = Invoke-Expression "system_profiler SPSoftwareDataType" $rawSystemInfo = Invoke-Expression "system_profiler SPSoftwareDataType"
$parsedSystemInfo = $rawSystemInfo | Where-Object { -not ($_ | Select-String -NotMatch $fieldsToInclude) } | ForEach-Object { $_.Trim() } $parsedSystemInfo = $rawSystemInfo | Where-Object { -not ($_ | Select-String -NotMatch $fieldsToInclude) } | ForEach-Object { $_.Trim() }
$parsedSystemInfo[0] -match "System Version: macOS (?<version>\d+\.\d+)" | Out-Null if ($os.IsCatalina) {
$parsedSystemInfo[0] -match "System Version: macOS (?<version>\d+\.\d+)" | Out-Null
} else {
$parsedSystemInfo[0] -match "System Version: macOS (?<version>\d+)" | Out-Null
}
$version = $Matches.Version $version = $Matches.Version
$systemVersion = $parsedSystemInfo[0].Replace($fieldsToInclude[0],"").Trim() $systemVersion = $parsedSystemInfo[0].Replace($fieldsToInclude[0],"").Trim()
$kernelVersion = $parsedSystemInfo[1].Replace($fieldsToInclude[1],"").Trim() $kernelVersion = $parsedSystemInfo[1].Replace($fieldsToInclude[1],"").Trim()
$osInfoNode = [HeaderNode]::new("macOS $version info") $osInfoNode = [HeaderNode]::new("macOS $version")
$osInfoNode.AddToolNode("System Version:", $systemVersion) $osInfoNode.AddToolNode("System Version:", $systemVersion)
$osInfoNode.AddToolNode("Kernel Version:", $kernelVersion) $osInfoNode.AddToolNode("Kernel Version:", $kernelVersion)
$osInfoNode.AddToolNode("Image Version:", $ImageName.Split('_')[1]) $osInfoNode.AddToolNode("Image Version:", $ImageName.Split('_')[1])
return $osInfoNode return $osInfoNode
} }
function Get-MonoVersion {
$monoVersion = mono --version | Out-String | Take-Part -Part 4
return $monoVersion
}
function Get-MSBuildVersion { function Get-MSBuildVersion {
$msbuildVersion = msbuild -version | Select-Object -Last 1 $msbuildVersion = msbuild -version | Select-Object -Last 1
$result = Select-String -Path (Get-Command msbuild).Source -Pattern "msbuild" $monoVersion = Get-MonoVersion
$result -match "(?<path>\/\S*\.dll)" | Out-Null return "$msbuildVersion (Mono $monoVersion)"
$msbuildPath = $Matches.path
return "$msbuildVersion (from $msbuildPath)"
} }
function Get-NodeVersion { function Get-NodeVersion {
$nodeVersion = Run-Command "node --version" $nodeVersion = Run-Command "node --version"
return $nodeVersion return $nodeVersion.TrimStart("v")
} }
function Get-PerlVersion { function Get-PerlVersion {
@@ -213,7 +224,7 @@ function Get-JuliaVersion {
function Get-BundlerVersion { function Get-BundlerVersion {
$bundlerVersion = Run-Command "bundle --version" $bundlerVersion = Run-Command "bundle --version"
return ($bundlerVersion -replace "^Bundler").Trim() return ($bundlerVersion -replace "^Bundler version").Trim()
} }
function Get-CarthageVersion { function Get-CarthageVersion {

View File

@@ -39,6 +39,7 @@ $languageAndRuntime.AddNodes($(Get-FortranVersions))
$languageAndRuntime.AddToolNode("Go", $(Get-GoVersion)) $languageAndRuntime.AddToolNode("Go", $(Get-GoVersion))
$languageAndRuntime.AddToolNode("Julia", $(Get-JuliaVersion)) $languageAndRuntime.AddToolNode("Julia", $(Get-JuliaVersion))
$languageAndRuntime.AddToolNode("Kotlin", $(Get-KotlinVersion)) $languageAndRuntime.AddToolNode("Kotlin", $(Get-KotlinVersion))
$languageAndRuntime.AddToolNode("Mono", $(Get-MonoVersion))
$languageAndRuntime.AddToolNode("MSBuild", $(Get-MSBuildVersion)) $languageAndRuntime.AddToolNode("MSBuild", $(Get-MSBuildVersion))
$languageAndRuntime.AddToolNode("Node.js", $(Get-NodeVersion)) $languageAndRuntime.AddToolNode("Node.js", $(Get-NodeVersion))
$languageAndRuntime.AddToolNode("NVM", $(Get-NVMVersion)) $languageAndRuntime.AddToolNode("NVM", $(Get-NVMVersion))

View File

@@ -166,8 +166,14 @@ function Build-XcodeSDKTable {
} }
function Format-XcodeSimulatorName { function Format-XcodeSimulatorName {
param([Parameter(Mandatory)][string] $Device) param(
return $Device.Replace("ʀ", "R") [Parameter(Mandatory)][string] $Device
)
$formattedDeviceName = $Device.Replace("ʀ", "R")
# Convert "Apple Watch Series 5 (44mm)" -> "Apple Watch Series 5 - 44mm" to make all Xcode versions consistent
$formattedDeviceName = $formattedDeviceName -replace '\((\d+mm)\)', '- $1'
return $formattedDeviceName
} }
function Build-XcodeSimulatorsTable { function Build-XcodeSimulatorsTable {