mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 07:28:08 +03:00
Remove unused Project::getFilePaths
This commit is contained in:
parent
fba1d486e3
commit
8e73258168
@ -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", ->
|
||||
|
@ -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("/")
|
||||
|
Loading…
Reference in New Issue
Block a user