lib/bundler/ui/shell.rb in bundler-1.13.0.rc.1 vs lib/bundler/ui/shell.rb in bundler-1.13.0.rc.2
- old
+ new
@@ -15,12 +15,12 @@
@shell = Thor::Base.shell.new
@level = ENV["DEBUG"] ? "debug" : "info"
@warning_history = []
end
- def add_color(string, color)
- @shell.set_color(string, color)
+ def add_color(string, *color)
+ @shell.set_color(string, *color)
end
def info(msg, newline = nil)
tell_me(msg, nil, newline) if level("info")
end
@@ -43,11 +43,11 @@
tell_me(msg, nil, newline) if level("debug")
end
def debug?
# needs to be false instead of nil to be newline param to other methods
- level("debug")
+ level("debug") ? true : false
end
def quiet?
LEVELS.index(@level) <= LEVELS.index("warn")
end
@@ -91,9 +91,17 @@
if newline.nil?
@shell.say(msg, color)
else
@shell.say(msg, color, newline)
end
+ end
+
+ def tell_err(message, color = nil, newline = nil)
+ buffer = @shell.send(:prepare_message, message, *color)
+ buffer << "\n" if newline && !message.to_s.end_with?("\n")
+
+ @shell.send(:stderr).print(buffer)
+ @shell.send(:stderr).flush
end
def strip_leading_spaces(text)
spaces = text[/\A\s+/, 0]
spaces ? text.gsub(/#{spaces}/, "") : text