summaryrefslogtreecommitdiff
path: root/tool/update-bundled_gems.rb
blob: cef31e2f13391167e92538463cbcd67f8dd40a28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!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
  uri = uri.sub(%r[\Ahttps://github\.com/[^/]+/[^/]+\K/tree/.*], "").chomp(".git")
  $F[3][$F[1]] = gem.version.to_s if $F[3] && $F[3].include?($F[1])
  $_ = [gem.name, gem.version, uri, *$F[3..-1]].join(" ")
end