         callback error, auth
 
 exports.setupDrive = (auth, callback) ->
-  console.log 'setupDrive - loading google drive api'
+  console.log 'setupDrive - loading google drive api' if exports.trace
   googleapis.discover 'drive', 'v2'
   .execute (error, client) ->
     callback error, auth, client
 
 exports.listProjects = (auth, client, callback) ->
-  console.log "listing projects"
+  console.log "listing projects" if exports.trace
   client.drive.files
     .list q: "mimeType='application/vnd.google-apps.script'"
     .withAuthClient auth
     .execute (error, result) ->
       callback error, result, auth, client
 
-selectProject = (projects, auth, client, callback) ->
-  console.log 'project titles: ' +
+exports.selectProject = (projects, auth, client, callback) ->
+  console.log 'project titles: ' + if exports.trace
     ("'#{project.title}'" for project in projects)
   console.dir projects[0]
   exportLinks = (project.exportLinks for project in projects)

    "#{id}&format=json"]
  callback null, id, testLink, auth, client

loadProjectFile = (id, links, auth, client, callback) ->
  console.log "loading project file #{id}."
  client.drive.files
  .get fileId:id
  .withAuthClient auth
  .execute (error, projectFile) ->
    if error.code == 404
      console.log "failed to load project file."
      error = null
      projectFile = id:id
    callback error, projectFile, links, auth, client

downloadProject = (project, links, auth, client, callback) ->
  console.log 'project export links: ' + links
  request links[0],
    auth:
      bearer: auth.credentials.access_token

    (error, response, body) ->
      callback error, project, auth, client, body

exports.updateFile = (project, auth, client, body, callback) ->
  console.dir body
  file = null
  for file in body.files
