Highlight messages in fetch-bundled_gems

This commit is contained in:
Nobuyoshi Nakada 2024-03-03 00:39:09 +09:00
parent 6ccc04cf45
commit f5497203b6
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465

View File

@ -1,6 +1,9 @@
#!ruby -an #!ruby -an
BEGIN { BEGIN {
require 'fileutils' require 'fileutils'
require_relative 'lib/colorize'
color = Colorize.new
dir = ARGV.shift dir = ARGV.shift
ARGF.eof? ARGF.eof?
@ -14,21 +17,23 @@ next unless n
next if n =~ /^#/ next if n =~ /^#/
if File.directory?(n) if File.directory?(n)
puts "updating #{n} ..." puts "updating #{color.notice(n)} ..."
system("git", "fetch", "--all", chdir: n) or abort system("git", "fetch", "--all", chdir: n) or abort
else else
puts "retrieving #{n} ..." puts "retrieving #{color.notice(n)} ..."
system(*%W"git clone #{u} #{n}") or abort system(*%W"git clone #{u} #{n}") or abort
end end
if r if r
puts "fetching #{r} ..." puts "fetching #{color.notice(r)} ..."
system("git", "fetch", "origin", r, chdir: n) or abort system("git", "fetch", "origin", r, chdir: n) or abort
end end
c = r || "v#{v}" c = r || "v#{v}"
checkout = %w"git -c advice.detachedHead=false checkout" checkout = %w"git -c advice.detachedHead=false checkout"
puts "checking out #{c} (v=#{v}, r=#{r}) ..." print %[checking out #{color.notice(c)} (v=#{color.info(v)}]
print %[, r=#{color.info(r)}] if r
puts ") ..."
unless system(*checkout, c, "--", chdir: n) unless system(*checkout, c, "--", chdir: n)
abort if r or !system(*checkout, v, "--", chdir: n) abort if r or !system(*checkout, v, "--", chdir: n)
end end