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 .
Choose a Base Repository
jashkenas/coffeescript
CDR2003/coffee-script-lua
CreamCoderz/coffee-script
Crylock/coffee-script
GeoffreyBooth/coffeescript
Gregg/coffee-script
JulianBirch/coffee-script-1
JustinTulloss/coffee-script
MichaelBlume/coffee-script
NightMigera/coffeescript
PandaWood/coffee-script
ProximaMonkey/coffee-script
Remcoman/coffee-script
RicardoSaracino/coffee-script
SE7ENSKY/matescript
STRd6/coffee-script
ShawnFumo/coffee-script
StanAngeloff/coffee-script
Xepo/coffee-script
abi/coffee-script
agnoster/coffee-script
ahjohannessen/coffee-script
akiellor/coffee-script
alanning/coffee-script
allanberger/coffee-script
almost/coffee-script
alubbe/coffee-script
andrehjr/coffee-script
andrewschaaf/coffee-script
andreypopp/coffee-script
apanda/coffee-script
baoshitang/coffee-script
barberboy/coffee-script
benatkin/coffee-script
benbria/coffee-script
benekastah/coffee-script
bjouhier/coffee-script
blahutka/coffee-script
blossom/coffee-script
bolinfest/coffee-script
breckinloggins/coffee-script
carmelyne/contracts.coffee
chajath/coffee-script
charles-cai/coffee-script
charliesome/coffee-script
chetan51/coffee-script
chip/coffee-script
codelahoma/coffee-script
coffee-js/coffee-script
coffee-void/coffeescript
collin/coffee-script
danemorgridge/coffee-script
daveclarke/coffee-script
daveyoon/coffee-script
dbrans/coffee-script
deadprogram/coffee-script
devongovett/coffee-script
dget/coffee-script
disnet/contracts.coffee
dmohl/coffee-script
dohse/coffee-script
dqminh/coffee-script
drewlesueur/coffee-script
eventualbuddha/coffee-script
evilpie/coffee-script
excellentdrums/coffee-script
fitzgen/coffee-script
fizx/coffee-script
geraldalewis/coffee-script
germanocaldeira/coffee-script
gfodor/coffee-script
ghuntley/coffee-script
goodwink/coffee-script
gxela/coffee-script
hayeah/coffee-script
hbt/coffee-script
helixbass/copheescript
hleumas/coffee-script
holtwick/moccacino
hugs/coffee-script
ianthehenry/protoscript
ich/caffeine
janlelis/angular-coffee-script
jaredwy/coffee-script
jasonyandell/coffee-script
jawj/coffee-script
jbca/coffeescript
jiangmiao/toffee-script
jlstr/coffee-script
joelturnbull/coffee-script
johnsang/coffee-script
joliss/coffee-script
jondistad/coffee-script
joshprice/coffee-script
jstrachan/coffee-script
jugglinmike/irene-script
juilyoon/coffee-script
keichii/coffee-script
keithnorm/coffee-script
kewinwang/coffee-script
khaled/coffee-script
leeight/coffee-script
level1/coffee-script
lfendy/coffee-script
loganfsmyth/coffee-script
loopinfinito/coffeescript.com.br
lorensr/coffee-script
loveencounterflow/coffy-script
lukhnos/doubleshot
lynaghk/coffee-script
martco/coffee-script
maxtaco/coffee-script
mbbx6spp/coffee-script
mblinn/coffee-script
mehmeta/coffee-script
melcher/coffee-script
mental/coffee-script
mhart/coffee-script
michaelficarra/coffee-script
misfo/coffee-script
mizchi/coffee-script
mlinderm/coffee-script
mrlauer/coffee-script-monads
muratmeran/coffee-script
myang/coffee-script
nanqiu/coffee-script
neobine/coffee-script
netconstructor/coffee-script
nickjs/coffee-script
nihar/coffee-script
onilabs/coffee-script
paiq/blackcoffee
parkerl/coffee-script
paulmars/coffee-script
peick/coffee-script
pjaspers/coffee-script
plambert/coffee-script
poutyface/coffee-script
pschyska/coffee-script
ptoomey3/coffee-script
quangv/coffee-script
revence27/coffee-script
rkJun/coffee-script
robarondaz/coffee-script
robotlolita/coffee-script
rolftimmermans/coffee-script
rpl/coffee-script
runeb/coffee-script
rwaldron/coffee-script
rymohr/coffee-script
ryszard/coffee-script
samcday/coffee-script
sarang25491/coffee-script
satyr/coffee-script
seedjs/coffee-script
sequoiar/coffee-script
sgraham/coffee-script
shariefsk/coffee-script
shesek/coffee-script
shimaore/cake
siefkenj/gjscoffee-script
smhanov/coffee-script
soutaro/coffee-script
spaghetticode/coffee-script
sparecycles/coffee-script
spencerelliott/coffee-script
sstephenson/coffee-script
stephank/coffee-script
strangemonad/coffee-script
swistak/coffee-script
syg/heap.coffee
taku0/coffee-script
tanob/coffee-script
tglines/coffee-script
thdtjsdn/coffee-script
theIntuitionist/coffee-script
thedeeno/coffee-script
thejh/coffee-script
timruffles/coffee-script
tkpage/coffee-script
tlrobinson/coffee-script
tmishra/coffee-script
tobee/coffee-script
tomelam/coffee-script
tosh/coffee-script
tswicegood/coffee-script
ttilley/coffee-script
twilson63/coffee-script
up2u0609/coffee-script
vanviegen/coffee-script
vjpr/coffee-script
vol4ok/coffee-script
walski/coffee-script
wearefractal/yerbascript
willmoffat/coffee-script
xixixao/coffee-script
yihuang/coffee-script
zaach/coffee-script
zmthy/coffee-script
zot/coffee-script
Nothing to show
Choose a base branch
Choose a Head Repository
jashkenas/coffeescript
CDR2003/coffee-script-lua
CreamCoderz/coffee-script
Crylock/coffee-script
GeoffreyBooth/coffeescript
Gregg/coffee-script
JulianBirch/coffee-script-1
JustinTulloss/coffee-script
MichaelBlume/coffee-script
NightMigera/coffeescript
PandaWood/coffee-script
ProximaMonkey/coffee-script
Remcoman/coffee-script
RicardoSaracino/coffee-script
SE7ENSKY/matescript
STRd6/coffee-script
ShawnFumo/coffee-script
StanAngeloff/coffee-script
Xepo/coffee-script
abi/coffee-script
agnoster/coffee-script
ahjohannessen/coffee-script
akiellor/coffee-script
alanning/coffee-script
allanberger/coffee-script
almost/coffee-script
alubbe/coffee-script
andrehjr/coffee-script
andrewschaaf/coffee-script
andreypopp/coffee-script
apanda/coffee-script
baoshitang/coffee-script
barberboy/coffee-script
benatkin/coffee-script
benbria/coffee-script
benekastah/coffee-script
bjouhier/coffee-script
blahutka/coffee-script
blossom/coffee-script
bolinfest/coffee-script
breckinloggins/coffee-script
carmelyne/contracts.coffee
chajath/coffee-script
charles-cai/coffee-script
charliesome/coffee-script
chetan51/coffee-script
chip/coffee-script
codelahoma/coffee-script
coffee-js/coffee-script
coffee-void/coffeescript
collin/coffee-script
danemorgridge/coffee-script
daveclarke/coffee-script
daveyoon/coffee-script
dbrans/coffee-script
deadprogram/coffee-script
devongovett/coffee-script
dget/coffee-script
disnet/contracts.coffee
dmohl/coffee-script
dohse/coffee-script
dqminh/coffee-script
drewlesueur/coffee-script
eventualbuddha/coffee-script
evilpie/coffee-script
excellentdrums/coffee-script
fitzgen/coffee-script
fizx/coffee-script
geraldalewis/coffee-script
germanocaldeira/coffee-script
gfodor/coffee-script
ghuntley/coffee-script
goodwink/coffee-script
gxela/coffee-script
hayeah/coffee-script
hbt/coffee-script
helixbass/copheescript
hleumas/coffee-script
holtwick/moccacino
hugs/coffee-script
ianthehenry/protoscript
ich/caffeine
janlelis/angular-coffee-script
jaredwy/coffee-script
jasonyandell/coffee-script
jawj/coffee-script
jbca/coffeescript
jiangmiao/toffee-script
jlstr/coffee-script
joelturnbull/coffee-script
johnsang/coffee-script
joliss/coffee-script
jondistad/coffee-script
joshprice/coffee-script
jstrachan/coffee-script
jugglinmike/irene-script
juilyoon/coffee-script
keichii/coffee-script
keithnorm/coffee-script
kewinwang/coffee-script
khaled/coffee-script
leeight/coffee-script
level1/coffee-script
lfendy/coffee-script
loganfsmyth/coffee-script
loopinfinito/coffeescript.com.br
lorensr/coffee-script
loveencounterflow/coffy-script
lukhnos/doubleshot
lynaghk/coffee-script
martco/coffee-script
maxtaco/coffee-script
mbbx6spp/coffee-script
mblinn/coffee-script
mehmeta/coffee-script
melcher/coffee-script
mental/coffee-script
mhart/coffee-script
michaelficarra/coffee-script
misfo/coffee-script
mizchi/coffee-script
mlinderm/coffee-script
mrlauer/coffee-script-monads
muratmeran/coffee-script
myang/coffee-script
nanqiu/coffee-script
neobine/coffee-script
netconstructor/coffee-script
nickjs/coffee-script
nihar/coffee-script
onilabs/coffee-script
paiq/blackcoffee
parkerl/coffee-script
paulmars/coffee-script
peick/coffee-script
pjaspers/coffee-script
plambert/coffee-script
poutyface/coffee-script
pschyska/coffee-script
ptoomey3/coffee-script
quangv/coffee-script
revence27/coffee-script
rkJun/coffee-script
robarondaz/coffee-script
robotlolita/coffee-script
rolftimmermans/coffee-script
rpl/coffee-script
runeb/coffee-script
rwaldron/coffee-script
rymohr/coffee-script
ryszard/coffee-script
samcday/coffee-script
sarang25491/coffee-script
satyr/coffee-script
seedjs/coffee-script
sequoiar/coffee-script
sgraham/coffee-script
shariefsk/coffee-script
shesek/coffee-script
shimaore/cake
siefkenj/gjscoffee-script
smhanov/coffee-script
soutaro/coffee-script
spaghetticode/coffee-script
sparecycles/coffee-script
spencerelliott/coffee-script
sstephenson/coffee-script
stephank/coffee-script
strangemonad/coffee-script
swistak/coffee-script
syg/heap.coffee
taku0/coffee-script
tanob/coffee-script
tglines/coffee-script
thdtjsdn/coffee-script
theIntuitionist/coffee-script
thedeeno/coffee-script
thejh/coffee-script
timruffles/coffee-script
tkpage/coffee-script
tlrobinson/coffee-script
tmishra/coffee-script
tobee/coffee-script
tomelam/coffee-script
tosh/coffee-script
tswicegood/coffee-script
ttilley/coffee-script
twilson63/coffee-script
up2u0609/coffee-script
vanviegen/coffee-script
vjpr/coffee-script
vol4ok/coffee-script
walski/coffee-script
wearefractal/yerbascript
willmoffat/coffee-script
xixixao/coffee-script
yihuang/coffee-script
zaach/coffee-script
zmthy/coffee-script
zot/coffee-script
Nothing to show
Choose a head branch
4
contributors
Commits on Mar 05, 2010
|
|
jashkenas |
add proper spacing to optparse by default
|
965034e
|
Commits on Mar 06, 2010
Commits on Mar 07, 2010
Commits on Mar 08, 2010
Unified
Split
Showing
with
6,105 additions
and 2,325 deletions.
- +20 −9 Cakefile
- +1 −1 bin/coffee
- +2 −0 documentation/coffee/interpolation.coffee
- +4 −0 documentation/coffee/interpolation_expression.coffee
- +6 −6 documentation/css/docs.css
- +42 −0 documentation/docs/cake.html
- +55 −0 documentation/docs/coffee-script.html
- +115 −0 documentation/docs/command.html
- +185 −0 documentation/docs/docco.css
- +381 −0 documentation/docs/grammar.html
- +359 −0 documentation/docs/lexer.html
- +857 −0 documentation/docs/nodes.html
- +67 −0 documentation/docs/optparse.html
- +20 −0 documentation/docs/repl.html
- +191 −0 documentation/docs/rewriter.html
- +42 −0 documentation/docs/scope.html
- +79 −9 documentation/index.html.erb
- +5 −0 documentation/js/interpolation.js
- +4 −0 documentation/js/interpolation_expression.js
- +1 −1 examples/web_server.coffee
- +24 −0 extras/CoffeeScript.tmbundle/CoffeeScript.tmPreferences
- +54 −0 extras/CoffeeScript.tmbundle/Macros/Overwrite '}' in ${ __ }.tmMacro
- +16 −0 extras/CoffeeScript.tmbundle/Snippets/Embedded Code — ${…}.tmSnippet
- +17 −0 extras/CoffeeScript.tmbundle/Symbol List: Method.tmPreferences
- +306 −91 extras/CoffeeScript.tmbundle/Syntaxes/CoffeeScript.tmLanguage
- +1 −1 extras/coffee-script.js
- +160 −74 index.html
- +29 −18 lib/cake.js
- +46 −17 lib/coffee-script.js
- +72 −44 lib/{command_line.js → command.js}
- +279 −217 lib/grammar.js
- +266 −98 lib/lexer.js
- +0 −44 lib/narwhal.js
- +453 −285 lib/nodes.js
- +34 −23 lib/optparse.js
- +175 −179 lib/parser.js
- +24 −16 lib/repl.js
- +122 −119 lib/rewriter.js
- +26 −23 lib/scope.js
- +1 −1 package.json
- +32 −22 src/cake.coffee
- +45 −18 src/coffee-script.coffee
- +65 −43 src/{command_line.coffee → command.coffee}
- +346 −251 src/grammar.coffee
- +250 −129 src/lexer.coffee
- +0 −42 src/narwhal.coffee
- +421 −253 src/nodes.coffee
- +39 −24 src/optparse.coffee
- +20 −11 src/repl.coffee
- +97 −81 src/rewriter.coffee
- +27 −24 src/scope.coffee
- +2 −0 test/test_everything.coffee
- +1 −1 test/test_expressions.coffee
- +2 −0 test/test_operations.coffee
- +63 −0 test/test_string_interpolation.coffee
- +7 −7 vendor/jison/README.md
- +2 −2 vendor/jison/examples/calculator.jison
- +36 −27 vendor/jison/lib/jison.js
- +13 −10 vendor/jison/lib/jison/json2jison.js
- +1 −1 vendor/jison/lib/jison/lexer.js
- +32 −29 vendor/jison/lib/jison/util/bnf-parser.js
- +4 −5 vendor/jison/lib/jison/util/lex-parser.js
- +7 −7 vendor/jison/src/bnf.jison
- +3 −1 vendor/jison/src/bnf.jisonlex
- +0 −24 vendor/jison/src/bnf.lex.json
- +0 −30 vendor/jison/src/jisonlex.lex.json
- +25 −3 vendor/jison/tests/grammar/bnf_parse.js
- +2 −2 vendor/jison/tests/grammar/json2jison.js
- +20 −0 vendor/jison/tests/parser/api.js
- +2 −2 vendor/jison/tests/parser/lalr.js
View
29
Cakefile
| @@ -1,5 +1,5 @@ | ||
| fs: require 'fs' | ||
| -coffee: require 'coffee-script' | ||
| +CoffeeScript: require 'coffee-script' | ||
| # Run a CoffeeScript through our node/coffee interpreter. | ||
| run: (args) -> | ||
| @@ -28,6 +28,13 @@ task 'build', 'build the CoffeeScript language from source', -> | ||
| run ['-c', '-o', 'lib'].concat(files) | ||
| +task 'build:full', 'checkout /lib, rebuild the source twice, and run the tests', -> | ||
| + exec 'git co lib && bin/cake build && bin/cake build && bin/cake test', (err, stdout, stderr) -> | ||
| + print stdout if stdout | ||
| + print stderr if stderr | ||
| + throw err if err | ||
| + | ||
| + | ||
| task 'build:parser', 'rebuild the Jison parser (run build first)', -> | ||
| require.paths.unshift 'vendor/jison/lib' | ||
| parser: require('grammar').parser | ||
| @@ -41,19 +48,24 @@ task 'build:ultraviolet', 'build and install the Ultraviolet syntax highlighter' | ||
| exec 'sudo mv coffeescript.yaml /usr/local/lib/ruby/gems/1.8/gems/ultraviolet-0.10.2/syntax/coffeescript.syntax' | ||
| -task 'build:underscore', 'rebuild the Underscore.coffee documentation page', -> | ||
| - exec 'uv -s coffeescript -t idle -h examples/underscore.coffee > documentation/underscore.html' | ||
| - | ||
| - | ||
| task 'build:browser', 'rebuild the merged script for inclusion in the browser', -> | ||
| exec 'rake browser', (err) -> | ||
| throw err if err | ||
| -task 'doc', 'watch and continually rebuild the documentation', -> | ||
| +task 'doc:site', 'watch and continually rebuild the documentation for the website', -> | ||
| exec 'rake doc' | ||
| +task 'doc:source', 'rebuild the internal documentation', -> | ||
| + exec 'docco src/*.coffee && cp -rf docs documentation && rm -r docs', (err) -> | ||
| + throw err if err | ||
| + | ||
| + | ||
| +task 'doc:underscore', 'rebuild the Underscore.coffee documentation page', -> | ||
| + exec 'uv -s coffeescript -t idle -h examples/underscore.coffee > documentation/underscore.html' | ||
| + | ||
| + | ||
| task 'test', 'run the CoffeeScript language test suite', -> | ||
| process.mixin require 'assert' | ||
| test_count: 0 | ||
| @@ -68,6 +80,5 @@ task 'test', 'run the CoffeeScript language test suite', -> | ||
| puts '\033[0;32mpassed ' + test_count + ' tests in ' + time + ' seconds\033[0m' | ||
| fs.readdir 'test', (err, files) -> | ||
| for file in files | ||
| - fs.readFile 'test/' + file, (err, source) -> | ||
| - js: coffee.compile source | ||
| - process.compile js, file | ||
| + fs.readFile 'test/' + file, (err, code) -> | ||
| + CoffeeScript.run code, {source: file} | ||
View
2
bin/coffee
| @@ -6,4 +6,4 @@ var fs = require('fs'); | ||
| var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); | ||
| require.paths.unshift(lib); | ||
| -require('command_line').run(); | ||
| +require('command').run(); | ||
View
2
documentation/coffee/interpolation.coffee
| @@ -0,0 +1,2 @@ | ||
| +author: "Wittgenstein" | ||
| +quote: "A picture is a fact. -- $author" |
View
4
documentation/coffee/interpolation_expression.coffee
| @@ -0,0 +1,4 @@ | ||
| +sentence: "${ 22 / 7 } is a decent approximation of π" | ||
| + | ||
| + | ||
| + |
View
12
documentation/css/docs.css
| @@ -8,7 +8,7 @@ div.container { | ||
| width: 950px; | ||
| margin: 100px 0 50px 50px; | ||
| } | ||
| -p { | ||
| +p, li { | ||
| width: 625px; | ||
| } | ||
| a { | ||
| @@ -124,7 +124,7 @@ div.code { | ||
| #error { | ||
| position: absolute; | ||
| -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; | ||
| - right: 15px; top: 15px; left: 565px; | ||
| + right: 15px; top: 15px; left: 722px; | ||
| height: 15px; | ||
| padding: 2px 5px; | ||
| background: #fdcdcc; | ||
| @@ -142,14 +142,14 @@ div.code { | ||
| float: left; | ||
| padding: 0 20px; | ||
| border: 1px solid #bbb; | ||
| - border-top: 0; border-bottom: 0; | ||
| + border-top: 0; border-bottom: 0; border-left-width: 0; | ||
| cursor: pointer; | ||
| } | ||
| body.full_screen .navigation { | ||
| position: static; | ||
| } | ||
| - .navigation.try { | ||
| - border-left: 0; | ||
| + .navigation.toc { | ||
| + border-left-width: 1px; | ||
| } | ||
| .navigation:hover, | ||
| .navigation.active { | ||
| @@ -206,7 +206,7 @@ div.code { | ||
| } | ||
| .navigation .contents a { | ||
| display: block; | ||
| - width: 300px; | ||
| + width: 290px; | ||
| text-transform: none; | ||
| text-decoration: none; | ||
| font-weight: normal; | ||
View
42
documentation/docs/cake.html
| @@ -0,0 +1,42 @@ | ||
| +<!DOCTYPE html> <html> <head> <title>cake.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="cake.html"> cake.coffee </a> <a class="source" href="coffee-script.html"> coffee-script.coffee </a> <a class="source" href="command.html"> command.coffee </a> <a class="source" href="grammar.html"> grammar.coffee </a> <a class="source" href="lexer.html"> lexer.coffee </a> <a class="source" href="nodes.html"> nodes.coffee </a> <a class="source" href="optparse.html"> optparse.coffee </a> <a class="source" href="repl.html"> repl.coffee </a> <a class="source" href="rewriter.html"> rewriter.coffee </a> <a class="source" href="scope.html"> scope.coffee </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> cake.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-1">#</a> </div> <p><code>cake</code> is a simplified version of <a href="http://www.gnu.org/software/make/">Make</a> | ||
| +(<a href="http://rake.rubyforge.org/">Rake</a>, <a href="http://github.com/280north/jake">Jake</a>) | ||
| +for CoffeeScript. You define tasks with names and descriptions in a Cakefile, | ||
| +and can call them from the command line, or invoke them from other tasks.</p> | ||
| + | ||
| +<p>Running <code>cake</code> with no arguments will print out a list of all the tasks in the | ||
| +current directory's Cakefile.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-2">#</a> </div> <p>External dependencies.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">fs: </span> <span class="nx">require</span> <span class="s1">'fs'</span> | ||
| +<span class="nv">path: </span> <span class="nx">require</span> <span class="s1">'path'</span> | ||
| +<span class="nv">optparse: </span> <span class="nx">require</span> <span class="s1">'optparse'</span> | ||
| +<span class="nv">CoffeeScript: </span><span class="nx">require</span> <span class="s1">'coffee-script'</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-3">#</a> </div> <p>Keep track of the list of defined tasks, the accepted options, and so on.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">tasks: </span><span class="p">{}</span> | ||
| +<span class="nv">options: </span><span class="p">{}</span> | ||
| +<span class="nv">switches: </span><span class="p">[]</span> | ||
| +<span class="nv">oparse: </span><span class="kc">null</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-4">#</a> </div> <p>Mixin the top-level Cake functions for Cakefiles to use directly.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">process</span><span class="p">.</span><span class="nx">mixin</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-5">#</a> </div> <p>Define a Cake task with a short name, a sentence description, | ||
| +and the function to run as the action itself.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">task: </span><span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">description</span><span class="p">,</span> <span class="nx">action</span><span class="p">)</span> <span class="o">-></span> | ||
| + <span class="nx">tasks</span><span class="p">[</span><span class="nx">name</span><span class="p">]</span><span class="o">:</span> <span class="p">{</span><span class="nv">name: </span><span class="nx">name</span><span class="p">,</span> <span class="nv">description: </span><span class="nx">description</span><span class="p">,</span> <span class="nv">action: </span><span class="nx">action</span><span class="p">}</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-6">#</a> </div> <p>Define an option that the Cakefile accepts. The parsed options hash, | ||
| +containing all of the command-line options passed, will be made available | ||
| +as the first argument to the action.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">option: </span><span class="p">(</span><span class="nx">letter</span><span class="p">,</span> <span class="nx">flag</span><span class="p">,</span> <span class="nx">description</span><span class="p">)</span> <span class="o">-></span> | ||
| + <span class="nx">switches</span><span class="p">.</span><span class="nx">push</span> <span class="p">[</span><span class="nx">letter</span><span class="p">,</span> <span class="nx">flag</span><span class="p">,</span> <span class="nx">description</span><span class="p">]</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-7">#</a> </div> <p>Invoke another task in the current Cakefile.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">invoke: </span><span class="p">(</span><span class="nx">name</span><span class="p">)</span> <span class="o">-></span> | ||
| + <span class="nx">no_such_task</span> <span class="nx">name</span> <span class="nx">unless</span> <span class="nx">tasks</span><span class="p">[</span><span class="nx">name</span><span class="p">]</span> | ||
| + <span class="nx">tasks</span><span class="p">[</span><span class="nx">name</span><span class="p">].</span><span class="nx">action</span> <span class="nx">options</span> | ||
| + | ||
| +<span class="p">}</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-8">#</a> </div> <p>Run <code>cake</code>. Executes all of the tasks you pass, in order. Note that Node's | ||
| +asynchrony may cause tasks to execute in a different order than you'd expect. | ||
| +If no tasks are passed, print the help screen.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.run: </span><span class="o">-></span> | ||
| + <span class="nx">path</span><span class="p">.</span><span class="nx">exists</span> <span class="s1">'Cakefile'</span><span class="p">,</span> <span class="p">(</span><span class="nx">exists</span><span class="p">)</span> <span class="o">-></span> | ||
| + <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s2">"Cakefile not found in ${process.cwd()}"</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="mi">2</span><span class="p">...</span><span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">.</span><span class="nx">length</span><span class="p">]</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">'Cakefile'</span><span class="p">),</span> <span class="p">{</span><span class="nv">source: </span><span class="s1">'Cakefile'</span><span class="p">}</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">print_tasks</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> | ||
| + <span class="nx">invoke</span> <span class="nx">arg</span> <span class="k">for</span> <span class="nx">arg</span> <span class="k">in</span> <span class="nx">options</span><span class="p">.</span><span class="nx">arguments</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-9">#</a> </div> <p>Display the list of Cake tasks in a format similar to <code>rake -T</code></p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">print_tasks: </span><span class="o">-></span> | ||
| + <span class="nx">puts</span> <span class="s1">''</span> | ||
| + <span class="k">for</span> <span class="nx">name</span><span class="p">,</span> <span class="nx">task</span> <span class="k">of</span> <span class="nx">tasks</span> | ||
| + <span class="nv">spaces: </span><span class="mi">20</span> <span class="o">-</span> <span class="nx">name</span><span class="p">.</span><span class="nx">length</span> | ||
| + <span class="nv">spaces: </span><span class="k">if</span> <span class="nx">spaces</span> <span class="o">></span> <span class="mi">0</span> <span class="k">then</span> <span class="p">(</span><span class="s1">' '</span> <span class="k">for</span> <span class="nx">i</span> <span class="k">in</span> <span class="p">[</span><span class="mi">0</span><span class="p">..</span><span class="nx">spaces</span><span class="p">]).</span><span class="nx">join</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span> <span class="k">else</span> <span class="s1">''</span> | ||
| + <span class="nx">puts</span> <span class="s2">"cake $name$spaces # ${task.description}"</span> | ||
| + <span class="nx">puts</span> <span class="nx">oparse</span><span class="p">.</span><span class="nx">help</span><span class="p">()</span> <span class="k">if</span> <span class="nx">switches</span><span class="p">.</span><span class="nx">length</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-10">#</a> </div> <p>Print an error and exit when attempting to all an undefined task.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">no_such_task: </span><span class="p">(</span><span class="nx">task</span><span class="p">)</span> <span class="o">-></span> | ||
| + <span class="nx">process</span><span class="p">.</span><span class="nx">stdio</span><span class="p">.</span><span class="nx">writeError</span> <span class="s2">"No such task: \"$task\"\n"</span> | ||
| + <span class="nx">process</span><span class="p">.</span><span class="nx">exit</span> <span class="mi">1</span> | ||
| + | ||
| +</pre></div> </td> </tr> </tbody> </table> </div> </body> </html> |
Oops, something went wrong.