[proxy] web.archive.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: jashkenas/coffeescript
base: 1.0.0
head repository: jashkenas/coffeescript
compare: 1.0.1
6 contributors
Commits on Dec 27, 2010
Commits on Dec 28, 2010
Commits on Dec 29, 2010
Commits on Dec 31, 2010
Commits on Jan 02, 2011
  * _test_existence.coffee
  * _test_pattern_matching.coffee
Commits on Jan 03, 2011
Also added `global ?= window` where necessary. Firefox seems to be
complaining about an unexpected lambda still, though.
Commits on Jan 06, 2011
Commits on Jan 07, 2011
Commits on Jan 11, 2011
Commits on Jan 13, 2011
This change allows files to be `--require`d before entering the REPL. It's also
an opimization, since files are `--require`d only once, rather than being
required again every time a file is compiled.

A secondary change is that `module.filename` is temporarily modified. This is
somewhat less aesthetically appealing than the old approach of using
fs.realpathSync, but it allows you to run `coffee -r ./foo` rather than having
to write `coffee -r ./foo.coffee`, since Node does not accept absolute paths
without a file extension.
Commits on Jan 15, 2011
Commits on Jan 18, 2011
Commits on Jan 19, 2011
Commits on Jan 30, 2011
Commits on Jan 31, 2011
Commits on Feb 01, 2011
Showing with 2,408 additions and 2,186 deletions.
  1. +14 −9 Cakefile
  2. +1 −1 LICENSE
  3. +1 −1 documentation/coffee/block_comment.coffee
  4. +4 −4 documentation/coffee/do.coffee
  5. +1 −0 documentation/css/docs.css
  6. +1 −1 documentation/docs/cake.html
  7. +4 −4 documentation/docs/coffee-script.html
  8. +18 −16 documentation/docs/command.html
  9. +17 −15 documentation/docs/grammar.html
  10. +8 −6 documentation/docs/lexer.html
  11. +47 −37 documentation/docs/nodes.html
  12. +1 −1 documentation/docs/optparse.html
  13. +12 −7 documentation/docs/repl.html
  14. +1 −1 documentation/docs/scope.html
  15. +1 −1 documentation/docs/underscore.html
  16. BIN documentation/images/favicon.ico
  17. +22 −8 documentation/index.html.erb
  18. +1 −1 documentation/js/block_comment.js
  19. +6 −6 documentation/js/do.js
  20. +1 −1 documentation/js/soaks.js
  21. +1 −1 examples/underscore.coffee
  22. +3 −3 extras/coffee-script.js
  23. +37 −23 index.html
  24. +1 −1 lib/cake.js
  25. +5 −5 lib/coffee-script.js
  26. +22 −18 lib/command.js
  27. +18 −13 lib/grammar.js
  28. +12 −7 lib/lexer.js
  29. +69 −53 lib/nodes.js
  30. +1 −1 lib/optparse.js
  31. +20 −13 lib/parser.js
  32. +15 −10 lib/repl.js
  33. +1 −1 package.json
  34. +1 −1 src/cake.coffee
  35. +4 −4 src/coffee-script.coffee
  36. +14 −9 src/command.coffee
  37. +17 −15 src/grammar.coffee
  38. +8 −6 src/lexer.coffee
  39. +48 −38 src/nodes.coffee
  40. +1 −1 src/optparse.coffee
  41. +13 −8 src/repl.coffee
  42. +1 −1 src/scope.coffee
  43. +37 −0 test/array_literals.coffee
  44. +203 −33 test/assignment.coffee
  45. +21 −0 test/boolean_literals.coffee
  46. +0 −18 test/break.coffee
  47. +4 −0 test/cake.coffee
  48. +42 −1 test/{test_classes.coffee → classes.coffee}
  49. +4 −0 test/command.coffee
  50. +3 −0 test/comments.coffee
  51. +57 −0 test/compilation.coffee
  52. +53 −1 test/{test_comprehensions.coffee → comprehensions.coffee}
  53. +0 −181 test/conditionals.coffee
  54. +418 −0 test/control_flow.coffee
  55. +2 −2 test/exception_handling.coffee
  56. +106 −0 test/formatting.coffee
  57. +366 −0 test/function_invocation.coffee
  58. +64 −42 test/{arguments.coffee → function_literals.coffee}
  59. +42 −36 test/{test_strings.coffee → interpolation.coffee}
  60. +10 −0 test/javascript_literals.coffee
  61. +39 −0 test/number_literals.coffee
  62. +85 −160 test/{test_literals.coffee → object_literals.coffee}
  63. +56 −61 test/operators.coffee
  64. +5 −0 test/{test_option_parser.coffee → option_parser.coffee}
  65. +85 −0 test/range_literals.coffee
  66. +7 −16 test/{regular_expressions.coffee → regular_expression_literals.coffee}
  67. +4 −0 test/repl.coffee
  68. +22 −0 test/scope.coffee
  69. +7 −77 test/{ranges_slices_and_splices.coffee → slicing_and_splicing.coffee}
  70. +134 −0 test/soaks.coffee
  71. +35 −39 test/{test_heredocs.coffee → string_literals.coffee}
  72. +24 −19 test/test.html
  73. +0 −77 test/test_chaining.coffee
  74. +0 −26 test/test_compilation.coffee
  75. +0 −165 test/test_existence.coffee
  76. +0 −379 test/test_functions.coffee
  77. +0 −162 test/test_pattern_matching.coffee
  78. +0 −63 test/test_returns.coffee
  79. +0 −102 test/test_splats.coffee
  80. +0 −103 test/test_switch.coffee
  81. +0 −71 test/test_while.coffee
