From bcd8b2f00aef8fdaa54f1d76ca841ae8d10e5e0f Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Wed, 7 Dec 2022 12:31:00 +0900 Subject: NEWS.md: Added some missing features Also, tool/update-NEWS-refs.rb is added to help the update of NEWS.md. --- tool/update-NEWS-refs.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tool/update-NEWS-refs.rb (limited to 'tool') diff --git a/tool/update-NEWS-refs.rb b/tool/update-NEWS-refs.rb new file mode 100644 index 0000000000..8be26b048e --- /dev/null +++ b/tool/update-NEWS-refs.rb @@ -0,0 +1,26 @@ +# Usage: ruby tool/update-NEWS-refs.rb + +orig_src = File.read(File.join(__dir__, "../NEWS.md")) +lines = orig_src.lines(chomp: true) + +links = {} +while lines.last =~ %r{\A\[(?:Feature|Bug) #(\d+)\]:\s+https://bugs\.ruby-lang\.org/issues/\1\z} + links[$1] = lines.pop +end + +if links.empty? || lines.last != "" + raise "NEWS.md must end with a sequence of links to bugs.ruby-lang.org like \"[Feature #XXXXX]: https://bugs.ruby-lang.org/issues/XXXXX\"" +end + +new_src = lines.join("\n").gsub(/\[?\[(Feature|Bug)\s+#(\d+)\]\]?/) do + links[$2] ||= "[#$1 ##$2]: ".ljust(17) + "https://bugs.ruby-lang.org/issues/##$2" + "[[#$1 ##$2]]" +end.chomp + "\n\n" + links.keys.sort.map {|k| links[k] }.join("\n") + "\n" + +if orig_src != new_src + print "Update NEWS.md? [y/N]" + $stdout.flush + if gets.chomp == "y" + File.write(File.join(__dir__, "../NEWS.md"), new_src) + end +end -- cgit v1.2.1