2020-12-06 09:56:44 +03: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 10:00:51 +03:00
|
|
|
uri = uri.sub(%r[\Ahttps://github\.com/[^/]+/[^/]+\K/tree/.*], "").chomp(".git")
|
2021-07-21 14:44:13 +03:00
|
|
|
if $F[3]
|
|
|
|
if $F[3].include?($F[1])
|
|
|
|
$F[3][$F[1]] = gem.version.to_s
|
|
|
|
elsif $F[2] != gem.version and /\A\h+\z/ =~ $F[3]
|
|
|
|
$F[3..-1] = []
|
|
|
|
end
|
|
|
|
end
|
2020-12-06 09:59:46 +03:00
|
|
|
$_ = [gem.name, gem.version, uri, *$F[3..-1]].join(" ")
|
2020-12-06 09:56:44 +03:00
|
|
|
end
|