summaryrefslogtreecommitdiff
path: root/tool/generic_erb.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-22 14:02:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-22 14:02:38 +0000
commitbe8a9db524121279a86cc085c275c7205795a081 (patch)
treebdb2d7d68d7e74564142188ba22947e419274e2b /tool/generic_erb.rb
parent35957b7690f3c6a86f99413d8cdfcd4547325a68 (diff)
colorize
* tool/generic_erb.rb: use VT100 sequence if tput does not work. * tool/ifchange: ditto and add --color option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/generic_erb.rb')
-rw-r--r--tool/generic_erb.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/tool/generic_erb.rb b/tool/generic_erb.rb
index 149de3b..ac1ef7d 100644
--- a/tool/generic_erb.rb
+++ b/tool/generic_erb.rb
@@ -24,8 +24,8 @@ end
unchanged = "unchanged"
updated = "updated"
if color or (color == nil && STDOUT.tty?)
- if (/\A(\e\[).*m\z/ =~ IO.popen("tput smso", "r", err: IO::NULL, &:read) rescue nil)
- beg = $1
+ if (/\A(?:\e\[.*m|)\z/ =~ IO.popen("tput smso", "r", err: IO::NULL, &:read) rescue nil)
+ beg = "\e["
colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {}
reset = "#{beg}m"
unchanged = "#{beg}#{colors["pass"] || "32;1"}m#{unchanged}#{reset}"