[rubygems/rubygems] Add support for mise.toml file

https://github.com/rubygems/rubygems/commit/809a2a17a7
This commit is contained in:
Luiz Eduardo Kowalski 2024-12-23 11:50:46 -03:00 committed by git
parent adbbc9109e
commit 6e46b9b8b3
2 changed files with 16 additions and 3 deletions

View File

@ -42,9 +42,9 @@ module Bundler
# Loads the file relative to the dirname of the Gemfile itself.
def normalize_ruby_file(filename)
file_content = Bundler.read_file(gemfile.dirname.join(filename))
# match "ruby-3.2.2" or "ruby 3.2.2" capturing version string up to the first space or comment
if /^ruby(-|\s+)([^\s#]+)/.match(file_content)
$2
# match "ruby-3.2.2", ruby = "3.2.2" or "ruby 3.2.2" capturing version string up to the first space or comment
if /^ruby[\s-]*(?:=\s*)?"?([^\s#"]+)"?/.match(file_content)
$1
else
file_content.strip
end

View File

@ -172,6 +172,19 @@ RSpec.describe Bundler::RubyDsl do
end
end
context "with a mise.toml file format" do
let(:file) { "mise.toml" }
let(:ruby_version_arg) { nil }
let(:file_content) do
<<~TOML
[tools]
ruby = "#{version}"
TOML
end
it_behaves_like "it stores the ruby version"
end
context "with a .tool-versions file format" do
let(:file) { ".tool-versions" }
let(:ruby_version_arg) { nil }