[rubygems/rubygems] Add support for mise.toml file
https://github.com/rubygems/rubygems/commit/809a2a17a7
This commit is contained in:
parent
adbbc9109e
commit
6e46b9b8b3
@ -42,9 +42,9 @@ module Bundler
|
|||||||
# Loads the file relative to the dirname of the Gemfile itself.
|
# Loads the file relative to the dirname of the Gemfile itself.
|
||||||
def normalize_ruby_file(filename)
|
def normalize_ruby_file(filename)
|
||||||
file_content = Bundler.read_file(gemfile.dirname.join(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
|
# 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#]+)/.match(file_content)
|
if /^ruby[\s-]*(?:=\s*)?"?([^\s#"]+)"?/.match(file_content)
|
||||||
$2
|
$1
|
||||||
else
|
else
|
||||||
file_content.strip
|
file_content.strip
|
||||||
end
|
end
|
||||||
|
@ -172,6 +172,19 @@ RSpec.describe Bundler::RubyDsl do
|
|||||||
end
|
end
|
||||||
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
|
context "with a .tool-versions file format" do
|
||||||
let(:file) { ".tool-versions" }
|
let(:file) { ".tool-versions" }
|
||||||
let(:ruby_version_arg) { nil }
|
let(:ruby_version_arg) { nil }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user