From ac32f06aa2a8eab7cfb397fc64a6dcbae4cac525 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Mon, 14 Mar 2011 08:41:02 -0500 Subject: [PATCH] Add `cake docs` task to generate annotated source code with docco --- Cakefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Cakefile b/Cakefile index 0641ade..81e9c19 100644 --- a/Cakefile +++ b/Cakefile @@ -1,3 +1,4 @@ +fs = require 'fs' {print} = require 'sys' {spawn} = require 'child_process' @@ -13,6 +14,14 @@ build = (watch, callback) -> coffee.stderr.on 'data', (data) -> print data.toString() coffee.on 'exit', (status) -> callback?() if status is 0 +task 'docs', 'Generate annotated source code with Docco', -> + fs.readdir 'src', (err, contents) -> + files = ("src/#{file}" for file in contents when /\.coffee$/.test file) + docco = spawn 'docco', files + docco.stdout.on 'data', (data) -> print data.toString() + docco.stderr.on 'data', (data) -> print data.toString() + docco.on 'exit', (status) -> callback?() if status is 0 + task 'build', 'Compile CoffeeScript source files', -> build()