#!/usr/bin/env ruby ROOT = ARGV[0] SNIPPETS = File.join(File.dirname(__FILE__), "snippets") tree = { "music" => Dir[File.join(ROOT, "music", "*")], "videos" => Dir[File.join(ROOT, "videos", "*")], } def html src cat = File.basename(src, ".html") html = File.read(File.join(SNIPPETS, "head.html")) html += "\n" case cat when "music" html += music src when "videos" html += videos src else html += File.read(src) end html += File.read(File.join(SNIPPETS, "tail.html")) out = File.join(ROOT, cat + ".html") puts out File.open(out, "w+") { |f| f.puts html } puts `tidy -iqm -w 80 #{out} 2>&1` # puts `echo "#{html}" > #{out} ` end ["about", "code", "pictures", "info", "newsletter"].each do |cat| html File.join(SNIPPETS, cat + ".html") end ["pdp8.png", "style.css", "distances.js", "images.js"].each { |f| `cp "#{File.join(SNIPPETS, f)}" "#{ROOT}"` } # rss