diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2019-06-28 19:12:42 +0200 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2019-06-28 19:13:20 +0200 |
commit | a3b86375c946299c9216412e10c5bcf5234c7fcd (patch) | |
tree | b1cceccafa1fad92561bfda729e2ab9b7b62f1fc /scripts |
Initial commit
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.rb | 60 |
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 '..' |