Add Rakefile for automatically syncing CHANGELOG with history

This commit is contained in:
iBug
2024-04-23 00:24:44 +08:00
parent b604e2a686
commit aae8dac76c
2 changed files with 39 additions and 9 deletions
+27
View File
@@ -1,6 +1,8 @@
require "bundler/gem_tasks"
require "jekyll"
require "listen"
require "time"
require "yaml"
def listen_ignore_paths(base, options)
[
@@ -74,3 +76,28 @@ task :preview do
Jekyll::Commands::Serve.process(options)
end
file "docs/_docs/18-history.md" => "CHANGELOG.md" do |t|
front_matter = {
title: "History",
classes: "wide",
permalink: "/docs/history/",
excerpt: "Change log of enhancements and bug fixes made to the theme.",
sidebar: {
nav: "docs",
},
last_modified_at: Time.now.iso8601,
toc: false,
}
# https://stackoverflow.com/a/49553523/5958455
front_matter = JSON.parse(JSON.dump(front_matter))
File.open(t.name, "w") do |f|
f.puts front_matter.to_yaml
f.puts "---"
f.puts ""
f.puts "<!-- Sourced from CHANGELOG.md -->"
f.puts "{% raw %}"
f.write File.read(t.prerequisites.first)
f.puts "{% endraw %}"
end
end