diff --git a/docco.js b/docco.js index 23b3b632..cfae9e3d 100644 --- a/docco.js +++ b/docco.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript 1.6.2 (function() { - var Docco, commander, config, configure, document, exec, ext, format, fs, getLanguage, highlight, l, languages, marked, parse, path, run, spawn, version, write, _, _ref, + var Docco, async, commander, config, configure, document, ext, format, fs, getLanguage, highlight, l, languages, marked, parse, path, run, version, write, _, __slice = [].slice; document = function(options, callback) { @@ -8,7 +8,7 @@ options = {}; } configure(options); - return exec("mkdir -p " + config.output, function() { + return fs.mkdirs(config.output, function() { var complete, files, nextFile; callback || (callback = function(error) { @@ -17,7 +17,17 @@ } }); complete = function() { - return exec(["cp -f " + config.css + " " + config.output, fs.existsSync(config["public"]) ? "cp -fR " + config["public"] + " " + config.output : void 0].join(' && '), callback); + return async.parallel([ + function(done) { + return fs.copy(config.css, config.output, done); + }, function(done) { + if (fs.existsSync(config["public"])) { + return fs.copy(config["public"], config.output, done); + } else { + return done(); + } + } + ], callback); }; files = config.sources.slice(); nextFile = function() { @@ -159,18 +169,18 @@ _ = require('underscore'); - fs = require('fs'); + fs = require('fs-extra'); path = require('path'); + async = require('async'); + marked = require('marked'); commander = require('commander'); highlight = require('highlight.js').highlight; - _ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec; - languages = JSON.parse(fs.readFileSync("" + __dirname + "/resources/languages.json")); for (ext in languages) { diff --git a/docco.litcoffee b/docco.litcoffee index ff18678d..572a57ac 100644 --- a/docco.litcoffee +++ b/docco.litcoffee @@ -80,14 +80,14 @@ out in an HTML template. document = (options = {}, callback) -> configure options - fs.mkdirp config.output, -> + fs.mkdirs config.output, -> callback or= (error) -> throw error if error complete = -> async.parallel [ (done) -> fs.copy config.css, config.output, done , (done) -> - if fs.existsSync config.public then fs.copyRecursive config.public, config.output, done + if fs.existsSync config.public then fs.copy config.public, config.output, done else done() ], callback @@ -225,14 +225,13 @@ Helpers & Initial Setup Require our external dependencies. - _ = require 'underscore' - fs = require 'fs.extra' - path = require 'path' - async = require 'async' - marked = require 'marked' - commander = require 'commander' - {highlight} = require 'highlight.js' - {spawn, exec} = require 'child_process' + _ = require 'underscore' + fs = require 'fs-extra' + path = require 'path' + async = require 'async' + marked = require 'marked' + commander = require 'commander' + {highlight} = require 'highlight.js' Languages are stored in JSON in the file `resources/languages.json`. Each item maps the file extension to the name of the language and the diff --git a/package.json b/package.json index 231eb2d6..66dd3c13 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "async": ">= 0.2.6", "commander": ">= 0.5.2", "marked": ">= 0.2.7", - "fs.extra": ">= 1.2.0", + "fs-extra": ">= 0.6.0", "underscore": ">= 1.0.0", "highlight.js": ">= 7.3.0" },