Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

replaced unix-based commands with node-based alternatives

  • Loading branch information...
commit 8c395e15261a66342e3ccdd51e6391c7dbb501bd 1 parent daae623
@neocotic neocotic authored
Showing with 26 additions and 17 deletions.
  1. +16 −6 docco.js
  2. +9 −10 docco.litcoffee
  3. +1 −1  package.json
View
22 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) {
View
19 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
View
2  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"
},
Please sign in to comment.
Something went wrong with that request. Please try again.