2 # Copyright (C) 2016 Ian Kelling
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 Dir
.chdir(File
.join(File
.dirname(__FILE__
), '_site'))
27 blog_list
= [] # table data
30 FileUtils
.mkdir_p('../proposed-comments')
31 FileUtils
.chmod(0777, '../proposed-comments')
32 FileUtils
.rm Dir
.glob('blog/*')
33 FileUtils
.rm Dir
.glob('css/*')
36 # date has no type affinity, since floating point (REAL) doesn't
37 # have an appropriate one.
39 create table if not exists c (
40 id integer primary key,
49 FileUtils
.chmod(0777, '../proposed-comments/comments.sqlite')
51 # We assume blog entry files are prefixed by date
52 # so we can just sort the filenames.
53 Dir
.glob('../blog/*.md').sort
.reverse
.each
do |file
|
54 [feed_entries
, blog_list
].zip(post(file
, true)) { |arr
, new
| arr
<< new
}
56 FileUtils
.chmod_R(0777, 'blog')
57 FileUtils
.mkdir_p('../comments/blog')
58 FileUtils
.chmod_R(0777, '../comments')
61 # main reference doc https://validator.w3.org/feed/docs/atom.html
62 # Reference doc says updated should be last time it changed
63 # but jekyll's rss feed just uses current time, which is easier to get,
64 # so meh, i'll just use that.
65 fwrite('feed.xml', <<EOF)
66 <?xml version="1.0" encoding="UTF-8"?>
67 <feed xmlns="http://www.w3.org/2005/Atom" >
69 <name>Ian Kelling</name>
73 <link rel="self" href="#{DURL}"/>
74 <title>Ian Kelling's Blog</title>
75 <updated>#{Time.now.to_datetime.rfc3339}</updated>
76 #{feed_entries.join("\n")}
80 fskel('index.html', DN
, File
.read('../index.html'))
82 stdpage('blog', <<EOF)
83 <ul class="site-nav-list">
84 #{blog_list.join("\n")}
88 if File
.exists
? ('../resume.md')
89 stdpage('resume', md_to_html(File
.read('../resume.md')))
92 stdpage('favorite-things', File
.read('../favorite-things.html'))
93 stdpage('about-me', File
.read('../about-me.html'))
95 # we could use ruby native stuff here, but this was
96 # better documented so meh.
97 # Force because it's cache is not perfect, it definitely misses renamed symlinks.
100 ["main", "gitweb-site"].each
do |basename
|
101 cmd
= "scss --force --cache-location ../.sass-cache"
102 unless system("#{cmd} ../css/#{basename}.scss css/#{basename}.css")