summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2020-12-24 17:19:16 +0900
committerNARUSE, Yui <naruse@airemix.jp>2020-12-24 17:20:05 +0900
commita89932799c914d1864fc91f33d6461592dbfd3fb (patch)
tree74f9c4b97919c8eb7a9a513e1ad663471c71c8da
parent6a6daf3803771884f4cbf8e134802ae430568ba2 (diff)
gen-release-note.rb: Avoid to depend release metadatav3_0_0_rc2
Because it doesn't have metadata when I edit draft.
-rwxr-xr-xtool/releng/gen-release-note.rb19
1 files changed, 5 insertions, 14 deletions
diff --git a/tool/releng/gen-release-note.rb b/tool/releng/gen-release-note.rb
index e3dbe13..559ddeb 100755
--- a/tool/releng/gen-release-note.rb
+++ b/tool/releng/gen-release-note.rb
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
-require "open-uri"
-require "yaml"
+require 'open-uri'
+require 'time'
+require 'yaml'
# Confirm current directory is www.ruby-lang.org's working directory
def confirm_w_r_l_o_wd
@@ -11,8 +12,6 @@ def confirm_w_r_l_o_wd
end
confirm_w_r_l_o_wd
-releases = YAML.load_file('_data/releases.yml')
-
%w[
https://hackmd.io/@naruse/ruby-relnote-en/download
https://hackmd.io/@naruse/ruby-relnote-ja/download
@@ -28,18 +27,10 @@ releases = YAML.load_file('_data/releases.yml')
end
puts "#{url} -> #{version}"
- release = releases.find{|rel|rel['version'] == version}
- unless release
- abort "#{version} is not found in '_data/releases.yml'"
- end
# Write release note article
- lang = url[/ja|en/]
- if %r<\A/en/news/(\d+/\d+/\d+/ruby-[\w\-]+-released)> =~ release['post']
- path = "#{lang}/news/_posts/#{$1.tr('/', '-')}.md"
- else
- abort "unexpected path pattern '#{release['post']}'"
- end
+ path = Time.parse(src[/^date: (.*)/, 1]).
+ strftime("./#{src[/^lang: (\w+)/, 1]}/news/_posts/%Y-%m-%d-ruby-#{version}-released.md")
puts path
File.write(path, src)
end