lib/capistrano/asg/rolling/logger.rb in capistrano-asg-rolling-0.1.0 vs lib/capistrano/asg/rolling/logger.rb in capistrano-asg-rolling-0.2.0
- old
+ new
@@ -12,28 +12,29 @@
def info(text)
$stdout.puts format_text(text)
end
def error(text)
- $stderr.puts color(format_text(text), :red) # rubocop:disable Style/StderrPuts
+ $stderr.puts format_text(text, color: :red) # rubocop:disable Style/StderrPuts
end
def verbose(text)
info(text) if @verbose
end
- def bold(text, color = :light_white)
- color(text, color, :bold)
+ private
+
+ def format_text(text, color: nil)
+ text = colorize_text(text, color) if color
+ text.gsub(/\*\*(.+?)\*\*/, bold_text('\\1'))
end
- def color(text, color, mode = nil)
- _color.colorize(text, color, mode)
+ def bold_text(text)
+ "\e[1m#{text}\e[22m"
end
- private
-
- def format_text(text)
- text.gsub(/\*\*(.+?)\*\*/, bold('\\1'))
+ def colorize_text(text, color)
+ _color.colorize(text, color)
end
def _color
@_color ||= SSHKit::Color.new($stdout)
end