Fix documentation for Python and Ruby on Windows images (#478)

* Remove separate Python installation for Windows

* Remove Python2 symlink creation

* Move install-ruby and install-python to download-toolcache

* Improve download-toolcache for windows

* Small fix in docs for ruby

* V mapetr/test alt toolcache docs (#8)

* Merge Validate-Ruby and Validate-Python with Validate-Toolcache

* Small fix in output

* Small fix in download toolcache output
This commit is contained in:
Maksim Petrov
2020-03-12 14:53:17 +03:00
committed by GitHub
parent a3ecb363d7
commit 161e8c26fd
9 changed files with 115 additions and 232 deletions

View File

@@ -63,6 +63,78 @@ function RunTestsByPath {
}
}
function Get-SystemDefaultPython {
Write-Host "Validate system Python..."
if (Get-Command -Name 'python')
{
Write-Host "Python $(& python -V 2>&1) on path"
}
else
{
Write-Host "Python is not on path"
exit 1
}
$pythonBinVersion = $(& python -V 2>&1)
if ($pythonBinVersion -notlike "Python 3.*")
{
Write-Error "Python 3 is not in the PATH"
exit 1
}
$pythonBinOnPath = Split-Path -Path (Get-Command -Name 'python').Path
$description = GetDefaultToolDescription -SoftwareVersion $pythonBinVersion -SoftwareLocation $pythonBinOnPath
return $description
}
function Get-SystemDefaultRuby {
Write-Host "Validate system Ruby..."
if (Get-Command -Name 'ruby')
{
Write-Host "$(ruby --version) is on the path."
}
else
{
Write-Host "Ruby is not on the path."
exit 1
}
$rubyBinOnPath = Split-Path -Path (Get-Command -Name 'ruby').Path
if ( $(ruby --version) -notmatch 'ruby (?<version>.*) \(.*' )
{
Write-Host "Unable to determine Ruby version at " + $rubyBinOnPath
exit 1
}
$rubyVersionOnPath = "Ruby $($Matches.version)"
$description = GetDefaultToolDescription -SoftwareVersion $rubyVersionOnPath -SoftwareLocation $rubyBinOnPath
$gemVersion = & gem -v
$description += "* Gem Version: $gemVersion<br/>"
return $description
}
function GetDefaultToolDescription {
param (
[Parameter(Mandatory = $True)]
[string]$SoftwareVersion,
[Parameter(Mandatory = $True)]
[string]$SoftwareLocation
)
$description = "<br/>__System default version:__ $SoftwareVersion<br/>"
$description += "_Environment:_<br/>"
$description += "* Location: $SoftwareLocation<br/>"
$description += "* PATH: contains the location of $SoftwareVersion<br/>"
return $description
}
function GetMarkdownDescription {
param (
[Parameter(Mandatory = $True)]
@@ -123,6 +195,14 @@ function ToolcacheTest {
$markdownDescription += GetMarkdownDescription -SoftwareVersion $foundVersion -SoftwareArchitecture $requiredArchitecture
}
}
if ($SoftwareName -contains "Python") {
$markdownDescription += Get-SystemDefaultPython
}
if ($SoftwareName -contains "Ruby") {
$markdownDescription += Get-SystemDefaultRuby
}
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $markdownDescription
}