diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-11-04 15:17:49 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-11-04 15:43:29 +0900 |
commit | 570dee15a6939f1a3c8cf301202a1c508c2c2a33 (patch) | |
tree | 2fdd7770dc629a7d0b4c1a274e679871527ff282 | |
parent | 1956fb9b78c1f78649df48282c716b4f74d45ed7 (diff) | |
download | ruby-570dee15a6939f1a3c8cf301202a1c508c2c2a33.tar.gz |
sync_default_gems.rb: accept log input from other than STDIN
-rwxr-xr-x | tool/sync_default_gems.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 7543b4f73c..d6b20a82bf 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -418,8 +418,8 @@ IGNORE_FILE_PATTERN = |rakelib\/.* )\z/mx -def message_filter(repo, sha) - log = STDIN.read +def message_filter(repo, sha, input: ARGF) + log = input.read log.delete!("\r") url = "https://github.com/#{repo}" subject, log = log.split(/\n(?:[\s\t]*(?:\n|\z))/, 2) @@ -659,8 +659,10 @@ when "list" end when "--message-filter" ARGV.shift - abort unless ARGV.size == 2 - message_filter(*ARGV) + if ARGV.size < 2 + abort "usage: #{$0} --message-filter repository commit-hash [input...]" + end + message_filter(*ARGV.shift(2)) exit when "rdoc-ref" ARGV.shift |