mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Merge pull request #1388 from johnyanarella/master
'coffee' silently fails with no output when the --join option is specified and the source files specified include directories
This commit is contained in:
commit
bbf37e5229
2 changed files with 8 additions and 8 deletions
|
@ -60,7 +60,7 @@
|
||||||
for (_i = 0, _len = sources.length; _i < _len; _i++) {
|
for (_i = 0, _len = sources.length; _i < _len; _i++) {
|
||||||
source = sources[_i];
|
source = sources[_i];
|
||||||
base = path.join(source);
|
base = path.join(source);
|
||||||
compile = function(source, topLevel) {
|
compile = function(source, sourceIndex, topLevel) {
|
||||||
return path.exists(source, function(exists) {
|
return path.exists(source, function(exists) {
|
||||||
if (topLevel && !exists) {
|
if (topLevel && !exists) {
|
||||||
throw new Error("File not found: " + source);
|
throw new Error("File not found: " + source);
|
||||||
|
@ -75,14 +75,14 @@
|
||||||
_results2 = [];
|
_results2 = [];
|
||||||
for (_j = 0, _len2 = files.length; _j < _len2; _j++) {
|
for (_j = 0, _len2 = files.length; _j < _len2; _j++) {
|
||||||
file = files[_j];
|
file = files[_j];
|
||||||
_results2.push(compile(path.join(source, file)));
|
_results2.push(compile(path.join(source, file), sourceIndex));
|
||||||
}
|
}
|
||||||
return _results2;
|
return _results2;
|
||||||
});
|
});
|
||||||
} else if (topLevel || path.extname(source) === '.coffee') {
|
} else if (topLevel || path.extname(source) === '.coffee') {
|
||||||
fs.readFile(source, function(err, code) {
|
fs.readFile(source, function(err, code) {
|
||||||
if (opts.join) {
|
if (opts.join) {
|
||||||
contents[sources.indexOf(source)] = code.toString();
|
contents[sourceIndex] = helpers.compact([contents[sourceIndex], code.toString()]).join('\n');
|
||||||
if (helpers.compact(contents).length > 0) {
|
if (helpers.compact(contents).length > 0) {
|
||||||
return compileJoin();
|
return compileJoin();
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
_results.push(compile(source, true));
|
_results.push(compile(source, sources.indexOf(source), true));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
};
|
};
|
||||||
|
|
|
@ -76,7 +76,7 @@ exports.run = ->
|
||||||
compileScripts = ->
|
compileScripts = ->
|
||||||
for source in sources
|
for source in sources
|
||||||
base = path.join(source)
|
base = path.join(source)
|
||||||
compile = (source, topLevel) ->
|
compile = (source, sourceIndex, topLevel) ->
|
||||||
path.exists source, (exists) ->
|
path.exists source, (exists) ->
|
||||||
throw new Error "File not found: #{source}" if topLevel and not exists
|
throw new Error "File not found: #{source}" if topLevel and not exists
|
||||||
fs.stat source, (err, stats) ->
|
fs.stat source, (err, stats) ->
|
||||||
|
@ -84,16 +84,16 @@ compileScripts = ->
|
||||||
if stats.isDirectory()
|
if stats.isDirectory()
|
||||||
fs.readdir source, (err, files) ->
|
fs.readdir source, (err, files) ->
|
||||||
for file in files
|
for file in files
|
||||||
compile path.join(source, file)
|
compile path.join(source, file), sourceIndex
|
||||||
else if topLevel or path.extname(source) is '.coffee'
|
else if topLevel or path.extname(source) is '.coffee'
|
||||||
fs.readFile source, (err, code) ->
|
fs.readFile source, (err, code) ->
|
||||||
if opts.join
|
if opts.join
|
||||||
contents[sources.indexOf source] = code.toString()
|
contents[sourceIndex] = helpers.compact([contents[sourceIndex], code.toString()]).join('\n')
|
||||||
compileJoin() if helpers.compact(contents).length > 0
|
compileJoin() if helpers.compact(contents).length > 0
|
||||||
else
|
else
|
||||||
compileScript(source, code.toString(), base)
|
compileScript(source, code.toString(), base)
|
||||||
watch source, base if opts.watch and not opts.join
|
watch source, base if opts.watch and not opts.join
|
||||||
compile source, true
|
compile source, sources.indexOf(source), true
|
||||||
|
|
||||||
# Compile a single source script, containing the given code, according to the
|
# Compile a single source script, containing the given code, according to the
|
||||||
# requested options. If evaluating the script directly sets `__filename`,
|
# requested options. If evaluating the script directly sets `__filename`,
|
||||||
|
|
Loading…
Add table
Reference in a new issue