     path.join @getCachePath(), "#{login}-#{Date.now()}"
 
   cachedAvatar: (login, callback) ->
+    glob ?= require 'glob'
     glob @avatarGlob(login), (err, files) =>
       files.sort().reverse()
       for imagePath in files

      writeStream.on 'finish', -> callback(null, imagePath)
      writeStream.on 'error', (error) -> callback(error)

      readStream = request("https://github.com/#{login}.png")
      readStream.on 'error', (error) -> callback(error)
      readStream.pipe(writeStream)

fs = require 'fs-plus'
path = require 'path'

glob = null    # defer until used
request = null # defer until used

module.exports =
class AtomIoClient
