CodeForAfricaLabs/sourceAFRICA — pull request #2 by DavidLemayian (2014-11-11 18:36:35+00:00)
Title: Use Tempfile for zipfile creation

When Dir.mktmpdir is unlinked, the inner files are inaccessible to send_file.
This meant that we had to keep it around until after the download was complete,
which littered the /tmp directory with directories filled with zip files.

Since we only need a single file, Tempfile is more appropriate. We can close
the filehandle and any process that is currently reading from it (like send_file)
can continue to read even after the file is unlinked when the tempfile is
garbage collected.

A future enhancement might be to switch to the Zipline gem. That would allow
streaming the zip file while files are being added to it, allowing downloading
to begin sooner.