diff --git a/lib/coffee-script/cake.js b/lib/coffee-script/cake.js index 68bd7c30..e5d3d5e6 100644 --- a/lib/coffee-script/cake.js +++ b/lib/coffee-script/cake.js @@ -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, '..')); diff --git a/lib/coffee-script/command.js b/lib/coffee-script/command.js index ae0dbccf..2e6ab84d 100644 --- a/lib/coffee-script/command.js +++ b/lib/coffee-script/command.js @@ -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 { diff --git a/src/cake.coffee b/src/cake.coffee index bd26322f..3c05cdb4 100644 --- a/src/cake.coffee +++ b/src/cake.coffee @@ -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()}" diff --git a/src/command.coffee b/src/command.coffee index 01c12b67..170bfd83 100644 --- a/src/command.coffee +++ b/src/command.coffee @@ -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.