mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
extlibs.rb: colorize
[ci skip]
This commit is contained in:
parent
58fd27d3d8
commit
16cb1fb007
1 changed files with 11 additions and 10 deletions
|
@ -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.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
|
||||
|
|
Loading…
Add table
Reference in a new issue