Remove `path.exists*` as fallback for `fs.exists*`

This commit is contained in:
Marc Häfner 2013-11-22 07:24:36 +01:00
parent 22c85e216f
commit 81d8224b9a
4 changed files with 8 additions and 15 deletions

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.6.3
(function() {
var CoffeeScript, cakefileDirectory, existsSync, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
fs = require('fs');
@ -12,8 +12,6 @@
CoffeeScript = require('./coffee-script');
existsSync = fs.existsSync || path.existsSync;
tasks = {};
options = {};
@ -101,7 +99,7 @@
cakefileDirectory = function(dir) {
var parent;
if (existsSync(path.join(dir, 'Cakefile'))) {
if (fs.existsSync(path.join(dir, 'Cakefile'))) {
return dir;
}
parent = path.normalize(path.join(dir, '..'));

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.6.3
(function() {
var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, exists, forkNode, fs, helpers, hidden, joinTimeout, mkdirp, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, unwatchDir, usage, useWinPathSep, version, wait, watch, watchDir, watchedDirs, writeJs, _ref,
var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, forkNode, fs, helpers, hidden, joinTimeout, mkdirp, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, unwatchDir, usage, useWinPathSep, version, wait, watch, watchDir, watchedDirs, writeJs, _ref,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
fs = require('fs');
@ -19,8 +19,6 @@
EventEmitter = require('events').EventEmitter;
exists = fs.exists || path.exists;
useWinPathSep = path.sep === '\\';
helpers.extend(CoffeeScript, new EventEmitter);
@ -383,7 +381,7 @@
sourceCode.splice(index, 1);
if (removeJs && !opts.join) {
jsPath = outputPath(source, base);
return exists(jsPath, function(itExists) {
return fs.exists(jsPath, function(itExists) {
if (itExists) {
return fs.unlink(jsPath, function(err) {
if (err && err.code !== 'ENOENT') {
@ -444,7 +442,7 @@
});
}
};
return exists(jsDir, function(itExists) {
return fs.exists(jsDir, function(itExists) {
if (itExists) {
return compile();
} else {

View File

@ -13,8 +13,6 @@ helpers = require './helpers'
optparse = require './optparse'
CoffeeScript = require './coffee-script'
existsSync = fs.existsSync or path.existsSync
# Keep track of the list of defined tasks, the accepted options, and so on.
tasks = {}
options = {}
@ -81,7 +79,7 @@ missingTask = (task) -> fatalError "No such task: #{task}"
# When `cake` is invoked, search in the current and all parent directories
# to find the relevant Cakefile.
cakefileDirectory = (dir) ->
return dir if existsSync path.join dir, 'Cakefile'
return dir if fs.existsSync path.join dir, 'Cakefile'
parent = path.normalize path.join dir, '..'
return cakefileDirectory parent unless parent is dir
throw new Error "Cakefile not found in #{process.cwd()}"

View File

@ -14,7 +14,6 @@ mkdirp = require 'mkdirp'
{spawn, exec} = require 'child_process'
{EventEmitter} = require 'events'
exists = fs.exists or path.exists
useWinPathSep = path.sep is '\\'
# Allow CoffeeScript to emit Node.js events.
@ -260,7 +259,7 @@ removeSource = (source, base, removeJs) ->
sourceCode.splice index, 1
if removeJs and not opts.join
jsPath = outputPath source, base
exists jsPath, (itExists) ->
fs.exists jsPath, (itExists) ->
if itExists
fs.unlink jsPath, (err) ->
throw err if err and err.code isnt 'ENOENT'
@ -300,7 +299,7 @@ writeJs = (base, sourcePath, js, jsPath, generatedSourceMap = null) ->
fs.writeFile sourceMapPath, generatedSourceMap, (err) ->
if err
printLine "Could not write source map: #{err.message}"
exists jsDir, (itExists) ->
fs.exists jsDir, (itExists) ->
if itExists then compile() else mkdirp jsDir, compile
# Convenience for cleaner setTimeouts.