m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/scripts/build.rb
blob: 4ce84d2453f4f933e97e159f8dc8aa5ccf9d2864 (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
62
63
64
#!/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',
  'favicon.ico'
]

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

P.add 'index', 'index.html'
P.add 'contact', 'contact.html'
P.add 'blog', 'blog.html'
P.add 'projects', 'projects.html'
P.add 'donate', 'donate.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_templated_erb 'contact.html.erb', title: 'Contact.'
write_blog_archive
write_templated_file 'donate.html', title: 'Donations.'

P.cd 'blog'

compile_posts posts
write_blog_files

P.cd '..'

write_erb 'rss.xml.erb'