Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (53 sloc) 1.74 KB
fs = require 'fs'
{spawn, exec} = require 'child_process'
{basename, join} = require 'path'
task 'build', "Build CoffeeScript source files", ->
coffee = spawn 'coffee', ['-cw', '-o', 'lib', 'src']
coffee.stdout.on 'data', (data) -> process.stderr.write data.toString()
task 'test', "Run test suite", ->
process.chdir __dirname
{reporters} = require 'nodeunit' ['test']
task 'man', "Build manuals", ->
fs.readdir "doc/", (err, files) ->
for file in files when /\.md/.test file
source = join "doc", file
target = join "man", basename source, ".md"
exec "ronn --pipe --roff #{source} > #{target}", (err) ->
throw err if err
task 'pages', "Build pages", ->
{series, parallel} = require 'async'
sh = (command) -> (k) -> exec command, k
buildMan = (callback) ->
series [
(sh "cp doc/")
(sh "ronn -stoc -5 doc/*.md")
(sh "mv doc/*.html pages/")
(sh "rm doc/")
], callback
buildAnnotations = (callback) ->
series [
(sh "docco src/**/*.coffee")
(sh "mv docs/* pages/annotations")
(sh "rm -rf docs/")
], callback
build = (callback) ->
parallel [buildMan, buildAnnotations], callback
checkoutBranch = (callback) ->
series [
(sh "rm -rf pages/")
(sh "git clone -q -b gh-pages pages")
(sh "rm -rf pages/*")
], callback
publish = (callback) ->
series [
(sh "cd pages/ && git commit -am 'rebuild manual' || true")
(sh "cd pages/ && git push gh-pages")
(sh "rm -rf pages/")
], callback
series [
(sh "mkdir -p pages/annotations")
], (err) -> throw err if err
Something went wrong with that request. Please try again.