diff --git a/Rakefile b/Rakefile index 796c9649..acc9c2ea 100644 --- a/Rakefile +++ b/Rakefile @@ -6,7 +6,7 @@ require 'yui/compressor' HEADER = <<-EOS /** - * CoffeeScript Compiler v0.7.2 + * CoffeeScript Compiler v0.9.0 * http://coffeescript.org * * Copyright 2010, Jeremy Ashkenas diff --git a/documentation/coffee/block_comment.coffee b/documentation/coffee/block_comment.coffee index 85cae37f..f1cce0b8 100644 --- a/documentation/coffee/block_comment.coffee +++ b/documentation/coffee/block_comment.coffee @@ -1,4 +1,4 @@ ### -CoffeeScript Compiler v0.7.2 +CoffeeScript Compiler v0.9.0 Released under the MIT License ### \ No newline at end of file diff --git a/documentation/docs/cake.html b/documentation/docs/cake.html index 7bcd8bdb..6ae44bcd 100644 --- a/documentation/docs/cake.html +++ b/documentation/docs/cake.html @@ -4,42 +4,40 @@ 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.
Running cake with no arguments will print out a list of all the tasks in the
-current directory's Cakefile.
External dependencies.
fs: require 'fs'
-path: require 'path'
-helpers: require('./helpers').helpers
-optparse: require './optparse'
-CoffeeScript: require './coffee-script'Keep track of the list of defined tasks, the accepted options, and so on.
tasks: {}
-options: {}
-switches: []
-oparse: nullMixin the top-level Cake functions for Cakefiles to use directly.
helpers.extend global, {Define a Cake task with a short name, an optional sentence description, +current directory's Cakefile.
External dependencies.
fs = require 'fs'
+path = require 'path'
+helpers = require('./helpers').helpers
+optparse = require './optparse'
+CoffeeScript = require './coffee-script'Keep track of the list of defined tasks, the accepted options, and so on.
tasks = {}
+options = {}
+switches = []
+oparse = nullMixin the top-level Cake functions for Cakefiles to use directly.
helpers.extend global,Define a Cake task with a short name, an optional sentence description, and the function to run as the action itself.
task: (name, description, action) ->
- [action, description]: [description, action] unless action
- tasks[name]: {name, description, action}Define an option that the Cakefile accepts. The parsed options hash, + [action, description] = [description, action] unless action + tasks[name] = {name, description, action}
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.
option: (letter, flag, description) ->
switches.push [letter, flag, description]Invoke another task in the current Cakefile.
invoke: (name) ->
missingTask name unless tasks[name]
- tasks[name].action options
-
-}Run cake. Executes all of the tasks you pass, in order. Note that Node's
+ tasks[name].action options
Run cake. 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.
exports.run: ->
+If no tasks are passed, print the help screen. exports.run = ->
path.exists 'Cakefile', (exists) ->
- throw new Error("Cakefile not found in ${process.cwd()}") unless exists
- args: process.argv[2...process.argv.length]
- CoffeeScript.run fs.readFileSync('Cakefile').toString(), {source: 'Cakefile'}
- oparse: new optparse.OptionParser switches
+ throw new Error("Cakefile not found in #{process.cwd()}") unless exists
+ args = process.argv[2...process.argv.length]
+ CoffeeScript.run fs.readFileSync('Cakefile').toString(), fileName: 'Cakefile'
+ oparse = new optparse.OptionParser switches
return printTasks() unless args.length
- options: oparse.parse(args)
- invoke arg for arg in options.argumentsDisplay the list of Cake tasks in a format similar to rake -T
printTasks: ->
+ options = oparse.parse(args)
+ invoke arg for arg in options.argumentsDisplay the list of Cake tasks in a format similar to rake -T
printTasks = ->
puts ''
- for name, task of tasks
- spaces: 20 - name.length
- spaces: if spaces > 0 then (' ' for i in [0..spaces]).join('') else ''
- desc: if task.description then "# $task.description" else ''
- puts "cake $name$spaces $desc"
- puts oparse.help() if switches.lengthPrint an error and exit when attempting to all an undefined task.
missingTask: (task) ->
- puts "No such task: \"$task\""
+ for all name, task of tasks
+ spaces = 20 - name.length
+ spaces = if spaces > 0 then (' ' for i in [0..spaces]).join('') else ''
+ desc = if task.description then "# #task.description" else ''
+ puts "cake #name#spaces #desc"
+ puts oparse.help() if switches.lengthPrint an error and exit when attempting to all an undefined task.
missingTask = (task) ->
+ puts "No such task: \"#task\""
process.exit 1