From 08f8193d87d1767529c3667e18669150dabca060 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 9 Jan 2017 20:49:34 -0500 Subject: mv make bin/sitegen --- bin/sitegen | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 bin/sitegen (limited to 'bin') diff --git a/bin/sitegen b/bin/sitegen new file mode 100755 index 0000000..8356694 --- /dev/null +++ b/bin/sitegen @@ -0,0 +1,37 @@ +#!/usr/bin/env ruby +$:.unshift('lib') + +require 'set' + +require 'page_index' +require 'page_local' +require 'page_tag' +require 'sitegen' + +# Initialize the site generator +Sitegen::init + +# Load all pages +def crawl(page) + page.index_pages.select{|p|p.is_a?(IndexPage)}.each{|p|crawl(p)} +end +crawl(IndexPage::new('src')) + +# Tag pages +tags = Set[] +Sitegen::pages.each do |page| + tags.merge(page.atom_categories.map{|c|c.abbr}) +end +tags = tags.each do |tag| + TagPage::new(tag) +end +TagIndexPage::new() + +# Tell the sitegen which files we want +Sitegen.pages.select{|p|p.is_a?(LocalPage)}.each do |page| + Sitegen::want(page.local_outfile) +end +Sitegen::want('out/index.atom') + +# Make! +Sitegen::make(:all) -- cgit v1.2.3-54-g00ecf