diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 652b36400..a883ccbe4 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -280,76 +280,6 @@ describe "Project", -> expect(project.getPath()?).toBeFalsy() expect(project.getRootDirectory()?).toBeFalsy() - describe ".getFilePaths()", -> - it "returns file paths using a promise", -> - paths = null - waitsForPromise -> - project.getFilePaths().done (foundPaths) -> paths = foundPaths - - runs -> - expect(paths.length).toBeGreaterThan 0 - - it "ignores files that return true from atom.ignorePath(path)", -> - spyOn(project, 'isPathIgnored').andCallFake (filePath) -> path.basename(filePath).match /a$/ - - paths = null - waitsForPromise -> - project.getFilePaths().done (foundPaths) -> paths = foundPaths - - runs -> - expect(paths).not.toContain(project.resolve('a')) - expect(paths).toContain(project.resolve('b')) - - describe "when config.core.hideGitIgnoredFiles is true", -> - it "ignores files that are present in .gitignore if the project is a git repo", -> - config.set "core.hideGitIgnoredFiles", true - project.setPath(path.join(__dirname, 'fixtures', 'git', 'working-dir')) - paths = null - waitsForPromise -> - project.getFilePaths().done (foundPaths) -> paths = foundPaths - - runs -> - expect(paths).not.toContain('ignored.txt') - - describe "ignored file name", -> - ignoredFile = null - - beforeEach -> - ignoredFile = path.join(__dirname, 'fixtures', 'dir', 'ignored.txt') - fs.writeSync(ignoredFile, "") - - afterEach -> - fs.remove(ignoredFile) - - it "ignores ignored.txt file", -> - paths = null - config.pushAtKeyPath("core.ignoredNames", "ignored.txt") - waitsForPromise -> - project.getFilePaths().done (foundPaths) -> paths = foundPaths - - runs -> - expect(paths).not.toContain('ignored.txt') - - describe "ignored folder name", -> - ignoredFile = null - - beforeEach -> - ignoredFile = path.join(__dirname, 'fixtures', 'dir', 'ignored', 'ignored.txt') - fs.writeSync(ignoredFile, "") - - afterEach -> - fs.remove(ignoredFile) - - it "ignores ignored folder", -> - paths = null - config.get("core.ignoredNames").push("ignored.txt") - config.set("core.ignoredNames", config.get("core.ignoredNames")) - waitsForPromise -> - project.getFilePaths().done (foundPaths) -> paths = foundPaths - - runs -> - expect(paths).not.toContain('ignored/ignored.txt') - describe ".scan(options, callback)", -> describe "when called with a regex", -> it "calls the callback with all regex results in all files in the project", -> diff --git a/src/project.coffee b/src/project.coffee index a3c2feae7..8c9688a6e 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -132,19 +132,6 @@ class Project getRootDirectory: -> @rootDirectory - # Public: Fetches the name of every file (that's not `git ignore`d) in the - # project. - # - # Returns an {Array} of {String}s. - getFilePaths: -> - deferred = $.Deferred() - paths = [] - onFile = (path) => paths.push(path) unless @isPathIgnored(path) - onDirectory = -> true - fsUtils.traverseTreeSync(@getPath(), onFile, onDirectory) - deferred.resolve(paths) - deferred.promise() - # Public: Determines if a path is ignored via Atom configuration. isPathIgnored: (path) -> for segment in path.split("/")