summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-04 17:09:16 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-04 17:09:16 +0900
commit16cb1fb007a9d107b8c447e862c92c682a56a7c8 (patch)
treedc10c52a5c72276e6e50431797e63696a0e9a0e9 /tool
parent58fd27d3d89451fbbe840348cd66f2205e34e72b (diff)
extlibs.rb: colorize
[ci skip]
Diffstat (limited to 'tool')
-rwxr-xr-xtool/extlibs.rb21
1 files changed, 11 insertions, 10 deletions
diff --git a/tool/extlibs.rb b/tool/extlibs.rb
index a840724794..efae167bfa 100755
--- a/tool/extlibs.rb
+++ b/tool/extlibs.rb
@@ -5,8 +5,13 @@
require 'digest'
require_relative 'downloader'
+require_relative 'colorize'
class ExtLibs
+ def initialize
+ @colorize = Colorize.new
+ end
+
def cache_file(url, cache_dir)
Downloader.cache_file(url, nil, :cache_dir => cache_dir)
end
@@ -23,16 +28,12 @@ class ExtLibs
$stdout.flush
end
hd = Digest(name.upcase).file(cache).hexdigest
- if hd == sum
- if $VERBOSE
- $stdout.puts " OK"
- $stdout.flush
- end
- else
- if $VERBOSE
- $stdout.puts " NG"
- $stdout.flush
- end
+ if $VERBOSE
+ $stdout.print " "
+ $stdout.puts hd == sum ? @colorize.pass("OK") : @colorize.fail("NG")
+ $stdout.flush
+ end
+ unless hd == sum
raise "checksum mismatch: #{cache}, #{name}:#{hd}, expected #{sum}"
end
end