Website/Rakefile

63 lines
1.2 KiB
Ruby
Raw Normal View History

2016-05-24 14:05:21 -04:00
$:.push "lib"
require "gemsmith.rb"
2016-05-25 12:06:00 -04:00
require "jdb.rb"
require "lab_metadata.rb"
2016-05-25 20:57:21 -04:00
require "util.rb"
2016-05-24 14:05:21 -04:00
2016-05-25 12:06:00 -04:00
include GemSmith
$db = JDB.new("db")
2016-05-24 14:05:21 -04:00
2016-05-25 12:06:00 -04:00
LabMetadata::build_people_metadata()
site :odin_lab, out: "build" do
2016-05-24 14:05:21 -04:00
2016-05-25 16:58:50 -04:00
## Splice off header information
2016-05-25 12:06:00 -04:00
for_files(/((\.erb)|(\.md)|(\.html))$/) do
activate extract_headers
end
2016-05-25 16:58:50 -04:00
## Render specialized formats
2016-05-25 12:06:00 -04:00
for_files(/\.md$/) do
activate render_markdown
end
for_files(/\.erb$/) do
activate render_erb
end
2016-05-25 16:58:50 -04:00
## Generate pages for each lab member
LabMetadata::create_people_pages
for_files(/people\/.*\.html$/) do
exclude_files(/index\.html/) do
activate apply_template("templates/person.erb")
end
end
## Apply templating
2016-05-25 12:06:00 -04:00
for_files(/\.html$/) do
activate apply_template("templates/lab.erb")
end
2016-05-25 16:58:50 -04:00
## Specify specialized dependencies (e.g., on the database)
2016-05-25 12:06:00 -04:00
for_files(/people\/.*\.html$/) do
add_dependency "db/lab.json"
end
2016-05-25 16:58:50 -04:00
## Static assets
2016-05-25 12:06:00 -04:00
add_assets([
2016-05-25 20:57:21 -04:00
"bootstrap", "jquery.js",
"odin.css", "seminar.css",
"logos", "favicon", "people"
2016-05-25 12:06:00 -04:00
])
end
task :default => :odin_lab
task :open => :default do
system("open build/index.html")
end
task :clean do
system("rm -r build")
end
file "build/index.html" => "Rakefile"