mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
removing the special-case std-reading in favor of '--eval'
This commit is contained in:
parent
42ca566d26
commit
a80b532a05
2 changed files with 15 additions and 19 deletions
|
@ -41,7 +41,7 @@ exports.compileFile = function(path) {
|
|||
}
|
||||
|
||||
exports.compile = function(source) {
|
||||
var coffee = OS.popen([coffeePath, "-"]);
|
||||
var coffee = OS.popen([coffeePath, "-e"]);
|
||||
|
||||
coffee.stdin.write(source).flush().close();
|
||||
|
||||
|
|
|
@ -41,15 +41,11 @@ Usage:
|
|||
# Compiles (or partially compiles) the source CoffeeScript file, returning
|
||||
# the desired JS, tokens, or lint results.
|
||||
def compile_javascript(source)
|
||||
if source == "-"
|
||||
script = STDIN.read
|
||||
else
|
||||
script = File.read(source)
|
||||
end
|
||||
return tokens(script) if @options[:tokens]
|
||||
js = compile(script, source)
|
||||
return unless js
|
||||
return puts(js) if @options[:print] or source == "-"
|
||||
return puts(js) if @options[:print]
|
||||
return lint(js) if @options[:lint]
|
||||
File.open(path_for(source), 'w+') {|f| f.write(js) }
|
||||
end
|
||||
|
@ -77,7 +73,7 @@ Usage:
|
|||
# Ensure that all of the source files exist.
|
||||
def check_sources
|
||||
usage if @sources.empty?
|
||||
missing = @sources.detect {|s| !File.exists?(s) and s != "-" }
|
||||
missing = @sources.detect {|s| !File.exists?(s) }
|
||||
if missing
|
||||
STDERR.puts("File not found: '#{missing}'")
|
||||
exit(1)
|
||||
|
|
Loading…
Add table
Reference in a new issue