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 without content #85

Merged
merged 11 commits into from
Dec 4, 2024
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@

require_relative "release_task"

release_task = ReleaseTask.new("groonga")
def version
File.read(File.join(__dir__, "_config.yml"))[/^groonga_version: (.+)$/, 1]
end

release_task = ReleaseTask.new("Groonga", version, __dir__)
release_task.define
24 changes: 22 additions & 2 deletions release_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
class ReleaseTask
include Rake::DSL

def initialize(package)
def initialize(package, version, jekyll_path)
@package = package
@version = version
@jekyll_path = jekyll_path
end

def define
Expand All @@ -33,9 +35,27 @@ def define_generate_blog_task
namespace :blog do
desc "Generate release announce posts from a release note"
task :generate do
puts "TODO: Generate release announce posts for #{@package}"
generate_blog_posts
end
end
end
end

def post_filename
"#{Time.now.strftime("%F")}-#{@package.downcase}-#{@version}.md"
Copy link
Member

Choose a reason for hiding this comment

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

Time.now_config.ymlから持ってこれませんか?

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: 25ca18c...2c29500 共通して使いまわせそうだったので、_config.ymlから取得するように修正しました。

end

def post_content(locale)
# TODO: We will write blog post contents here.
# After writing contents, we will remove this TODO comment.
"#{locale}, #{@package}, #{@version}"
end

def generate_blog_posts
["ja", "en"].each do |locale|
File.open("#{@jekyll_path}/#{locale}/_posts/#{post_filename}", "w") do |post|
post.write(post_content(locale))
end
end
end
end
Loading