From 8dbcb44d06ca51975fe419e8ecef551bc186ad32 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 13 Mar 2013 14:39:19 -0700 Subject: [PATCH] Rename traverseTree to traverseTreeSync Also rename traverseTreeAsync to traverseTree --- spec/stdlib/fs-utils-spec.coffee | 10 +++++----- src/app/config.coffee | 4 ++-- src/app/project.coffee | 2 +- src/packages/fuzzy-finder/lib/load-paths-task.coffee | 2 +- src/stdlib/fs-utils.coffee | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/stdlib/fs-utils-spec.coffee b/spec/stdlib/fs-utils-spec.coffee index 4a4330069..ddd1f2e63 100644 --- a/spec/stdlib/fs-utils-spec.coffee +++ b/spec/stdlib/fs-utils-spec.coffee @@ -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) diff --git a/src/app/config.coffee b/src/app/config.coffee index ec54870c0..e816dc6de 100644 --- a/src/app/config.coffee +++ b/src/app/config.coffee @@ -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() diff --git a/src/app/project.coffee b/src/app/project.coffee index a0bee7fb2..678a4f2e7 100644 --- a/src/app/project.coffee +++ b/src/app/project.coffee @@ -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() diff --git a/src/packages/fuzzy-finder/lib/load-paths-task.coffee b/src/packages/fuzzy-finder/lib/load-paths-task.coffee index a674e958f..60a716688 100644 --- a/src/packages/fuzzy-finder/lib/load-paths-task.coffee +++ b/src/packages/fuzzy-finder/lib/load-paths-task.coffee @@ -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 diff --git a/src/stdlib/fs-utils.coffee b/src/stdlib/fs-utils.coffee index f129027a0..d024ae4df 100644 --- a/src/stdlib/fs-utils.coffee +++ b/src/stdlib/fs-utils.coffee @@ -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