     files = sources.slice(0)
     next_file = -> generate_documentation files.shift(), next_file if files.length
     next_file()
-

# Compute the destination HTML path for an input source file path. If the source
# is `lib/example.coffee`, the HTML will be at `docs/example.html`
destination = (filepath) ->
  'docs/' + path.basename(filepath, path.extname(filepath)) + '.html'

# Ensure that the destination directory exists.
ensure_directory = (dir, callback) ->

generate_html = (source, sections) ->
  title = path.basename source
  dest  = destination source
  html  = docco_template {title, sections, sources, path, destination}
  console.log "docco: #{source} -> #{dest}"
  fs.writeFile dest, html

