Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release blog: generate release post contents #87

Merged
merged 6 commits into from
Dec 5, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 53 additions & 3 deletions release_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,60 @@ def post_filename
"#{@release_date.strftime("%F")}-#{@product_id}-#{@version}.md"
end

def product_install_url
"/docs/install.html"
end

def product_release_note_url
major_version = @version.split(".")[0];
otegami marked this conversation as resolved.
Show resolved Hide resolved
"/docs/news/#{major_version}.html#release-#{@version.gsub(".", "-")}"
end

def post_ja_content
<<-CONTENT
---
layout: post.ja
title: #{@product} #{@version}リリース
description: #{@product} #{@version}をリリースしました!
---

## #{@product} #{@version}リリース

#{@product} #{@version}をリリースしました!

それぞれの環境毎のインストール方法は、[インストール](/ja#{product_install_url})をご確認ください。

主な変更点のついては、[リリースノート](/ja#{product_release_note_url})をご確認ください。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
主な変更点のついては、[リリースノート](/ja#{product_release_note_url})をご確認ください。
主な変更点は[リリースノート](/ja#{product_release_note_url})をご確認ください。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: 007789d

CONTENT
end

def post_en_content
<<-CONTENT
---
layout: post.en
title: #{@product} #{@version} has been released
description: #{@product} #{@version} has been released!
---

## #{@product} #{@version} has been released

#{@product} #{@version} has been released!

For installation instructions on your environments, please see the [Installation Guide](#{product_install_url}).

For the information on the changes, please see the [Release Note](#{product_release_note_url}).
otegami marked this conversation as resolved.
Show resolved Hide resolved
CONTENT
end

def post_content(locale)
# TODO: We will write blog post contents here.
# After writing contents, we will remove this TODO comment.
"#{locale}, #{@product}, #{@version}"
case locale
when "ja"
post_ja_content
when "en"
post_en_content
else
raise "#{locale} isn't supported for release announce posts in blog."
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case locale
when "ja"
post_ja_content
when "en"
post_en_content
else
raise "#{locale} isn't supported for release announce posts in blog."
end
__send__("post_#{locale}_content")

post_content_#{locale}にしてpost_contentをprefixにして関連処理であることをアピールしたほうがいいかも。

Copy link
Contributor Author

@otegami otegami Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: ed63a9e
ありがとうございます。わざわざ例外を挙げなくても、NoMethodErrorで気づけますし何をしているか、たしかにわかりやすいですね 🙏🏾

post_content_#{locale}にしてpost_contentをprefixにして関連処理であることをアピールしたほうがいいかも。

確かにです!

end

def generate_blog_posts
Expand Down
Loading