106 lines
2.5 KiB
Ruby
106 lines
2.5 KiB
Ruby
|
|
$:.push "lib"
|
|
require "gemsmith.rb"
|
|
require "jdb.rb"
|
|
require "lab_metadata.rb"
|
|
require "util.rb"
|
|
require "cv.rb"
|
|
require "nsfcp.rb"
|
|
|
|
include GemSmith
|
|
$db = JDB.new("db")
|
|
|
|
LabMetadata::build_people_metadata()
|
|
|
|
site :odin_lab, out: "build" do
|
|
|
|
## Splice off header information
|
|
for_files(/((\.erb)|(\.md)|(\.html))$/) do
|
|
exclude_files(/^\/?(slides|software)\//) do
|
|
activate extract_headers
|
|
end
|
|
end
|
|
|
|
## Render specialized formats
|
|
for_files(/\.md$/) do
|
|
activate render_markdown
|
|
end
|
|
for_files(/\.erb$/) do
|
|
activate render_erb
|
|
end
|
|
|
|
## 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
|
|
for_files(/\.html$/) do
|
|
exclude_files(/^\/?(slides|software)\//) do
|
|
activate apply_template("templates/lab.erb")
|
|
end
|
|
end
|
|
|
|
## Specialized Formatting
|
|
|
|
|
|
## Specify specialized dependencies (e.g., on the database)
|
|
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
|
|
for_files(/papers\/index.html/) do
|
|
add_dependency "db/publications.json"
|
|
end
|
|
for_files(/research\/.*\/index.html/) do
|
|
add_dependency "db/lab.json"
|
|
end
|
|
|
|
## Static assets
|
|
add_assets([
|
|
"bootstrap", "jquery.js", "mathjax",
|
|
"odin.css", "seminar.css",
|
|
"logos", "favicon", "people"
|
|
])
|
|
|
|
add_static("slides", "slides")
|
|
add_static("software", "software")
|
|
|
|
end
|
|
|
|
task :default => [ :odin_lab ]
|
|
task :open => :default do
|
|
system("open build/index.html")
|
|
end
|
|
task :upload => :odin_lab do
|
|
system("rsync -avz -e ssh --safe-links --progress build/ okennedy@gram.cse.buffalo.edu:/var/www/static/")
|
|
end
|
|
task :clean do
|
|
system("rm -r build")
|
|
end
|
|
|
|
directory "cvs"
|
|
|
|
["okennedy"].each do |who|
|
|
file "cvs/#{who}.tex" => (["cvs", "db/cv/#{who}.json"]+Dir["db/cv/#{who}/**"]) do
|
|
File.open("cvs/#{who}.tex", "w+") do |fh|
|
|
CV.make(who, fh)
|
|
end
|
|
end
|
|
file "cvs/#{who}.pdf" => "cvs/#{who}.tex" do
|
|
system("cd cvs; pdflatex #{who}.tex")
|
|
end
|
|
task :cv => "cvs/#{who}.pdf"
|
|
end
|
|
|
|
file "cvs/okennedy_current_and_pending.pdf" do
|
|
NSFCnP.new("Oliver Kennedy",
|
|
$db["cv/okennedy/grants"].select { |r| r["status"] == "accepted" or r["status"] == "submitted" or r["status"] == "planned"}
|
|
).render("cvs/okennedy_current_pending.pdf")
|
|
end
|
|
task :cnp => "cvs/okennedy_current_and_pending.pdf" |