From a3b86375c946299c9216412e10c5bcf5234c7fcd Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Fri, 28 Jun 2019 19:12:42 +0200 Subject: Initial commit --- scripts/build.rb | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 scripts/build.rb (limited to 'scripts') 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 '..' -- cgit v1.2.3