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"
|
2016-06-16 22:47:36 -04:00
|
|
|
require "nsfcp.rb"
|
2016-08-24 14:20:50 -04:00
|
|
|
require "bootstrap_markdown.rb"
|
2016-05-24 14:05:21 -04:00
|
|
|
|
2016-05-25 12:06:00 -04:00
|
|
|
include GemSmith
|
|
|
|
$db = JDB.new("db")
|
2016-08-11 10:30:00 -04:00
|
|
|
$cv_users = ["okennedy"]
|
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
|
2016-07-31 13:26:09 -04:00
|
|
|
extract_headers
|
2016-05-25 23:08:33 -04:00
|
|
|
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
|
2016-08-24 14:20:50 -04:00
|
|
|
render_markdown(BootstrapMarkdown.new,
|
|
|
|
tables: true,
|
|
|
|
disable_indented_code_blocks: true,
|
|
|
|
fenced_code_blocks: true,
|
|
|
|
autolink: true,
|
|
|
|
no_intra_emphasis: true
|
|
|
|
)
|
2016-05-25 12:06:00 -04:00
|
|
|
end
|
|
|
|
for_files(/\.erb$/) do
|
2016-07-31 13:26:09 -04:00
|
|
|
render_erb
|
2016-05-25 12:06:00 -04:00
|
|
|
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
|
2016-07-31 13:26:09 -04:00
|
|
|
apply_template("templates/person.erb")
|
2016-05-25 16:58:50 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-07-31 13:26:09 -04:00
|
|
|
## Render 'news' pages
|
|
|
|
for_files(/rants\/.*\.html$/) do
|
|
|
|
exclude_files(/index\.html$/) do
|
|
|
|
extract_date_from_filename
|
|
|
|
create_collection("rants")
|
|
|
|
apply { |f| f[:news_prev] = f[:rants_prev]; f[:news_next] = f[:rants_next] }
|
|
|
|
apply_template("templates/news.erb")
|
|
|
|
end
|
|
|
|
for_files(/index\.html$/) do
|
|
|
|
get_collection("rants").map { |f| f[:in_path] }.each { |dep| add_dependency dep }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for_files(/news\/.*\.html$/) do
|
|
|
|
exclude_files(/index\.html$/) do
|
|
|
|
extract_date_from_filename
|
|
|
|
create_collection("news")
|
|
|
|
apply_template("templates/news.erb")
|
|
|
|
end
|
|
|
|
for_files(/index\.html$/) do
|
|
|
|
get_collection("news").map { |f| f[:in_path] }.each { |dep| add_dependency dep }
|
2016-05-25 23:08:33 -04:00
|
|
|
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-07-31 13:26:09 -04:00
|
|
|
for_files(/seminar\/.*\.html$/) do
|
|
|
|
apply {|f| f[:extraCSS] = [{ "asset" => "seminar.css" }] }
|
|
|
|
apply_template("templates/seminar.erb")
|
|
|
|
end
|
2016-05-25 23:08:33 -04:00
|
|
|
|
2016-07-31 13:26:09 -04:00
|
|
|
## Apply templating
|
|
|
|
for_files(/\.html$/) do
|
|
|
|
exclude_files(/^\/?(slides|software)\//) do
|
|
|
|
apply_template("templates/lab.erb")
|
|
|
|
end
|
|
|
|
end
|
2016-05-25 23:08:33 -04:00
|
|
|
|
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"
|
2016-08-10 11:28:08 -04:00
|
|
|
add_dependency "db/publications.json"
|
2016-05-25 12:06:00 -04:00
|
|
|
end
|
2016-05-25 21:08:03 -04:00
|
|
|
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-07-09 11:31:41 -04:00
|
|
|
for_files(/research\/.*\/index.html/) do
|
|
|
|
add_dependency "db/lab.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
|
|
|
|
task :clean do
|
|
|
|
system("rm -r build")
|
|
|
|
end
|
2016-06-14 19:56:33 -04:00
|
|
|
|
2016-07-26 03:53:39 -04:00
|
|
|
directory "artifacts"
|
2016-06-14 19:56:33 -04:00
|
|
|
|
2016-08-11 10:30:00 -04:00
|
|
|
$cv_users.each do |who|
|
2016-07-26 03:53:39 -04:00
|
|
|
file "artifacts/#{who}.tex" => (["artifacts", "db/cv/#{who}.json"]+Dir["db/cv/#{who}/**"]) do
|
|
|
|
File.open("artifacts/#{who}.tex", "w+") do |fh|
|
2016-06-14 19:56:33 -04:00
|
|
|
CV.make(who, fh)
|
|
|
|
end
|
|
|
|
end
|
2016-07-26 03:53:39 -04:00
|
|
|
file "artifacts/#{who}.pdf" => "artifacts/#{who}.tex" do
|
|
|
|
system("cd artifacts; pdflatex #{who}.tex")
|
2016-06-14 19:56:33 -04:00
|
|
|
end
|
2016-07-26 03:53:39 -04:00
|
|
|
task :cv => "artifacts/#{who}.pdf"
|
2016-06-14 19:56:33 -04:00
|
|
|
end
|
2016-06-16 22:47:36 -04:00
|
|
|
|
2016-07-26 03:53:39 -04:00
|
|
|
file "artifacts/okennedy_current_and_pending.pdf" do
|
2016-06-16 22:47:36 -04:00
|
|
|
NSFCnP.new("Oliver Kennedy",
|
|
|
|
$db["cv/okennedy/grants"].select { |r| r["status"] == "accepted" or r["status"] == "submitted" or r["status"] == "planned"}
|
2016-07-26 03:53:39 -04:00
|
|
|
).render("artifacts/okennedy_current_pending.pdf")
|
2016-06-16 22:47:36 -04:00
|
|
|
end
|
2016-07-26 03:53:39 -04:00
|
|
|
task :cnp => "artifacts/okennedy_current_and_pending.pdf"
|
2016-07-26 00:57:23 -04:00
|
|
|
|
2016-07-26 03:53:39 -04:00
|
|
|
file "artifacts/db.json" => "artifacts" do
|
2016-08-11 10:30:00 -04:00
|
|
|
File.open("artifacts/db.json", "w+") do |f|
|
2016-07-26 00:57:23 -04:00
|
|
|
f.puts JSON.generate($db.data)
|
|
|
|
end
|
|
|
|
end
|
2016-07-26 03:53:39 -04:00
|
|
|
|
2016-08-11 10:35:07 -04:00
|
|
|
task :documents => ["artifacts/db.json", :cv, :cnp]
|
|
|
|
|
2016-08-11 10:30:00 -04:00
|
|
|
directory "build/artifacts"
|
2016-08-11 10:35:07 -04:00
|
|
|
task :deploy => [:documents,:odin_lab,"build/artifacts"] do
|
2016-08-11 10:30:00 -04:00
|
|
|
system("cp -r artifacts/*.{pdf,json} build/artifacts/")
|
2016-09-18 18:45:09 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
###################### Specialized Stuff for Individual Use ######################
|
|
|
|
|
|
|
|
file "okennedy_short.tex" => (["db/cv/okennedy.json", "lib/cv.rb", "Rakefile"]+Dir["db/cv/okennedy/**"]) do
|
|
|
|
File.open("okennedy_short.tex", "w+") do |fh|
|
|
|
|
CV.make("okennedy", fh,
|
|
|
|
title: "Recent Activities",
|
|
|
|
since: {
|
|
|
|
education: 2008,
|
|
|
|
reviewer: 2015,
|
|
|
|
general_service: 2015,
|
|
|
|
volunteering: 2015,
|
|
|
|
talks: 2015,
|
|
|
|
courses: 2015,
|
2016-09-18 19:14:05 -04:00
|
|
|
publications: 2014
|
2016-09-18 18:45:09 -04:00
|
|
|
},
|
|
|
|
skip: [
|
|
|
|
:employment,
|
|
|
|
:memberships,
|
|
|
|
:dept_service,
|
|
|
|
:tech_reports
|
|
|
|
]
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
file "okennedy_short.pdf" => "okennedy_short.tex" do
|
|
|
|
system("pdflatex okennedy_short.tex")
|
|
|
|
end
|
|
|
|
|