summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/sitegen37
1 files changed, 37 insertions, 0 deletions
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)