1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[bundler/bundler] Update error messages to be more precise

9ddeeb1fe1
This commit is contained in:
David Rodríguez 2019-07-16 13:34:57 +02:00 committed by Hiroshi SHIBATA
parent f40914e3cf
commit cb6abf551a
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 14 additions and 14 deletions

View file

@ -87,7 +87,7 @@ m = Module.new do
require "bundler/version" require "bundler/version"
end end
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`" warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
exit 42 exit 42
end end

View file

@ -135,8 +135,8 @@ RSpec.describe "bundle binstubs <gem>" do
it "runs the correct version of bundler" do it "runs the correct version of bundler" do
sys_exec "#{bundled_app("bin/bundle")} install", "BUNDLER_VERSION" => "999.999.999" sys_exec "#{bundled_app("bin/bundle")} install", "BUNDLER_VERSION" => "999.999.999"
expect(exitstatus).to eq(42) if exitstatus expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (999.999.999) failed:"). expect(err).to include("Activating bundler (~> 999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`") and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
end end
end end
@ -145,8 +145,8 @@ RSpec.describe "bundle binstubs <gem>" do
lockfile lockfile.gsub(system_bundler_version, "999.999.999") lockfile lockfile.gsub(system_bundler_version, "999.999.999")
sys_exec "#{bundled_app("bin/bundle")} install" sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).to eq(42) if exitstatus expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (999.999.999) failed:"). expect(err).to include("Activating bundler (~> 999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`") and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
end end
it "runs the correct version of bundler when the version is older and a different major" do it "runs the correct version of bundler when the version is older and a different major" do
@ -154,8 +154,8 @@ RSpec.describe "bundle binstubs <gem>" do
lockfile lockfile.gsub(system_bundler_version, "44.0") lockfile lockfile.gsub(system_bundler_version, "44.0")
sys_exec "#{bundled_app("bin/bundle")} install" sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).to eq(42) if exitstatus expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (44.0) failed:"). expect(err).to include("Activating bundler (~> 44.0) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '44.0'`") and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 44.0'`")
end end
it "runs the available version of bundler when the version is older and the same major" do it "runs the available version of bundler when the version is older and the same major" do
@ -163,7 +163,7 @@ RSpec.describe "bundle binstubs <gem>" do
lockfile lockfile.gsub(system_bundler_version, "55.0") lockfile lockfile.gsub(system_bundler_version, "55.0")
sys_exec "#{bundled_app("bin/bundle")} install" sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).not_to eq(42) if exitstatus expect(exitstatus).not_to eq(42) if exitstatus
expect(err).not_to include("Activating bundler (55.0) failed:") expect(err).not_to include("Activating bundler (~> 55.0) failed:")
end end
it "runs the correct version of bundler when the version is a pre-release" do it "runs the correct version of bundler when the version is a pre-release" do
@ -171,8 +171,8 @@ RSpec.describe "bundle binstubs <gem>" do
lockfile lockfile.gsub(system_bundler_version, "2.12.0.a") lockfile lockfile.gsub(system_bundler_version, "2.12.0.a")
sys_exec "#{bundled_app("bin/bundle")} install" sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).to eq(42) if exitstatus expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (2.12.0.a) failed:"). expect(err).to include("Activating bundler (~> 2.12.a) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '2.12.0.a'`") and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 2.12.a'`")
end end
end end
@ -187,8 +187,8 @@ RSpec.describe "bundle binstubs <gem>" do
it "calls through to the explicit bundler version" do it "calls through to the explicit bundler version" do
sys_exec "#{bundled_app("bin/bundle")} update --bundler=999.999.999" sys_exec "#{bundled_app("bin/bundle")} update --bundler=999.999.999"
expect(exitstatus).to eq(42) if exitstatus expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (999.999.999) failed:"). expect(err).to include("Activating bundler (~> 999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`") and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
end end
end end
@ -213,8 +213,8 @@ RSpec.describe "bundle binstubs <gem>" do
it "attempts to load that version" do it "attempts to load that version" do
sys_exec bundled_app("bin/rackup").to_s sys_exec bundled_app("bin/rackup").to_s
expect(exitstatus).to eq(42) if exitstatus expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (999.999.999) failed:"). expect(err).to include("Activating bundler (~> 999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`") and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
end end
end end
end end