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

[bundler/bundler] Stop printing deprecation messages during specs

Previously under some circunstances (met during some specs), bundler
would print deprecations to a separate UI different from "bundler's UI".
This UI would not be captured by the specs, and thus would be printed to
screen during the specs.

This commit fixes that by making sure all deprecation messages always go
through bundler's UI.

220c54b7fa
This commit is contained in:
David Rodríguez 2019-08-06 17:23:06 +02:00 committed by SHIBATA Hiroshi
parent 4af3665fd9
commit cd15d27d10
Notes: git 2019-08-31 04:40:14 +09:00

View file

@ -133,8 +133,9 @@ module Bundler
return unless bundler_major_version >= major_version && prints_major_deprecations?
@major_deprecation_ui ||= Bundler::UI::Shell.new("no-color" => true)
ui = Bundler.ui.is_a?(@major_deprecation_ui.class) ? Bundler.ui : @major_deprecation_ui
ui.warn("[DEPRECATED] #{message}")
with_major_deprecation_ui do |ui|
ui.warn("[DEPRECATED] #{message}")
end
end
def print_major_deprecations!
@ -211,6 +212,21 @@ module Bundler
private
def with_major_deprecation_ui(&block)
ui = Bundler.ui
if ui.is_a?(@major_deprecation_ui.class)
yield ui
else
begin
Bundler.ui = @major_deprecation_ui
yield Bundler.ui
ensure
Bundler.ui = ui
end
end
end
def validate_bundle_path
path_separator = Bundler.rubygems.path_separator
return unless Bundler.bundle_path.to_s.split(path_separator).size > 1