Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

85 lines (66 sloc) 2.231 kB
test = "#{__dirname}/test"
docs = "#{__dirname}/docs"
{exec, spawn} = require 'child_process'
{series, parallel} = require 'async'
inspect = require('eyes').inspector
stream: null
pretty: false
styles:
all: 'magenta'
# execute some command quietly (without stdout)
sh = (command) -> (k) -> exec command, k
# Modified from https://gist.github.com/920698
runCommand = (name, args) ->
proc = spawn name, args
proc.stderr.on 'data', (buffer) -> console.log buffer.toString()
proc.stdout.on 'data', (buffer) -> console.log buffer.toString()
proc.on 'exit', (status) -> process.exit(1) if status != 0
# shorthand to runCommand with
command = (c, cb) ->
runCommand "sh", ["-c", c]
cb
# Literate programming for the coffee sources.
task 'docs', "docco -- docs", ->
series [
sh "rm -rf #{docs}/"
command "find lib | grep .coffee | xargs docco"
], (err) -> throw err if err
task 'pages', "Build pages", ->
buildMan = (callback) ->
series [
(sh "cp README.md doc/index.md")
(sh 'echo "# UNLICENSE\n## LICENSE\n\n" > doc/UNLICENSE.md' )
(sh "cat UNLICENSE >> doc/UNLICENSE.md")
(sh "ronn -stoc -5 doc/*.md")
(sh "mv doc/*.html pages/")
(sh "rm doc/index.md")
(sh "rm doc/UNLICENSE.md")
], callback
build = (callback) ->
parallel [
buildMan
(sh "cake docs && cp -r docs pages/annotations")
], callback
series [
(sh "if [ ! -d pages ] ; then mkdir pages ; fi") # mkdir pages only if it doesn't exist
(sh "rm -rf pages/*")
build
], (err) -> throw err if err
task 'pages:publish', "Publish pages", ->
checkoutBranch = (callback) ->
series [
(sh "rm -rf pages/")
(sh "git clone -q -b gh-pages git@github.com:astrolet/there.git pages")
(sh "rm -rf pages/*")
], callback
publish = (callback) ->
series [
(sh "cd pages/ && git add . && git commit -m 'rebuild manual' || true")
(sh "cd pages/ && git push git@github.com:astrolet/there.git gh-pages")
(sh "rm -rf pages/")
], callback
series [
checkoutBranch
(sh "cake pages") # NOTE: (invoke "pages") # doesn't work here after checkoutBranch
publish
], (err) -> throw err if err
Jump to Line
Something went wrong with that request. Please try again.