From 04be004796a3415ca2696de55f5425e340fe9afc Mon Sep 17 00:00:00 2001 From: otegami Date: Wed, 4 Dec 2024 16:57:17 +0900 Subject: [PATCH] Remove #product_id for consistency We pre-calculate the variables for generating release blog posts. --- release_task.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/release_task.rb b/release_task.rb index c5cd8148bb..6e6621c00d 100644 --- a/release_task.rb +++ b/release_task.rb @@ -22,7 +22,7 @@ class ReleaseTask include Rake::DSL def initialize(product, jekyll_path) - @product = product + @product_id = product.downcase @jekyll_path = jekyll_path @jekyll_config = load_jekyll_config @version = detect_version @@ -35,20 +35,16 @@ def define private - def product_id - @product.downcase - end - def load_jekyll_config YAML.safe_load_file(File.join(@jekyll_path, "_config.yml"), permitted_classes: [Date]) end def detect_version - @jekyll_config["#{product_id}_version"] + @jekyll_config["#{@product_id}_version"] end def detect_release_date - @jekyll_config["#{product_id}_release_date"] + @jekyll_config["#{@product_id}_release_date"] end def define_generate_blog_task @@ -63,13 +59,14 @@ def define_generate_blog_task end def post_filename - "#{@release_date.strftime("%F")}-#{product_id}-#{@version}.md" + "#{@release_date.strftime("%F")}-#{@product_id}-#{@version}.md" 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}" + product = @product_id.capitalize + "#{locale}, #{product}, #{@version}" end def generate_blog_posts