check if atom.io directory exists in copy-docs

This commit is contained in:
Daniel Hengeveld
2013-11-04 17:03:29 -08:00
parent 7e9a1d8ffe
commit 105f8d0baf

View File

@@ -1,4 +1,5 @@
path = require 'path'
fs = require 'fs'
module.exports = (grunt) ->
cmd = path.join('node_modules', '.bin', 'coffee')
@@ -37,11 +38,16 @@ module.exports = (grunt) ->
cmd = 'cp'
args = ['-r', 'docs/output/', "../atom.io/public/docs/api/#{tag}/"]
grunt.util.spawn {cmd, args}, (error, result) ->
if error?
callback(error)
fs.exists "../atom.io/public/docs/api/", (exists) ->
if exists
grunt.util.spawn {cmd, args}, (error, result) ->
if error?
callback(error)
else
callback(null, tag)
else
callback(null, tag)
grunt.log.error "../atom.io/public/docs/api/ doesn't exist"
return false
grunt.util.async.waterfall [fetchTag, copyDocs], done