summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2017-01-09 20:49:34 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2017-01-09 20:49:34 -0500
commit08f8193d87d1767529c3667e18669150dabca060 (patch)
tree61fd52bd1fc86b0714fe565bc2d080a2599932a8 /bin
parentece5de3520aafdb61b8764139aa9c616b4b2fd13 (diff)
mv make bin/sitegen
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)