Too Slow

I was very excited about getting the Epistle Retriever to work with Monolog, Behat and all the other sorts of things needed to make a proper software project. Mainly as an exercise to get used to it, but also because I’d quite like to get the product out there.

But now postach.io exists, which is pretty much the same thing. It uses Evernote rather than Epistle (which is a better idea because that doesn’t limit it), and then provides a full hosted site (and a CMS or something? Sounds a bit counter-invuitive).

So I’d like to get it out there, but it’s really only for jekyll-heroku sites and needs to be hosted on the user’s site…

Not sure how this would actually work out. But whatever, let’s plan this stuff out.

The current app has a number of functions, starting with:

  1. Instantiate the Dropbox client
  2. Get the UID from the session

Then it branches:

  1. If the Dropbox object isn’t authorised, then set the return URL, add the request token to the session, and send the user to Dropbox.
  2. If we’re coming back from Dropbox, get the request token from the session, get the access token from the Dropbox object - how? - and save the access token / UID pair.
  3. If there’s an access token, set it on the Dropbox object.

After all this, do this sequence:

  1. Get all the files in the folder, loop over them.
  2. If there’s no metadata file locally, or the local metadata revision is lower than the vision in Dropbox, then mark this as a file to download.
  3. If we should get this file, mark the fact that we’ve downloaded any file.
  4. Put the title in the file and save it to the local cache.
  5. Find the existing post via rake find - if it exists, then use that date, otherwise use today’s date.
  6. Save the file as date - slugified name.
  7. Copy to the jekyll-heroku _posts directory
  8. Run git add on the _posts file
  9. Run git commit

If we downloaded any files at all, then do this:

  1. Run jekyll –no-auto to regenerate the site
  2. Add the _site directory to git
  3. Git commit
  4. Git push using the passphraseless keyfile.

So how to get this working in a better context than a single index.php? Let’s try some BDD using those requirements above, and as different sections have been abstracted into looped parts, they can be objectified and have parameters passed to them.



Published

26 March 2013