@@ -16,7 +16,7 @@ header = """
* CoffeeScript Compiler v#{CoffeeScript.VERSION}
* http://coffeescript.org
*
* Copyright 2010, Jeremy Ashkenas
* Copyright 2011, Jeremy Ashkenas
* Released under the MIT License
*/
"""
@@ -50,10 +50,10 @@ task 'install', 'install CoffeeScript into /usr/local (or --prefix)', (options)
exec([
"mkdir -p #{lib} #{bin}"
"cp -rf bin lib LICENSE README package.json src #{lib}"
"ln -sf #{lib}/bin/coffee #{bin}/coffee"
"ln -sf #{lib}/bin/cake #{bin}/cake"
"ln -sfn #{lib}/bin/coffee #{bin}/coffee"
"ln -sfn #{lib}/bin/cake #{bin}/cake"
"mkdir -p ~/.node_libraries"
"ln -sf #{lib}/lib #{node}"
"ln -sfn #{lib}/lib #{node}"
].join(' && '), (err, stdout, stderr) ->
if err then console.log stderr.trim() else log 'done', green
)
@@ -104,6 +104,7 @@ task 'build:browser', 'rebuild the merged script for inclusion in the browser',
"""
code = uglify.gen_code uglify.ast_squeeze uglify.ast_mangle ast, extra: yes
fs.writeFileSync 'extras/coffee-script.js', header + '\n' + code
console.log "built ... running browser tests:"
invoke 'test:browser'


@@ -150,6 +151,9 @@ runTests = (CoffeeScript) ->
passedTests = 0
failures = []

# make "global" reference available to tests
global.global = global

# Mix in the assert module globally, to make it available for tests.
addGlobal = (name, func) ->
global[name] = ->
@@ -165,7 +169,8 @@ runTests = (CoffeeScript) ->
# Our test helper function for delimiting different test cases.
global.test = (description, fn) ->
try
fn()
fn.test = {description, currentFile}
fn.call(fn)
catch e
e.description = description if description?
e.source = fn.toString() if fn.toString?
@@ -208,11 +213,11 @@ runTests = (CoffeeScript) ->
fs.readdir 'test', (err, files) ->
files.forEach (file) ->
return unless file.match(/\.coffee$/i)
fileName = path.join 'test', file
fs.readFile fileName, (err, code) ->
currentFile = fileName
filename = path.join 'test', file
fs.readFile filename, (err, code) ->
currentFile = filename
try
CoffeeScript.run code.toString(), {fileName}
CoffeeScript.run code.toString(), {filename}
catch e
failures.push file: currentFile, error: e

@@ -1,4 +1,4 @@
Copyright (c) 2010 Jeremy Ashkenas
Copyright (c) 2011 Jeremy Ashkenas

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -1,5 +1,5 @@
###
CoffeeScript Compiler v1.0.0
CoffeeScript Compiler v1.0.1
Released under the MIT License
###

@@ -1,4 +1,4 @@
for fileName in list
do (fileName) ->
fs.readFile fileName, (err, contents) ->
compile fileName, contents.toString()
for filename in list
do (filename) ->
fs.readFile filename, (err, contents) ->
compile filename, contents.toString()
@@ -45,6 +45,7 @@ table {
}
td {
padding: 9px 15px 9px 0;
vertical-align: top;
}
table.definitions {
width: auto;
@@ -25,7 +25,7 @@
<span class="nx">path</span><span class="p">.</span><span class="nx">exists</span> <span class="s1">&#39;Cakefile&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nx">exists</span><span class="p">)</span> <span class="o">-&gt;</span>
<span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s2">&quot;Cakefile not found in #{process.cwd()}&quot;</span><span class="p">)</span> <span class="nx">unless</span> <span class="nx">exists</span>
<span class="nv">args = </span><span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">.</span><span class="nx">slice</span> <span class="mi">2</span>
<span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">run</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="s1">&#39;Cakefile&#39;</span><span class="p">).</span><span class="nx">toString</span><span class="p">(),</span> <span class="nx">fileName</span><span class="o">:</span> <span class="s1">&#39;Cakefile&#39;</span>
<span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">run</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="s1">&#39;Cakefile&#39;</span><span class="p">).</span><span class="nx">toString</span><span class="p">(),</span> <span class="nx">filename</span><span class="o">:</span> <span class="s1">&#39;Cakefile&#39;</span>
<span class="nv">oparse = </span><span class="k">new</span> <span class="nx">optparse</span><span class="p">.</span><span class="nx">OptionParser</span> <span class="nx">switches</span>
<span class="k">return</span> <span class="nx">printTasks</span><span class="p">()</span> <span class="nx">unless</span> <span class="nx">args</span><span class="p">.</span><span class="nx">length</span>
<span class="nv">options = </span><span class="nx">oparse</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">args</span><span class="p">)</span>

Showing you all comments on commits in this comparison.

This comment has been minimized.

Copy link
Collaborator

michaelficarra commented on 6d3f272 Dec 27, 2010

Just for the record, this was for issue #972.

This comment has been minimized.

Copy link
Contributor

geraldalewis commented on 6832dda Jan 7, 2011

Much much more clean -- thank you Michael :)

This comment has been minimized.

Copy link
Collaborator

michaelficarra commented on 1f2f55b Jan 19, 2011

Maybe you should instead use .toLocaleTimeString()? We should know our own timezone information. And the day may be important as well, so maybe include .toDateString() or .toLocaleDateString()?

This comment has been minimized.

Copy link
Owner Author

jashkenas commented on 1f2f55b Jan 20, 2011

Thanks -- I've changed it to toLocaleTimeString in SHA: 7625d90

This comment has been minimized.

Copy link
Collaborator

michaelficarra commented on 49d9eb6 Jan 30, 2011

This should use the i & 1 method of checking parity to promote best practices.

This comment has been minimized.

Copy link
Owner Author

jashkenas commented on 49d9eb6 Jan 30, 2011

'fraid I disagree, in the name of clarity. But I'd be fine with exchanging it for a less controversial example.

This comment has been minimized.

Copy link
Collaborator

michaelficarra commented on 49d9eb6 Jan 30, 2011

Take one from underscore:

Array::compact = -> x for x in this when x

Too simple?

This comment has been minimized.

Copy link
Owner Author

jashkenas commented on 49d9eb6 Jan 31, 2011

Too tautological. We need the "when" clause to express the conditional bit. Revised here: 6fb2088

This comment has been minimized.

Copy link
Collaborator

michaelficarra commented on 6fb2088 Jan 31, 2011

This is definitely an improvement.

This comment has been minimized.

Copy link
Collaborator

michaelficarra commented on 49d9eb6 Jan 31, 2011

The condition was a truthiness check on x, but your new example is good, too.