predictability-engine 0.11.5 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/setup.ps1 +58 -21
- data/lib/predictability_engine/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 16cf4b6b4c370fb56e77ced5289cebf2b67e235d9b7bf35c0b85ce00daa70c35
|
|
4
|
+
data.tar.gz: '080674ff5893d9c3dd52ac8db12354bef60a6d4b4dbd819d717e4c2d0afc56b6'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 23a796c824436791e64e306f4c60e5b240b4004fb4000ac39271a5f50f09aa5f6242fceba09899beee7c9d462b74eadc64d02ca308a118de6d06acc19a707960
|
|
7
|
+
data.tar.gz: cc39a09c796c223c8ce7d7cd84c446f145a81d661d0b0f322d94d8d99beaf96db9b3869a2cf72bf86616313ae7c51cda7ed082bec156c531e86809c08c3ed9a4
|
data/bin/setup.ps1
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
.SYNOPSIS
|
|
4
4
|
Bootstrap Ruby and the Predictability Engine on Windows.
|
|
5
5
|
.DESCRIPTION
|
|
6
|
-
|
|
7
|
-
then
|
|
6
|
+
Ensures Ruby 4.x + MSYS2 DevKit is installed (tries winget, Chocolatey, Scoop,
|
|
7
|
+
then a direct SHA256-verified download from GitHub Releases), then runs
|
|
8
|
+
gem install bundler, bundle install, and predictability-engine setup
|
|
8
9
|
(which handles Node.js, Playwright, and Chromium).
|
|
9
10
|
|
|
10
11
|
Invoke via the thin CMD wrapper: bin\setup.bat
|
|
@@ -29,36 +30,73 @@ function Get-RubyMajorVersion {
|
|
|
29
30
|
return $null
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
function Test-RubyAdequate {
|
|
34
|
+
$m = Get-RubyMajorVersion
|
|
35
|
+
return ($null -ne $m) -and ($m -ge $RequiredRubyMajor)
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
function Refresh-Path {
|
|
33
39
|
$machine = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine')
|
|
34
40
|
$user = [System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
35
41
|
$env:PATH = "$machine;$user"
|
|
36
42
|
}
|
|
37
43
|
|
|
44
|
+
function Install-RubyDirect {
|
|
45
|
+
param([string]$RubyVersion)
|
|
46
|
+
$tag = "RubyInstaller-$RubyVersion-1"
|
|
47
|
+
$exe = "rubyinstaller-devkit-$RubyVersion-1-x64.exe"
|
|
48
|
+
$baseUrl = "https://github.com/oneclick/rubyinstaller2/releases/download/$tag"
|
|
49
|
+
$tmp = Join-Path $env:TEMP $exe
|
|
50
|
+
|
|
51
|
+
Write-Host "==> Downloading Ruby $RubyVersion installer from GitHub Releases..."
|
|
52
|
+
Invoke-WebRequest -Uri "$baseUrl/$exe" -OutFile $tmp -UseBasicParsing
|
|
53
|
+
|
|
54
|
+
Write-Host "==> Verifying SHA256 checksum..."
|
|
55
|
+
$shaLines = (Invoke-WebRequest -Uri "$baseUrl/SHA256.txt" -UseBasicParsing).Content -split "`n"
|
|
56
|
+
$expected = ($shaLines | Where-Object { $_ -match [regex]::Escape($exe) } |
|
|
57
|
+
ForEach-Object { ($_ -split '\s+')[0] } | Select-Object -First 1).ToUpper()
|
|
58
|
+
$actual = (Get-FileHash $tmp -Algorithm SHA256).Hash.ToUpper()
|
|
59
|
+
if ($actual -ne $expected) {
|
|
60
|
+
Remove-Item $tmp -Force
|
|
61
|
+
throw "SHA256 mismatch for $exe`n Expected: $expected`n Got: $actual"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
Write-Host "==> Installing Ruby $RubyVersion (silent)..."
|
|
65
|
+
Start-Process -FilePath $tmp -ArgumentList '/verysilent /tasks="assocfiles,modpath"' -Wait
|
|
66
|
+
Remove-Item $tmp -Force
|
|
67
|
+
}
|
|
68
|
+
|
|
38
69
|
function Install-Ruby {
|
|
39
70
|
$rubyVersion = (Get-Content .ruby-version).Trim() -replace '^ruby-', ''
|
|
40
71
|
|
|
72
|
+
# Priority 1: winget (built into Windows 10 1809+ / Windows 11)
|
|
41
73
|
if (Get-Command winget -ErrorAction SilentlyContinue) {
|
|
42
|
-
Write-Host "==> Installing Ruby
|
|
74
|
+
Write-Host "==> Installing Ruby 4.x via winget..."
|
|
43
75
|
winget install --id RubyInstallerTeam.RubyWithDevKit.4 --source winget --silent --accept-package-agreements --accept-source-agreements
|
|
44
76
|
Refresh-Path
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
ERROR: winget not found. Install Ruby $rubyVersion manually:
|
|
49
|
-
|
|
50
|
-
Option 1 (Recommended):
|
|
51
|
-
Download Ruby+Devkit $rubyVersion-x64 from https://rubyinstaller.org/downloads/
|
|
52
|
-
Run the installer and check "Add Ruby to PATH".
|
|
77
|
+
if (Test-RubyAdequate) { return }
|
|
78
|
+
}
|
|
53
79
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
80
|
+
# Priority 2: Chocolatey
|
|
81
|
+
if (Get-Command choco -ErrorAction SilentlyContinue) {
|
|
82
|
+
Write-Host "==> Installing Ruby via Chocolatey..."
|
|
83
|
+
& choco install ruby --yes
|
|
84
|
+
Refresh-Path
|
|
85
|
+
if (Test-RubyAdequate) { return }
|
|
86
|
+
}
|
|
57
87
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
88
|
+
# Priority 3: Scoop
|
|
89
|
+
if (Get-Command scoop -ErrorAction SilentlyContinue) {
|
|
90
|
+
Write-Host "==> Installing Ruby via Scoop..."
|
|
91
|
+
& scoop install ruby
|
|
92
|
+
Refresh-Path
|
|
93
|
+
if (Test-RubyAdequate) { return }
|
|
61
94
|
}
|
|
95
|
+
|
|
96
|
+
# Priority 4: direct download from GitHub Releases with SHA256 verification
|
|
97
|
+
Write-Host "==> No package manager found — downloading Ruby directly..."
|
|
98
|
+
Install-RubyDirect -RubyVersion $rubyVersion
|
|
99
|
+
Refresh-Path
|
|
62
100
|
}
|
|
63
101
|
|
|
64
102
|
# ── Main ───────────────────────────────────────────────────────────────────────
|
|
@@ -73,12 +111,11 @@ if ($null -eq $major) {
|
|
|
73
111
|
Write-Host "==> Ruby $major.x found."
|
|
74
112
|
}
|
|
75
113
|
|
|
76
|
-
# Verify Ruby is reachable after install (
|
|
77
|
-
|
|
78
|
-
if ($null -eq $major -or $major -lt $RequiredRubyMajor) {
|
|
114
|
+
# Verify Ruby is reachable after install (PATH refresh may not propagate to parent shell)
|
|
115
|
+
if (-not (Test-RubyAdequate)) {
|
|
79
116
|
Write-Host @"
|
|
80
117
|
|
|
81
|
-
ERROR: Ruby is not in PATH after installation.
|
|
118
|
+
ERROR: Ruby $RequiredRubyMajor+ is not in PATH after installation.
|
|
82
119
|
Close this terminal, open a new one, and re-run: bin\setup.bat
|
|
83
120
|
"@
|
|
84
121
|
exit 1
|