Website/Rakefile

103 lines
2.4 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-06-14 19:56:33 -04:00
require "cv.rb"
require "nsfcp.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-06-03 12:13:12 -04:00
for_files(/papers\/index.html/) do
add_dependency "db/publications.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-06-14 19:56:33 -04:00
add_static("slides", "slides")
add_static("software", "software")
2016-05-25 23:08:33 -04:00
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
2016-06-14 19:56:33 -04:00
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"