2020-12-06 01:56:44 -05:00
|
|
|
#!ruby -pla
|
|
|
|
BEGIN {
|
|
|
|
require 'rubygems'
|
|
|
|
}
|
|
|
|
unless /^[^#]/ !~ (gem = $F[0])
|
|
|
|
(gem, src), = Gem::SpecFetcher.fetcher.detect(:latest) {|s|
|
|
|
|
s.platform == "ruby" && s.name == gem
|
|
|
|
}
|
|
|
|
gem = src.fetch_spec(gem)
|
|
|
|
uri = gem.metadata["source_code_uri"] || gem.homepage
|
2020-12-06 02:00:51 -05:00
|
|
|
uri = uri.sub(%r[\Ahttps://github\.com/[^/]+/[^/]+\K/tree/.*], "").chomp(".git")
|
2021-07-21 07:44:13 -04:00
|
|
|
if $F[3]
|
|
|
|
if $F[3].include?($F[1])
|
|
|
|
$F[3][$F[1]] = gem.version.to_s
|
2021-12-02 07:13:02 -05:00
|
|
|
elsif Gem::Version.new($F[1]) != gem.version and /\A\h+\z/ =~ $F[3]
|
2021-07-21 07:44:13 -04:00
|
|
|
$F[3..-1] = []
|
|
|
|
end
|
|
|
|
end
|
2022-08-12 10:51:55 -04:00
|
|
|
f = [gem.name, gem.version.to_s, uri, *$F[3..-1]]
|
2022-10-24 05:12:25 -04:00
|
|
|
$_.gsub!(/\S+\s*/) {|s| (f.shift || "").ljust(s.size)}
|
2022-08-12 10:51:55 -04:00
|
|
|
$_ = [$_, *f].join(" ") unless f.empty?
|
2022-10-24 05:36:40 -04:00
|
|
|
$_.rstrip!
|
2020-12-06 01:56:44 -05:00
|
|
|
end
|