Skip to content

Commit

Permalink
gen-mail.rb: support markdown file path
Browse files Browse the repository at this point in the history
  • Loading branch information
nurse committed Feb 18, 2022
1 parent dff70b5 commit 542a38f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tool/releng/gen-mail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

lang = ARGV.shift
unless lang
abort "usage: #$1 {en,ja} | pbcopy"
abort "usage: #$1 {en,ja,release.md} | pbcopy"
end

# Confirm current directory is www.ruby-lang.org's working directory
Expand All @@ -16,10 +16,15 @@ def confirm_w_r_l_o_wd
end
confirm_w_r_l_o_wd

releases = YAML.load_file('_data/releases.yml')
releases = YAML.safe_load_file('_data/releases.yml', permitted_classes: [Date])

url = "https://hackmd.io/@naruse/ruby-relnote-#{lang}/download"
src = URI(url).read
case lang
when "en", "ja"
url = "https://hackmd.io/@naruse/ruby-relnote-#{lang}/download"
src = URI(url).read
else # the path of the Release note in markdown is given
src = File.read(lang)
end
src.gsub!(/[ \t]+$/, "")
src.sub!(/(?<!\n)\z/, "\n")
src.sub!(/^breaks: false\n/, '')
Expand Down

0 comments on commit 542a38f

Please sign in to comment.