m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.rb60
1 files changed, 60 insertions, 0 deletions
diff --git a/scripts/build.rb b/scripts/build.rb
new file mode 100755
index 0000000..aad1c00
--- /dev/null
+++ b/scripts/build.rb
@@ -0,0 +1,60 @@
+#!/bin/ruby
+require 'erb'
+require 'fileutils'
+require 'yaml'
+
+require './lib/blog'
+require './lib/statics'
+require './lib/pather'
+require './lib/templated'
+
+SourceDir = 'src'
+BuildDir = 'public'
+
+def src filename
+ File.join SourceDir, filename
+end
+
+def build filename
+ File.join BuildDir, filename
+end
+
+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',
+]
+
+P.add 'style', 'style.css'
+
+P.add 'index', 'index.html'
+P.add 'blog', 'blog.html'
+P.add 'projects', 'projects.html'
+
+if !Dir.exists? 'public/blog'
+ Dir.mkdir 'public/blog'
+end
+
+posts.each do |post|
+ P.add post['title'], post['filename']
+end
+
+write_statics statics
+write_templated_erb 'index.html.erb', title: 'Martin Chrzanowski.'
+write_templated_file 'projects.html', title: 'Projects.'
+write_blog_archive
+
+P.cd 'blog'
+
+write_blog_files
+
+P.cd '..'