add_color(string, *color)
click to toggle source
def add_color(string, *color)
@shell.set_color(string, *color)
end
ask(msg)
click to toggle source
def ask(msg)
@shell.ask(msg)
end
confirm(msg, newline = nil)
click to toggle source
def confirm(msg, newline = nil)
tell_me(msg, :green, newline) if level("confirm")
end
debug(msg, newline = nil)
click to toggle source
def debug(msg, newline = nil)
tell_me(msg, nil, newline) if debug?
end
debug?()
click to toggle source
def debug?
level("debug")
end
error(msg, newline = nil)
click to toggle source
def error(msg, newline = nil)
return unless level("error")
return tell_err(msg, :red, newline) if Bundler.feature_flag.error_on_stderr?
tell_me(msg, :red, newline)
end
info(msg, newline = nil)
click to toggle source
def info(msg, newline = nil)
tell_me(msg, nil, newline) if level("info")
end
level(name = nil)
click to toggle source
def level(name = nil)
return @level unless name
unless index = LEVELS.index(name)
raise "#{name.inspect} is not a valid level"
end
index <= LEVELS.index(@level)
end
level=(level)
click to toggle source
def level=(level)
raise ArgumentError unless LEVELS.include?(level.to_s)
@level = level.to_s
end
no?()
click to toggle source
def no?
@shell.no?(msg)
end
quiet?()
click to toggle source
def quiet?
level("quiet")
end
silence(&blk)
click to toggle source
def silence(&blk)
with_level("silent", &blk)
end
trace(e, newline = nil, force = false)
click to toggle source
def trace(e, newline = nil, force = false)
return unless debug? || force
msg = "#{e.class}: #{e.message}\n#{e.backtrace.join("\n ")}"
tell_me(msg, nil, newline)
end
unprinted_warnings()
click to toggle source
def unprinted_warnings
[]
end
warn(msg, newline = nil)
click to toggle source
def warn(msg, newline = nil)
return unless level("warn")
return if @warning_history.include? msg
@warning_history << msg
return tell_err(msg, :yellow, newline) if Bundler.feature_flag.error_on_stderr?
tell_me(msg, :yellow, newline)
end
yes?(msg)
click to toggle source
def yes?(msg)
@shell.yes?(msg)
end