Rename traverseTree to traverseTreeSync

Also rename traverseTreeAsync to traverseTree
This commit is contained in:
Kevin Sawicki
2013-03-13 14:39:19 -07:00
parent 8fe9e31c08
commit 8dbcb44d06
5 changed files with 13 additions and 13 deletions

View File

@@ -77,7 +77,7 @@ describe "fs", ->
fs.makeTree("/tmp/a/b/c")
expect(fs.exists("/tmp/a/b/c")).toBeTruthy()
describe ".traverseTree(path, onFile, onDirectory)", ->
describe ".traverseTreeSync(path, onFile, onDirectory)", ->
fixturesDir = null
beforeEach ->
@@ -88,7 +88,7 @@ describe "fs", ->
onPath = (path) ->
paths.push(fs.join(fixturesDir, path))
true
fs.traverseTree fixturesDir, onPath, onPath
fs.traverseTreeSync fixturesDir, onPath, onPath
expect(paths).toEqual fs.listTree(fixturesDir)
it "does not recurse into a directory if it is pruned", ->
@@ -99,7 +99,7 @@ describe "fs", ->
else
paths.push(path)
true
fs.traverseTree fixturesDir, onPath, onPath
fs.traverseTreeSync fixturesDir, onPath, onPath
expect(paths.length).toBeGreaterThan 0
for path in paths
@@ -112,8 +112,8 @@ describe "fs", ->
paths = []
onPath = (path) -> paths.push(path)
fs.traverseTree(fs.join(fixturesDir, 'symlink-to-dir'), onSymlinkPath, onSymlinkPath)
fs.traverseTree(fs.join(fixturesDir, 'dir'), onPath, onPath)
fs.traverseTreeSync(fs.join(fixturesDir, 'symlink-to-dir'), onSymlinkPath, onSymlinkPath)
fs.traverseTreeSync(fs.join(fixturesDir, 'dir'), onPath, onPath)
expect(symlinkPaths).toEqual(paths)

View File

@@ -39,14 +39,14 @@ class Config
templatePath = fs.join(templateConfigDirPath, path)
configPath = fs.join(@configDirPath, path)
fs.write(configPath, fs.read(templatePath))
fs.traverseTree(templateConfigDirPath, onConfigDirFile, (path) -> true)
fs.traverseTreeSync(templateConfigDirPath, onConfigDirFile, (path) -> true)
configThemeDirPath = fs.join(@configDirPath, 'themes')
onThemeDirFile = (path) ->
templatePath = fs.join(bundledThemesDirPath, path)
configPath = fs.join(configThemeDirPath, path)
fs.write(configPath, fs.read(templatePath))
fs.traverseTree(bundledThemesDirPath, onThemeDirFile, (path) -> true)
fs.traverseTreeSync(bundledThemesDirPath, onThemeDirFile, (path) -> true)
load: ->
@initializeConfigDirectory()

View File

@@ -70,7 +70,7 @@ class Project
paths = []
onFile = (path) => paths.push(path) unless @isPathIgnored(path)
onDirectory = -> true
fs.traverseTree(@getPath(), onFile, onDirectory)
fs.traverseTreeSync(@getPath(), onFile, onDirectory)
deferred.resolve(paths)
deferred.promise()

View File

@@ -27,7 +27,7 @@ class LoadPathsTask
onDone = =>
@callback(paths) unless @aborted
fs.traverseTreeAsync(rootPath, onFile, onDirectory, onDone)
fs.traverseTree(rootPath, onFile, onDirectory, onDone)
abort: ->
@aborted = true

View File

@@ -92,7 +92,7 @@ module.exports =
onPath = (path) =>
paths.push(@join(rootPath, path))
false
@traverseTree(rootPath, onPath, onPath)
@traverseTreeSync(rootPath, onPath, onPath)
paths
listTree: (rootPath) ->
@@ -100,7 +100,7 @@ module.exports =
onPath = (path) =>
paths.push(@join(rootPath, path))
true
@traverseTree(rootPath, onPath, onPath)
@traverseTreeSync(rootPath, onPath, onPath)
paths
move: (source, target) ->
@@ -152,7 +152,7 @@ module.exports =
@makeTree(@directory(path))
@makeDirectory(path)
traverseTree: (rootPath, onFile, onDirectory) ->
traverseTreeSync: (rootPath, onFile, onDirectory) ->
return unless @isDirectory(rootPath)
traverse = (rootPath, prefix, onFile, onDirectory) =>
@@ -168,7 +168,7 @@ module.exports =
traverse(rootPath, '', onFile, onDirectory)
traverseTreeAsync: (rootPath, onFile, onDirectory, onDone) ->
traverseTree: (rootPath, onFile, onDirectory, onDone) ->
pathCounter = 0
startPath = -> pathCounter++
endPath = -> onDone() if --pathCounter is 0