 _ = require 'underscore-plus'
 fs = require 'fs-plus'
 Q = require 'q'
-{deprecate} = require 'grim'
+{includeDeprecations, deprecate} = require 'grim'
 {Model} = require 'theorist'
 {Subscriber} = require 'emissary'
 {Emitter} = require 'event-kit'

  # Public: Get an {Array} of {String}s containing the paths of the project's
  # directories.
  getPaths: -> rootDirectory.getPath() for rootDirectory in @rootDirectories
  getPath: ->
    Grim.deprecate("Use ::getPaths instead")
    @getPaths()[0]

  # Public: Set the paths of the project's directories.
  #

        detail: error.message
        dismissable: true

if includeDeprecations
  Project.pathForRepositoryUrl = (repoUrl) ->
    deprecate '::pathForRepositoryUrl will be removed. Please remove from your code.'
    [repoName] = url.parse(repoUrl).path.split('/')[-1..]
    repoName = repoName.replace(/\.git$/, '')
    path.join(atom.config.get('core.projectHome'), repoName)

  Project::registerOpener = (opener) ->
    deprecate("Use Workspace::addOpener instead")
    atom.workspace.addOpener(opener)

  Project::unregisterOpener = (opener) ->
    deprecate("Call .dispose() on the Disposable returned from ::addOpener instead")
    atom.workspace.unregisterOpener(opener)

  Project::eachEditor = (callback) ->
    deprecate("Use Workspace::observeTextEditors instead")
    atom.workspace.observeTextEditors(callback)

  Project::getEditors = ->
    deprecate("Use Workspace::getTextEditors instead")
    atom.workspace.getTextEditors()

  Project::on = (eventName) ->
    if eventName is 'path-changed'
      Grim.deprecate("Use Project::onDidChangePaths instead")
    else
      Grim.deprecate("Project::on is deprecated. Use documented event subscription methods instead.")
    super

  Project::getRepo = ->
    Grim.deprecate("Use ::getRepositories instead")
    @getRepositories()[0]

  Project::getPath = ->
    Grim.deprecate("Use ::getPaths instead")
    @getPaths()[0]

  Project::setPath = (path) ->
    Grim.deprecate("Use ::setPaths instead")
    @setPaths([path])

  Project::getRootDirectory = ->
    Grim.deprecate("Use ::getDirectories instead")
    @getDirectories()[0]

  Project::resolve = (uri) ->
    Grim.deprecate("Use `Project::getDirectories()[0]?.resolve()` instead")
    @resolvePath(uri)

  Project::scan = (regex, options={}, iterator) ->
    Grim.deprecate("Use atom.workspace.scan instead of atom.project.scan")
    atom.workspace.scan(regex, options, iterator)

  Project::replace = (regex, replacementText, filePaths, iterator) ->
    Grim.deprecate("Use atom.workspace.replace instead of atom.project.replace")
    atom.workspace.replace(regex, replacementText, filePaths, iterator)

  Project::openSync = (filePath, options={}) ->
    deprecate("Use Project::open instead")
    filePath = @resolvePath(filePath)
    @buildEditorForBuffer(@bufferForPathSync(filePath), options)
