Adds deploy-docs grunt task

This commit is contained in:
Matt Colyer
2013-08-14 08:56:35 -07:00
parent 1254ceeb6d
commit d3130845d1

View File

@@ -20,3 +20,33 @@ module.exports = (grunt) ->
done = @async()
args = [commonArgs..., '--noOutput', '--missing', 'src/app/']
grunt.util.spawn({cmd, args, opts}, done)
grunt.registerTask 'deploy-docs', 'Publishes latest API docs to atom-docs.githubapp.com', ->
done = @async()
pushHeroku = (error, result, code) ->
sha = String(result).trim()
cmd = 'git'
args = ['--work-tree=../atom-docs/', '--git-dir=../atom-docs/.git/', 'push', 'heroku', 'master']
grunt.util.spawn({cmd, args, opts}, done)
pushOrigin = (error, result, code) ->
sha = String(result).trim()
cmd = 'git'
args = ['--work-tree=../atom-docs/', '--git-dir=../atom-docs/.git/', 'push', 'origin', 'master']
grunt.util.spawn({cmd, args, opts}, pushHeroku)
commitChanges = (error, result, code) ->
sha = String(result).trim()
cmd = 'git'
args = ['--work-tree=../atom-docs/', '--git-dir=../atom-docs/.git/', 'commit', '-a', "-m Update API docs to #{sha}"]
grunt.util.spawn({cmd, args, opts}, pushOrigin)
fetchSha = (error, result, code) ->
cmd = 'git'
args = ['rev-parse', 'HEAD']
grunt.util.spawn({cmd, args}, commitChanges)
cmd = 'cp'
args = ['-r', 'docs/api', '../atom-docs/public/']
grunt.util.spawn {cmd, args, opts}, fetchSha