Skip to content

Commit 6e46b9b

Browse files
luizkowalskimatzbot
authored andcommitted
[rubygems/rubygems] Add support for mise.toml file
ruby/rubygems@809a2a17a7
1 parent adbbc91 commit 6e46b9b

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

lib/bundler/ruby_dsl.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def ruby(*ruby_version)
4242
# Loads the file relative to the dirname of the Gemfile itself.
4343
def normalize_ruby_file(filename)
4444
file_content = Bundler.read_file(gemfile.dirname.join(filename))
45-
# match "ruby-3.2.2" or "ruby 3.2.2" capturing version string up to the first space or comment
46-
if /^ruby(-|\s+)([^\s#]+)/.match(file_content)
47-
$2
45+
# match "ruby-3.2.2", ruby = "3.2.2" or "ruby 3.2.2" capturing version string up to the first space or comment
46+
if /^ruby[\s-]*(?:=\s*)?"?([^\s#"]+)"?/.match(file_content)
47+
$1
4848
else
4949
file_content.strip
5050
end

spec/bundler/bundler/ruby_dsl_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,19 @@ class MockDSL
172172
end
173173
end
174174

175+
context "with a mise.toml file format" do
176+
let(:file) { "mise.toml" }
177+
let(:ruby_version_arg) { nil }
178+
let(:file_content) do
179+
<<~TOML
180+
[tools]
181+
ruby = "#{version}"
182+
TOML
183+
end
184+
185+
it_behaves_like "it stores the ruby version"
186+
end
187+
175188
context "with a .tool-versions file format" do
176189
let(:file) { ".tool-versions" }
177190
let(:ruby_version_arg) { nil }

0 commit comments

Comments
 (0)