Phil's Musings notes from a peripatetic programmer

Recent Posts


Building an eBook using GitHub

At Connexions we build free textbooks. To do it we have roughly 4 services:

  • Published Repository (Published Books)
  • Authoring Repository (Drafts)
  • Generate exports (EPUB, PDF)
  • Website

As someone who uses GitHub and Travis daily, I wondered how much of this GitHub (and Travis) can do for us. It turns out, quite a bit. If each book is a repository whose contents is an Unzipped EPUB then amazing things are possible.

Book Publishing = GitHub Repo + GitHub Pages + “Download as Zip” + Service Hooks

  • the master branch is the published version of the book
  • tags are various editions of a book
  • gh-pages branch can be used as a book reader (Website)
  • “Download as Zip” is the EPUB version of the book
  • The editor can “save” via the GitHub API
  • Travis-CI can be used to generate a PDF (and “push” to AWS or some other place)

So, I took our editor and made it save EPUB files to GitHub and viola, a book editor using GitHub!

Keep Reading...

Introducing octokit.js

octokit.js is a JavaScript client that interacts with GitHub using their API. Try it out with the interactive demo!

Some unique features:

  • works in a browser or in NodeJS
  • uses Promises
  • written in CoffeeScript
  • Mocha unit tests that actually talk to GitHub (and run in the browser or commandline)
  • Code Coverage using BlanketJS (that runs in the browser or commandline)
  • supports Harmony Generators

API Support:

  • all repo operations (including create/remove)
  • Teams, Organizations, and Permissions
  • eTags for caching results
  • Notifications for rate limit changes
  • Committing multiple files at once

Finding a test and coverage framework that works both in a browser and on the commandline was a bit challenging but I’ll return to that in another post.

This library also uses jQuery.ajax and jQuery.Deferred.

Keep Reading...