feat: pull ruby version from mise configuration (#339)

* docs: note that ruby version is sourced from mise

* feat: source ruby version from mise configuration

* test: test specific ruby version in integration tests, use mise-specified version

* test: snapshot update
This commit is contained in:
Michael Bianco
2025-11-12 16:23:05 -07:00
committed by GitHub
parent 13873cbc0e
commit 0971558869
11 changed files with 42 additions and 20 deletions
@@ -20,7 +20,8 @@
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
"/root/.local/state/mise",
"mise.toml"
],
"step": "packages:mise"
},
@@ -54,8 +55,8 @@
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libjemalloc-dev libyaml-dev'",
"customName": "install apt packages: libjemalloc-dev libyaml-dev"
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y cargo libjemalloc-dev libyaml-dev rustc'",
"customName": "install apt packages: cargo libjemalloc-dev libyaml-dev rustc"
}
],
"inputs": [
@@ -73,6 +74,10 @@
{
"path": "/mise/shims"
},
{
"dest": "mise.toml",
"src": "mise.toml"
},
{
"customName": "create mise config",
"name": "mise.toml",
+1 -1
View File
@@ -17,7 +17,7 @@ import (
const (
MisePackageStepName = "packages:mise"
// System-level config at /etc/mise/config.toml is auto-trusted by mise
MiseInstallCommand = "mise install"
MiseInstallCommand = "mise install"
)
// represents a app-local mise package
+2
View File
@@ -255,6 +255,8 @@ func (p *RubyProvider) InstallMisePackages(ctx *generate.GenerateContext, miseSt
miseStep.Version(ruby, gemfileVersion, "Gemfile")
}
miseStep.UseMiseVersions(ctx, []string{"ruby"})
miseStep.AddSupportingAptPackage("libyaml-dev")
miseStep.AddSupportingAptPackage("libjemalloc-dev")
version := p.getRubyVersion(ctx)
+2 -1
View File
@@ -19,7 +19,8 @@ The Ruby version is determined in the following order:
- Set via the `RAILPACK_RUBY_VERSION` environment variable
- Read from the `.ruby-version` file
- Read from the `Gemfile` file
- Defaults to `3.4.2`
- Read from mise-compatible version files (`.tool-versions`, `mise.toml`)
- Defaults to `3.4.6`
## Runtime Variables
+1
View File
@@ -4,3 +4,4 @@ else
yjit = "not enabled"
end
puts "Hello from Ruby 3! YJIT is #{yjit}."
puts "Ruby version: #{RUBY_VERSION}"
+6 -3
View File
@@ -1,5 +1,8 @@
[
{
"expectedOutput": "Hello from Ruby 3! YJIT is enabled."
}
{
"expectedOutput": [
"Hello from Ruby 3! YJIT is enabled.",
"Ruby version: 3.2.1"
]
}
]
+1
View File
@@ -1,6 +1,7 @@
require 'sinatra'
puts "Hello from Sinatra"
puts "Ruby version: #{RUBY_VERSION}"
get '/' do
'Choo Choo! Welcome to your Sinatra server 🚅'
+12 -9
View File
@@ -1,12 +1,15 @@
[
{
"expectedOutput": "Hello from Sinatra"
},
{
"httpCheck": {
"path": "/",
"expected": 200,
"internalPort": 4567
{
"expectedOutput": [
"Hello from Sinatra",
"Ruby version: 3.1.2"
]
},
{
"httpCheck": {
"path": "/",
"expected": 200,
"internalPort": 4567
}
}
}
]
+1
View File
@@ -1 +1,2 @@
puts "Hello from Ruby"
puts "Ruby version: #{RUBY_VERSION}"
+2
View File
@@ -0,0 +1,2 @@
[tools]
ruby = "3.3.0"
+6 -3
View File
@@ -1,5 +1,8 @@
[
{
"expectedOutput": "Hello from Ruby"
}
{
"expectedOutput": [
"Hello from Ruby",
"Ruby version: 3.3.0"
]
}
]