Website/Rakefile

78 lines
1.6 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
2016-05-25 23:08:33 -04:00
exclude_files(/^\/?(slides|software)\//) do
activate extract_headers
end
2016-05-25 12:06:00 -04:00
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
2016-05-25 23:08:33 -04:00
exclude_files(/^\/?(slides|software)\//) do
activate apply_template("templates/lab.erb")
end
2016-05-25 12:06:00 -04:00
end
2016-05-25 16:58:50 -04:00
2016-05-25 23:08:33 -04:00
## Specialized Formatting
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
for_files(/grants\/index\.html/) do
add_dependency "db/cv/okennedy/grants.json"
end
2016-05-25 12:06:00 -04:00
2016-05-25 16:58:50 -04:00
## Static assets
2016-05-25 12:06:00 -04:00
add_assets([
2016-05-25 23:08:33 -04:00
"bootstrap", "jquery.js", "mathjax",
2016-05-25 20:57:21 -04:00
"odin.css", "seminar.css",
"logos", "favicon", "people"
2016-05-25 12:06:00 -04:00
])
2016-05-25 23:08:33 -04:00
add_dir("slides", "slides")
add_dir("software", "software")
2016-05-25 12:06:00 -04:00
end
2016-05-25 23:08:33 -04:00
task :default => [ :odin_lab ]
2016-05-25 12:06:00 -04:00
task :open => :default do
system("open build/index.html")
end
2016-05-25 23:08:33 -04:00
task :upload => :odin_lab do
system("rsync -avz -e ssh --safe-links --progress build/ okennedy@gram.cse.buffalo.edu:/var/www/static/")
end
2016-05-25 12:06:00 -04:00
task :clean do
system("rm -r build")
end