2017-02-15 17:56:03 -05:00
|
|
|
require "rubygems"
|
2019-06-28 15:41:38 -04:00
|
|
|
require "time"
|
2019-11-27 14:06:28 -05:00
|
|
|
require "net/http"
|
|
|
|
require "uri"
|
|
|
|
require "json"
|
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"
|
2017-02-15 17:56:03 -05:00
|
|
|
require "nsfconflicts.rb"
|
2018-06-04 15:56:55 -04:00
|
|
|
require "ubreporting.rb"
|
2016-08-24 14:20:50 -04:00
|
|
|
require "bootstrap_markdown.rb"
|
2017-08-27 16:07:41 -04:00
|
|
|
require "disqus.rb"
|
2019-12-26 15:52:58 -05:00
|
|
|
require "ABET"
|
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
|
2017-01-06 18:11:50 -05:00
|
|
|
exclude_files(/^\/?(slides)\//) 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
|
|
|
|
2020-11-15 17:15:06 -05:00
|
|
|
## Render 'talks' pages
|
|
|
|
for_files(/talks\/.*/) do
|
|
|
|
exclude_files(/talks\/index|talks\/graphics|talks\/ubodin/) do
|
|
|
|
extract_date_from_filename
|
|
|
|
create_collection("talks")
|
|
|
|
end
|
|
|
|
for_files(/talks\/index/) do
|
|
|
|
get_collection("talks").map { |f| f[:in_path] }.each { |dep| add_dependency dep }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-25 23:08:33 -04:00
|
|
|
## Specialized Formatting
|
2017-01-09 12:17:45 -05:00
|
|
|
for_files(/seminar\/[0-9]{4}(sp|fa)\.html$/) do
|
2016-07-31 13:26:09 -04:00
|
|
|
apply {|f| f[:extraCSS] = [{ "asset" => "seminar.css" }] }
|
|
|
|
apply_template("templates/seminar.erb")
|
|
|
|
end
|
2016-05-25 23:08:33 -04:00
|
|
|
|
2019-12-02 12:25:15 -05:00
|
|
|
## Specialized Formatting
|
|
|
|
for_files(/demoday\/[0-9]{4}(sp|fa)\.html$/) do
|
|
|
|
add_dependency "db/demoday/2019fa.json"
|
|
|
|
end
|
|
|
|
|
2016-07-31 13:26:09 -04:00
|
|
|
## Apply templating
|
|
|
|
for_files(/\.html$/) do
|
2017-01-06 18:11:50 -05:00
|
|
|
exclude_files(/^\/?(slides)\//) do
|
2017-01-31 18:04:30 -05:00
|
|
|
exclude_files(/^\/?teaching\/.*\/?(slides)\/.*\.html/) do
|
|
|
|
apply_template("templates/lab.erb")
|
|
|
|
end
|
2016-07-31 13:26:09 -04:00
|
|
|
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"
|
2017-02-02 22:08:39 -05:00
|
|
|
add_dependency "db/lab.json"
|
2016-05-25 21:08:03 -04:00
|
|
|
end
|
2016-06-03 12:13:12 -04:00
|
|
|
for_files(/papers\/index.html/) do
|
|
|
|
add_dependency "db/publications.json"
|
2017-02-02 22:08:39 -05:00
|
|
|
add_dependency "db/lab.json"
|
2017-05-07 22:52:57 -04:00
|
|
|
add_dependency "lib/publication.erb"
|
2016-06-03 12:13:12 -04:00
|
|
|
end
|
2016-07-09 11:31:41 -04:00
|
|
|
for_files(/research\/.*\/index.html/) do
|
|
|
|
add_dependency "db/lab.json"
|
2019-06-28 15:18:46 -04:00
|
|
|
add_dependency "db/publications.json"
|
2016-07-09 11:31:41 -04:00
|
|
|
end
|
2017-09-24 22:48:30 -04:00
|
|
|
for_files(/^\/index.html$/) do
|
2017-09-24 22:45:15 -04:00
|
|
|
get_collection("news").map { |f| f[:in_path] }.each { |dep| add_dependency dep }
|
|
|
|
end
|
2018-01-30 23:44:25 -05:00
|
|
|
for_files(/teaching\/cse-562\/2018sp\/index.html/) do
|
|
|
|
add_dependency "db/teaching/cse4_562/2018sp/schedule.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",
|
2016-11-08 10:02:12 -05:00
|
|
|
"logos", "favicon", "people", "photos"
|
2016-05-25 12:06:00 -04:00
|
|
|
])
|
|
|
|
|
2016-06-14 19:56:33 -04:00
|
|
|
add_static("slides", "slides")
|
2017-06-05 09:26:45 -04:00
|
|
|
|
|
|
|
## Sub-sites
|
|
|
|
add_static("subsites/nmeneghetti", "people/niccolo_meneghetti")
|
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
|
2019-02-17 00:49:27 -05:00
|
|
|
case `uname`.chomp
|
|
|
|
when "Darwin"
|
|
|
|
system("open build/index.html")
|
|
|
|
when "Linux"
|
|
|
|
system("xdg-open build/index.html &>/dev/null")
|
|
|
|
else
|
|
|
|
puts "Unknown platform #{`uname`}; Can't open"
|
|
|
|
end
|
2016-05-25 12:06:00 -04:00
|
|
|
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|
|
2017-03-05 17:41:34 -05:00
|
|
|
file "artifacts/#{who}.tex" => (["artifacts", "db/cv/#{who}.json", "lib/cv.rb", "Rakefile"]+Dir["db/cv/#{who}/**"]) do
|
2016-07-26 03:53:39 -04:00
|
|
|
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
|
2019-03-25 01:36:39 -04:00
|
|
|
cnp = NSFCnP.new("Oliver Kennedy",
|
2016-06-16 22:47:36 -04:00
|
|
|
$db["cv/okennedy/grants"].select { |r| r["status"] == "accepted" or r["status"] == "submitted" or r["status"] == "planned"}
|
2019-03-25 01:36:39 -04:00
|
|
|
)
|
|
|
|
cnp.render("artifacts/okennedy_current_pending.pdf")
|
|
|
|
cnp.print
|
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
|
2022-06-10 16:10:30 -04:00
|
|
|
files = Dir["artifacts/*.{pdf,json}"]
|
|
|
|
unless files.empty? then
|
|
|
|
system("cp -r #{files.join(" ")} build/artifacts/")
|
|
|
|
end
|
2016-09-18 18:45:09 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
###################### Specialized Stuff for Individual Use ######################
|
|
|
|
|
2022-02-22 11:09:41 -05:00
|
|
|
file "okennedy_short.tex" => (["db/lab.json", "db/cv/okennedy.json", "lib/cv.rb", "Rakefile"]+Dir["db/cv/okennedy/**"]) do
|
2016-09-18 18:45:09 -04:00
|
|
|
File.open("okennedy_short.tex", "w+") do |fh|
|
|
|
|
CV.make("okennedy", fh,
|
|
|
|
title: "Recent Activities",
|
|
|
|
since: {
|
|
|
|
education: 2008,
|
2020-11-30 18:32:53 -05:00
|
|
|
general_service: 2015,
|
|
|
|
volunteering: 2015,
|
|
|
|
courses: 2015,
|
2022-02-22 11:09:41 -05:00
|
|
|
chair: 2017
|
2016-09-18 18:45:09 -04:00
|
|
|
},
|
|
|
|
skip: [
|
2020-11-30 18:32:53 -05:00
|
|
|
:invited_talks,
|
|
|
|
# :honors,
|
|
|
|
:reviewer,
|
|
|
|
:publications,
|
2017-10-24 18:24:55 -04:00
|
|
|
:contact,
|
2016-09-18 18:45:09 -04:00
|
|
|
:employment,
|
|
|
|
:memberships,
|
2017-10-24 18:24:55 -04:00
|
|
|
# :dept_service,
|
|
|
|
:tech_reports,
|
2022-02-22 11:09:41 -05:00
|
|
|
:general_service,
|
2017-10-24 18:24:55 -04:00
|
|
|
:reviewer,
|
|
|
|
# :publications,
|
|
|
|
:artifacts,
|
2020-11-30 18:32:53 -05:00
|
|
|
:grants
|
2017-10-24 18:24:55 -04:00
|
|
|
],
|
|
|
|
abbreviate: [
|
2016-09-18 18:45:09 -04:00
|
|
|
]
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
file "okennedy_short.pdf" => "okennedy_short.tex" do
|
|
|
|
system("pdflatex okennedy_short.tex")
|
|
|
|
end
|
2018-05-08 11:50:13 -04:00
|
|
|
|
|
|
|
file "okennedy_full.tex" => (["db/cv/okennedy.json", "lib/cv.rb", "Rakefile"]+Dir["db/cv/okennedy/**"]) do
|
|
|
|
File.open("okennedy_full.tex", "w+") do |fh|
|
|
|
|
CV.make("okennedy", fh,
|
|
|
|
title: "Curriculum Vitae (Long)",
|
|
|
|
include_pending_papers: true,
|
|
|
|
include_pending_grants: true,
|
2018-06-13 09:12:28 -04:00
|
|
|
include_rejected_grants: false,
|
|
|
|
include_blurb: true
|
2018-05-08 11:50:13 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
file "okennedy_full.pdf" => "okennedy_full.tex" do
|
|
|
|
system("pdflatex okennedy_full.tex")
|
|
|
|
end
|
|
|
|
|
2019-12-26 15:52:58 -05:00
|
|
|
file "KennedyOliver-CV.tex" => (["db/cv/okennedy.json", "lib/cv.rb", "lib/ABET.rb", "Rakefile"]+Dir["db/cv/okennedy/**"]) do
|
|
|
|
File.open("KennedyOliver-CV.tex", "w+") do |fh|
|
|
|
|
ABET_CV.new(fh).gen
|
|
|
|
end
|
|
|
|
end
|
|
|
|
file "KennedyOliver-CV.pdf" => "KennedyOliver-CV.tex" do
|
|
|
|
system("pdflatex KennedyOliver-CV.tex")
|
|
|
|
end
|
|
|
|
task abet_cv: "KennedyOliver-CV.pdf"
|
|
|
|
|
2017-07-13 00:15:37 -04:00
|
|
|
file "artifacts/okennedy_collaborators.txt" => ($db.files + ["lib/nsfconflicts.rb"]) do
|
2017-02-15 17:56:03 -05:00
|
|
|
NSFConflicts.new("Oliver Kennedy", $db).
|
2017-07-13 00:15:37 -04:00
|
|
|
render("artifacts/okennedy_collaborators.txt")
|
2017-02-15 17:56:03 -05:00
|
|
|
end
|
2017-07-13 00:15:37 -04:00
|
|
|
task :collab => "artifacts/okennedy_collaborators.txt"
|
2017-08-25 10:10:48 -04:00
|
|
|
task :conflicts => "artifacts/okennedy_collaborators.txt"
|
2017-02-15 17:56:03 -05:00
|
|
|
|
2016-09-18 18:45:09 -04:00
|
|
|
|
2017-08-11 16:12:38 -04:00
|
|
|
["mimir", "insider-threats", "astral"].each do |project|
|
|
|
|
file "artifacts/#{project}_papers.txt" => [ $db.files, "artifacts", "Rakefile" ].flatten do
|
|
|
|
File.open("artifacts/#{project}_papers.txt", "w+") do |fh|
|
|
|
|
fh.puts $db["publications"].
|
|
|
|
where { |pub| pub.fetch("projects", []).include? project }.
|
|
|
|
map { |pub| LabMetadata::format_pub_for_report(pub) }.
|
|
|
|
compact.
|
|
|
|
join("\n\n")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
task :projectreport => "artifacts/#{project}_papers.txt"
|
|
|
|
end
|
|
|
|
task :report => :projectreport
|
|
|
|
|
|
|
|
file "artifacts/grant_report.txt" do
|
|
|
|
File.open("artifacts/grant_report.txt", "w+") do |fh|
|
|
|
|
$db["publications"]
|
|
|
|
.map { |pub|
|
|
|
|
pub.fetch("grants_cited", [])
|
|
|
|
.map { |grant|
|
|
|
|
[ [
|
|
|
|
grant["agency"],
|
|
|
|
grant.fetch("agency_id", grant.fetch("project_name", "???"))
|
|
|
|
], pub
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}.flatten(1)
|
|
|
|
.reduce
|
|
|
|
.each { |grant, pubs|
|
|
|
|
fh.puts grant[0]+"/"+grant[1]
|
|
|
|
fh.puts "-----------"
|
|
|
|
pubs.each { |pub|
|
|
|
|
pub = LabMetadata::format_pub_for_report(pub)
|
|
|
|
fh.puts "\n"+pub unless pub.nil?
|
|
|
|
}
|
|
|
|
fh.puts "\n\n"
|
|
|
|
}
|
2017-05-11 03:45:25 -04:00
|
|
|
end
|
2017-07-16 20:10:58 -04:00
|
|
|
end
|
2017-08-11 16:12:38 -04:00
|
|
|
task :report => "artifacts/grant_report.txt"
|
2017-07-16 20:10:58 -04:00
|
|
|
|
2018-06-04 15:56:55 -04:00
|
|
|
task :ub_report do
|
2020-08-01 12:23:04 -04:00
|
|
|
|
|
|
|
UBSOE::generate_yearly_report(Time.now().year-1)
|
2018-06-04 15:56:55 -04:00
|
|
|
end
|
|
|
|
|
2017-07-16 20:10:58 -04:00
|
|
|
file "artifacts/nsf_merit_blurb.txt" => [ $db.files, "artifacts", "Rakefile" ].flatten do
|
|
|
|
# File.open("artifacts/nsf_related_blurb.txt", "w+") do |fh|
|
|
|
|
citable_pubs =
|
|
|
|
$db["publications"]
|
|
|
|
.where { |pub| pub.fetch("grants_cited", []).index { |grant| /NSF/ =~ grant.fetch("agency", "") } }
|
|
|
|
citable_pubs.each { |pub| puts pub["title"] }
|
|
|
|
# end
|
2017-09-16 11:22:20 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
task "email-lab" do
|
|
|
|
members = $db["lab/members"].map do |name, data|
|
|
|
|
raise "No UBIT for #{name}" unless data.has_key? "ubit"
|
|
|
|
"#{name} <#{data["ubit"]}@buffalo.edu>"
|
|
|
|
end
|
2018-07-24 19:00:47 -04:00
|
|
|
puts members.join("\n")
|
|
|
|
# (system("open", "-a", "Mail", "mailto://#{members.join(", ")}"))
|
2018-04-27 20:25:43 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
task :test do
|
|
|
|
puts ImageSmith::img("assets/people/oliver.jpg", bounding_box: [50,50], inline: true)
|
2019-11-27 14:06:28 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
task :demoday do
|
|
|
|
uri = URI("https://demo.vizierdb.info/vizier-db/api/v1/projects/1be34a70/branches/b8c48b44/head")
|
|
|
|
outfile = "db/demoday/2019fa.json"
|
|
|
|
Net::HTTP.start(uri.host, uri.port, { :use_ssl => true }) do |http|
|
|
|
|
request = Net::HTTP::Get.new uri.path
|
|
|
|
request.basic_auth("mimir", "jormugundir")
|
|
|
|
response = http.request(request)
|
|
|
|
json = JSON.parse(response.body)
|
|
|
|
File.open(outfile, "w+") do |f|
|
|
|
|
f.puts(json["modules"][-1]["outputs"]["stdout"][0]["value"])
|
|
|
|
end
|
|
|
|
puts "Wrote to #{outfile}"
|
|
|
|
# p json["outputs"]#["stdout"]#[0]["value"]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|