[rubygems/rubygems] Fix bundle platform
crash when there's a lockfile with no Ruby locked
https://github.com/rubygems/rubygems/commit/49fc54e87d
This commit is contained in:
parent
f6d4d73abd
commit
b87ddd7538
@ -9,7 +9,7 @@ module Bundler
|
|||||||
|
|
||||||
def run
|
def run
|
||||||
platforms, ruby_version = Bundler.ui.silence do
|
platforms, ruby_version = Bundler.ui.silence do
|
||||||
locked_ruby_version = Bundler.locked_gems && Bundler.locked_gems.ruby_version.gsub(/p\d+\Z/, "")
|
locked_ruby_version = Bundler.locked_gems && Bundler.locked_gems.ruby_version&.gsub(/p\d+\Z/, "")
|
||||||
gemfile_ruby_version = Bundler.definition.ruby_version && Bundler.definition.ruby_version.single_version_string
|
gemfile_ruby_version = Bundler.definition.ruby_version && Bundler.definition.ruby_version.single_version_string
|
||||||
[Bundler.definition.platforms.map {|p| "* #{p}" },
|
[Bundler.definition.platforms.map {|p| "* #{p}" },
|
||||||
locked_ruby_version || gemfile_ruby_version]
|
locked_ruby_version || gemfile_ruby_version]
|
||||||
|
@ -234,6 +234,29 @@ G
|
|||||||
expect(out).to eq("ruby 1.0.0")
|
expect(out).to eq("ruby 1.0.0")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "handles when there is a lockfile with no requirement" do
|
||||||
|
gemfile <<-G
|
||||||
|
source "#{file_uri_for(gem_repo1)}"
|
||||||
|
G
|
||||||
|
|
||||||
|
lockfile <<-L
|
||||||
|
GEM
|
||||||
|
remote: #{file_uri_for(gem_repo1)}/
|
||||||
|
specs:
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
|
||||||
|
bundle "platform --ruby"
|
||||||
|
expect(out).to eq("No ruby version specified")
|
||||||
|
end
|
||||||
|
|
||||||
it "handles when there is a requirement in the gemfile" do
|
it "handles when there is a requirement in the gemfile" do
|
||||||
gemfile <<-G
|
gemfile <<-G
|
||||||
source "#{file_uri_for(gem_repo1)}"
|
source "#{file_uri_for(gem_repo1)}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user