From 16cb1fb007a9d107b8c447e862c92c682a56a7c8 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 4 Jun 2019 17:09:16 +0900 Subject: extlibs.rb: colorize [ci skip] --- tool/extlibs.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'tool') 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 -- cgit v1.2.3