-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathRakefile
More file actions
31 lines (23 loc) · 848 Bytes
/
Rakefile
File metadata and controls
31 lines (23 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'kramdown'
require 'yaml'
require 'ostruct'
require_relative '_src/lib/util'
require_relative '_src/lib/file'
require_relative '_src/lib/toc'
require_relative '_src/lib/render'
file '_data/book.yml' => FileList['_src/*.md'] do |t|
puts "Rerendering TOC"
chapters = TOC.(t.prerequisites)
File.write(t.name, Util.deep_stringify_keys(chapters: chapters).to_yaml)
end
rule /^(\d+\.\d+|evolution)\.md$/ => ->(s) { "_src/#{s}" } do |t|
from, to = t.prerequisites.first, t.name
puts "Rendering #{from} => #{to}"
File.write(to, Render.(from))
end
VERSIONS = [*('2.4'..'2.7'), *('3.0'..'3.4'), '4.0']
desc 'Convert file contents from source to target (prettify)'
task contents: ['evolution', *VERSIONS].map(&'%s.md'.method(:%))
desc 'Render TOC for the changelog "book"'
task toc: '_data/book.yml'
task default: %i[toc contents]