On the staging.code.org server, lesson plan PDFs are generated from certain folders.
The typical build cycle is:
- A change to a .md or .collate file is made via Dropbox and detected on staging
- A PDF is generated from that file
- The original PDF is moved to S3, and a
.fetch
file is put in its place, pointing to the uploaded copy
- Create a new folder for the lesson plan
- Currently must be a number, e.g.
1
or15
- Add the
title
of the course to a fileinfo.yml
- (optional) Add any extra styles to
morestyle.css
- Create a file with the extension
.md
. Lesson plans are currently all namedTeacher.md
.collate
files contain a list of either: (1) relative paths to PDFs or (2) URLs to remote PDFs.
On staging, a cron task joins the PDFs in these .collate
files together and places them where the .collate
file is (same filename, minus the .collate
extension).
Page numbers can be applied to .collate
-generated PDFs.
At the top of the .collate
file, add YAML front matter with the following variable set:
---
numbers: true
---
# My normal content
There are different Dropbox shares named curriculum-course*
and curriculum-docs
which sync to the corresponding folders in /pegasus/sites/virtual
.
For Dropbox folder access, ask Brendan or anyone with Dropbox Pegasus Staging
account access.
/pegasus/src/course.rb
and /pegasus/sites/virtual/generate_curriculum_pdfs.rake
are good starting points for some of the PDF generation logic.
- Ubuntu:
sudo aptitude install pdftk enscript
- OS X:
brew install https://raw.github.com/quantiverge/homebrew-binary/pdftk/pdftk.rb brew install enscript
The PDF collation tests should now be run during the pegasus test cycle.
To run the individual test manually:
bundle install
cd code-dot-org/pegasus/test
bundle exec ruby -Itest test_pdf_merger.rb