Skip to content

Commit

Permalink
Highlight messages in fetch-bundled_gems
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Mar 18, 2024
1 parent 6ccc04c commit f549720
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tool/fetch-bundled_gems.rb
@@ -1,6 +1,9 @@
#!ruby -an
BEGIN {
require 'fileutils'
require_relative 'lib/colorize'

color = Colorize.new

dir = ARGV.shift
ARGF.eof?
Expand All @@ -14,21 +17,23 @@
next if n =~ /^#/

if File.directory?(n)
puts "updating #{n} ..."
puts "updating #{color.notice(n)} ..."
system("git", "fetch", "--all", chdir: n) or abort
else
puts "retrieving #{n} ..."
puts "retrieving #{color.notice(n)} ..."
system(*%W"git clone #{u} #{n}") or abort
end

if r
puts "fetching #{r} ..."
puts "fetching #{color.notice(r)} ..."
system("git", "fetch", "origin", r, chdir: n) or abort
end

c = r || "v#{v}"
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)
abort if r or !system(*checkout, v, "--", chdir: n)
end
Expand Down

0 comments on commit f549720

Please sign in to comment.