diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 62d47590c..e8a98317f 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -102,7 +102,7 @@ function Get-GemVersion { $result = Get-CommandResult "gem --version" $result.Output -match "(?\d+\.\d+\.\d+)" | Out-Null $gemVersion = $Matches.version - return "Gem $gemVersion" + return "RubyGems $gemVersion" } function Get-MinicondaVersion { diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index a8654cb7e..ee7dc9948 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -144,6 +144,10 @@ if (-not (Test-IsUbuntu16)) { ) } +if (Test-IsUbuntu20) { + $toolsList += (Get-FastlaneVersion) +} + $markdown += New-MDList -Style Unordered -Lines ($toolsList | Sort-Object) $markdown += New-MDHeader "CLI Tools" -Level 3 diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index be10c2fac..e6650fca2 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -264,6 +264,11 @@ function Get-AWSSAMVersion { return "AWS SAM CLI $(sam --version | Take-OutputPart -Part -1)" } +function Get-FastlaneVersion { + $fastlaneVersion = fastlane --version | Select-String "^fastlane [0-9]" | Take-OutputPart -Part 1 + return "Fastlane $fastlaneVersion" +} + function Get-HubCliVersion { $hubVersion = hub --version | Select-String "hub version" | Take-OutputPart -Part 2 return "Hub CLI $hubVersion" diff --git a/images/linux/scripts/installers/ruby.sh b/images/linux/scripts/installers/ruby.sh index 06583260e..bd260a55d 100644 --- a/images/linux/scripts/installers/ruby.sh +++ b/images/linux/scripts/installers/ruby.sh @@ -1,13 +1,22 @@ #!/bin/bash -e ################################################################################ ## File: ruby.sh -## Desc: Installs Ruby requirements +## Desc: Installs Ruby requirements and ruby gems ################################################################################ source $HELPER_SCRIPTS/install.sh -sudo apt-get install ruby-full -sudo gem update --system +apt-get install ruby-full +gem update + +# Install ruby gems from toolset +gemsToInstall=$(get_toolset_value ".rubygems[] .name") +if [ -n "$gemsToInstall" ]; then + for gem in $gemsToInstall; do + echo "Installing gem $gem" + gem install $gem + done +fi # Install Ruby requirements apt-get install -y libz-dev openssl libssl-dev @@ -43,4 +52,6 @@ for TOOLSET_VERSION in ${TOOLSET_VERSIONS[@]}; do echo "Create complete file" touch $COMPLETE_FILE_PATH fi -done \ No newline at end of file +done + +invoke_tests "Tools" "Ruby" \ No newline at end of file diff --git a/images/linux/scripts/tests/Tools.Tests.ps1 b/images/linux/scripts/tests/Tools.Tests.ps1 index 8b2447307..e17b21d65 100644 --- a/images/linux/scripts/tests/Tools.Tests.ps1 +++ b/images/linux/scripts/tests/Tools.Tests.ps1 @@ -344,3 +344,26 @@ Describe "Python" { "$PythonCommand --version" | Should -ReturnZeroExitCode } } + +Describe "Ruby" { + $testCases = @("ruby", "gem") | ForEach-Object { @{RubyCommand = $_} } + + It "" -TestCases $testCases { + param ( + [string] $RubyCommand + ) + + "$RubyCommand --version" | Should -ReturnZeroExitCode + } + + $gemTestCases = (Get-ToolsetContent).rubygems | ForEach-Object { + @{gemName = $_.name} + } + + if ($gemTestCases) + { + It "Gem is installed" -TestCases $gemTestCases { + "gem list -i '^$gemName$'" | Should -MatchCommandOutput "true" + } + } +} \ No newline at end of file diff --git a/images/linux/toolsets/toolset-1604.json b/images/linux/toolsets/toolset-1604.json index 6985369b7..615570aed 100644 --- a/images/linux/toolsets/toolset-1604.json +++ b/images/linux/toolsets/toolset-1604.json @@ -278,5 +278,6 @@ "7.4", "8.0" ] - } + }, + "rubygems": [] } diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index 13158650a..c4c0fe7a2 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -281,5 +281,6 @@ "7.4", "8.0" ] - } + }, + "rubygems": [] } diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index 90d606e58..0566dc16e 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -255,5 +255,8 @@ "7.4", "8.0" ] - } + }, + "rubygems": [ + {"name": "fastlane"} + ] }