m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/scripts/build.rb
blob: 34944a2e54449267a344206d5af0acc153fe8cbd (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/ruby
require 'erb'
require 'fileutils'
require 'yaml'

require './lib/blog'
require './lib/statics'
require './lib/pather'
require './lib/templated'
require './lib/util'

def path_to asset_id
  P.path_to asset_id
end

if !Dir.exists? 'public'
  Dir.mkdir 'public'
end

P = Pather.new
P.cd 'src'

statics = [
  'style.css',
  '.well-known/acme-challenge/Tw4EQEgfzPP6garbkCV5pQJaJiOLhJYbuTbfPyFElcI',
  '.well-known/keybase.txt',
  'key.asc'
]

P.add 'key', 'key.asc'
P.add 'style', 'style.css'

P.add 'index', 'index.html'
P.add 'blog', 'blog.html'
P.add 'projects', 'projects.html'
P.add 'crypto', 'crypto.html'
P.add 'rss', 'rss.xml'
P.add 'sunday', 'sunday-corner'

if !Dir.exists? 'public/blog'
  Dir.mkdir 'public/blog'
end

posts.each do |post|
  P.add post['id'], post['html_filename']
end

write_statics statics
write_templated_erb 'index.html.erb', title: 'Martin Chrzanowski.'
write_templated_erb 'projects.html.erb', title: 'Projects.'
write_blog_archive
write_templated_file 'crypto.html', title: 'Crypto addresses.'

P.cd 'blog'

compile_posts posts
write_blog_files

P.cd '..'

write_erb 'rss.xml.erb'