Skip to content

Commit 360e2b7

Browse files
committed
appveyor: Try to execute bundler adjustment script
Suggested by @OwenMcDonnell. Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent 004c57e commit 360e2b7

File tree

2 files changed

+98
-1
lines changed

2 files changed

+98
-1
lines changed

appveyor.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@ for:
3838
matrix:
3939
only:
4040
- ruby_version: "31-x64"
41+
- ruby_version: "27-x64"
42+
- ruby_version: "27"
43+
- ruby_version: "26-x64"
44+
- ruby_version: "26"
4145
install:
46+
- ps: if ($ENV:ruby_version -ne "31-x64") { .\ruby_install.ps1 }
4247
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
4348
- ruby --version
4449
- gem --version
4550
- bundle --version
46-
- ridk.cmd install 1 3
51+
- ps: if ($ENV:ruby_version -eq "31-x64") { ridk.ps1 install 1 3 }
4752
- ridk.cmd exec bundle install
4853
- ridk.cmd exec bundle exec rake compile

ruby_install.ps1

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
$rubies = @(
2+
@{
3+
"version" = "Ruby 2.6.9-1"
4+
"install_path" = "C:\Ruby26"
5+
"download_url" = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.9-1/rubyinstaller-2.6.9-1-x86.exe"
6+
"devkit_url" = ""
7+
"devkit_paths" = @()
8+
"bundlerV2" = $true
9+
}
10+
@{
11+
"version" = "Ruby 2.6.9-1 (x64)"
12+
"install_path" = "C:\Ruby26-x64"
13+
"download_url" = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.9-1/rubyinstaller-2.6.9-1-x64.exe"
14+
"devkit_url" = ""
15+
"devkit_paths" = @()
16+
"bundlerV2" = $true
17+
}
18+
@{
19+
"version" = "Ruby 2.7.8-1"
20+
"install_path" = "C:\Ruby27"
21+
"download_url" = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.8-1/rubyinstaller-2.7.8-1-x86.exe"
22+
"devkit_url" = ""
23+
"devkit_paths" = @()
24+
"bundlerV2" = $true
25+
}
26+
@{
27+
"version" = "Ruby 2.7.8-1 (x64)"
28+
"install_path" = "C:\Ruby27-x64"
29+
"download_url" = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.8-1/rubyinstaller-2.7.8-1-x64.exe"
30+
"devkit_url" = ""
31+
"devkit_paths" = @()
32+
"bundlerV2" = $true
33+
}
34+
)
35+
36+
function UpdateRubyPath($rubyPath) {
37+
$env:path = ($env:path -split ';' | Where-Object { -not $_.contains('\Ruby') }) -join ';'
38+
$env:path = "$rubyPath;$env:path"
39+
}
40+
41+
function Install-Ruby($ruby) {
42+
Write-Host "Installing $($ruby.version)" -ForegroundColor Cyan
43+
44+
# uninstall existing
45+
$rubyUninstallPath = "$ruby.install_path\unins000.exe"
46+
if ([IO.File]::Exists($rubyUninstallPath)) {
47+
Write-Host " Uninstalling previous Ruby 2.4..." -ForegroundColor Gray
48+
"`"$rubyUninstallPath`" /silent" | out-file "$env:temp\uninstall-ruby.cmd" -Encoding ASCII
49+
& "$env:temp\uninstall-ruby.cmd"
50+
del "$env:temp\uninstall-ruby.cmd"
51+
Start-Sleep -s 5
52+
}
53+
54+
if (Test-Path $ruby.install_path) {
55+
Write-Host " Deleting $($ruby.install_path)" -ForegroundColor Gray
56+
Remove-Item $ruby.install_path -Force -Recurse
57+
}
58+
59+
$exePath = "$($env:TEMP)\rubyinstaller.exe"
60+
61+
Write-Host " Downloading $($ruby.version) from $($ruby.download_url)" -ForegroundColor Gray
62+
(New-Object Net.WebClient).DownloadFile($ruby.download_url, $exePath)
63+
64+
Write-Host "Installing..." -ForegroundColor Gray
65+
cmd /c start /wait $exePath /verysilent /allusers /dir="$($ruby.install_path.replace('\', '/'))" /tasks="noassocfiles,nomodpath,noridkinstall"
66+
del $exePath
67+
Write-Host "Installed" -ForegroundColor Green
68+
69+
# setup Ruby
70+
UpdateRubyPath "$($ruby.install_path)\bin"
71+
Write-Host "ruby --version" -ForegroundColor Gray
72+
cmd /c ruby --version
73+
74+
Write-Host "gem --version" -ForegroundColor Gray
75+
cmd /c gem --version
76+
77+
# list installed gems
78+
Write-Host "gem list --local" -ForegroundColor Gray
79+
cmd /c gem list --local
80+
81+
# delete temp path
82+
if ($tempPath) {
83+
Write-Host " Cleaning up..." -ForegroundColor Gray
84+
Remove-Item $tempPath -Force -Recurse
85+
}
86+
87+
Write-Host " Done!" -ForegroundColor Green
88+
}
89+
90+
for ($i = 0; $i -lt $rubies.Count; $i++) {
91+
Install-Ruby $rubies[$i]
92+
}

0 commit comments

Comments
 (0)