Permalink
Browse files

added coffee output to command line program

  • Loading branch information...
malgorithms committed Aug 28, 2012
1 parent 5cbefaa commit 09874c2c0bb1e29e78a49a5a0bfcb7a66896e03d
Showing with 31 additions and 11 deletions.
  1. +15 −5 lib/command_line.js
  2. +1 −1 lib/errorHandler.js
  3. +12 −3 src/command_line.coffee
  4. +2 −2 src/errorHandler.coffee
  5. +1 −0 test/express3/public/javascripts/test_cases.js
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -53,11 +53,14 @@ compile = (start_path, path) ->
bundlePath: bundle_path
browserMode: true
minimize: program.minimize? and program.minimize
- js = v._toJavaScript()
+ if program.coffee
+ output = v._toCoffee()
+ else
+ output = v._toJavaScript()
if v.error
process.stderr.write v.error.getPrettyPrintText()
process.exit 1
- js
+ output
# -----------------------------------------------------------------------------
@@ -91,7 +94,13 @@ run = exports.run = ->
console.log "Input file/path not found. toffee --help for examples"
process.exit 1
start_path = path.normalize start_path
- out_text = """#{getCommonHeadersJs true, true}\n#{recurseRun start_path, start_path, ''}"""
+ template_out = recurseRun start_path, start_path, ''
+ header_out = getCommonHeadersJs true, true
+ if program.coffee
+ out_text = "`#{header_out}`\n#{template_out}"
+ else
+ out_text = "#{header_out}\n;\n#{template_out}"
+
if program.print
console.log out_text
if program.output
View
@@ -151,10 +151,10 @@ class toffeeError
res = ""
header = "#{cerr.dir_name}/<span style=\"background-color:#fde\"><b>#{cerr.file}</b>: #{_ppEscape cerr.message}</span>"
res += """
- <div style="line-height:1.05em;border:1px solid #999;margin:10px;padding:10px;background-color:#fff;position:fixed;top:0;left:0;max-width:90%;z-index:9999;max-height:90%;overflow:scroll;">
+ <div style="line-height:13px;border:1px solid #999;margin:10px;padding:10px;background-color:#fff;position:fixed;top:0;left:0;max-width:90%;z-index:9999;max-height:90%;overflow:scroll;">
\n<pre>#{header}</pre>
\n<hr />
- \n<div style=\"font-family:courier new;font-size:10pt;color:#900;width:100%;\">
+ \n<div style=\"font-family:courier new;font-size:12px;color:#900;width:100%;\">
"""
if cerr.stack?.length
res += "<div style=\"border:1px solid #000;background-color:#eee;width:100%;\">"

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 09874c2

Please sign in to comment.