Skip to content

Commit

Permalink
Make doc generation recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobrask committed Dec 27, 2011
1 parent 66a51eb commit 1dacc7f
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions Cakefile
@@ -1,12 +1,22 @@
task 'test', 'Run the test suite', -> task 'test', 'Run the test suite', ->
require('nodeunit').reporters.default.run ['./test'] require('nodeunit').reporters.default.run ['./test']


task 'docs', 'Generate annotated source code with Docco', -> task 'docs', 'Generate annotated source code with Docco', ->
fs = require 'fs' async = require 'async'
{print} = require 'util' fs = require 'fs'
{spawn} = require 'child_process' {print} = require 'util'
fs.readdir 'lib', (err, contents) -> {exec} = require 'child_process'
files = ("lib/#{file}" for file in contents when /\.coffee$/.test file) genDocs = (root) ->
docco = spawn 'docco', files fs.readdir root, (err, paths) ->
docco.stdout.on 'data', (data) -> print data.toString() async.forEach paths,
docco.stderr.on 'data', (data) -> print data.toString() (path, cb) ->
fs.stat "#{root}/#{path}", (err, stat) ->
if stat?.isDirectory()
genDocs "#{root}/#{path}"
else if /\.coffee$/.test path
exec "docco #{root}/#{path}"
cb()
(err) ->
console.error err if err?

genDocs 'lib'

0 comments on commit 1dacc7f

Please sign in to comment.