switching to 'Compiled' messages after the code has finished compiling on --watch ...

This commit is contained in:
Jeremy Ashkenas 2010-06-13 14:21:02 -04:00
parent 3bcca99cba
commit 4ecb1bb2ed
3 changed files with 11 additions and 10 deletions

View File

@ -153,9 +153,6 @@
if (curr.mtime.getTime() === prev.mtime.getTime()) {
return null;
}
if (options.compile) {
puts(("Compiled " + source));
}
return fs.readFile(source, function(err, code) {
return compileScript(source, code.toString(), base);
});
@ -172,7 +169,11 @@
dir = options.output ? path.join(options.output, baseDir) : srcDir;
jsPath = path.join(dir, filename);
compile = function() {
return fs.writeFile(jsPath, js);
return fs.writeFile(jsPath, js, function(err) {
if (options.compile && options.watch) {
return puts(("Compiled " + source));
}
});
};
return path.exists(dir, function(exists) {
if (exists) {

View File

@ -255,7 +255,6 @@
return this;
}
this.expressions[idx] = last.makeReturn();
// unless last.containsPureStatement()
return this;
};
// An **Expressions** is the only node that can serve as the root.

View File

@ -114,7 +114,6 @@ compileStdio: ->
watch: (source, base) ->
fs.watchFile source, {persistent: true, interval: 500}, (curr, prev) ->
return if curr.mtime.getTime() is prev.mtime.getTime()
puts "Compiled $source" if options.compile
fs.readFile source, (err, code) -> compileScript(source, code.toString(), base)
# Write out a JavaScript source file with the compiled code. By default, files
@ -122,11 +121,13 @@ watch: (source, base) ->
# directory can be customized with `--output`.
writeJs: (source, js, base) ->
filename: path.basename(source, path.extname(source)) + '.js'
srcDir: path.dirname source
baseDir: srcDir.substring base.length
srcDir: path.dirname source
baseDir: srcDir.substring base.length
dir: if options.output then path.join options.output, baseDir else srcDir
jsPath: path.join dir, filename
compile: -> fs.writeFile jsPath, js
jsPath: path.join dir, filename
compile: ->
fs.writeFile jsPath, js, (err) ->
puts "Compiled $source" if options.compile and options.watch
path.exists dir, (exists) ->
if exists then compile() else exec "mkdir -p $dir", compile