summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-10-12 11:52:46 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-10-12 12:27:40 +0900
commit2b5d4fe28dc548f782be8d71de8b472000e6b38e (patch)
tree73a88bea03b8321900d54c10840a3b257135f12c /tool
parentdf588440ee01e91d87cb815ff85dd6c785dc7827 (diff)
sync_default_gems: Add rdoc-ref command to test
Diffstat (limited to 'tool')
-rwxr-xr-xtool/sync_default_gems.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index 3aabd3739c..8b7fae2db3 100755
--- a/tool/sync_default_gems.rb
+++ b/tool/sync_default_gems.rb
@@ -642,6 +642,17 @@ when "--message-filter"
abort unless ARGV.size == 2
message_filter(*ARGV)
exit
+when "rdoc-ref"
+ ARGV.shift
+ pattern = ARGV.empty? ? %w[*.c *.rb *.rdoc] : ARGV
+ result = pipe_readlines(%W"git grep -z -l -F [https://docs.ruby-lang.org/en/master/ --" + pattern)
+ result.inject(false) do |changed, file|
+ if replace_rdoc_ref(file)
+ puts "replaced rdoc-ref in #{file}"
+ changed = true
+ end
+ changed
+ end
when nil, "-h", "--help"
puts <<-HELP
\e[1mSync with upstream code of default libraries\e[0m