grunt-groc
Advanced tools
Comparing version 0.0.3 to 0.1.0
@@ -23,3 +23,3 @@ 'use strict'; | ||
} | ||
}, | ||
} | ||
}); | ||
@@ -26,0 +26,0 @@ |
{ | ||
"name": "grunt-groc", | ||
"description": "Generate documentation using groc", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"homepage": "https://github.com/jdcataldo/grunt-groc", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -12,38 +12,37 @@ /* | ||
module.exports = function(grunt) { | ||
var groc = require("groc").CLI; | ||
var groc = require("groc").CLI, | ||
util = grunt.util || grunt.utils, | ||
// Alias for Lo-Dash | ||
_ = util._; | ||
grunt.registerMultiTask('groc', 'Generate documenation using groc', function() { | ||
// Merge options | ||
var options = this.options(), | ||
var options = this.options ? this.options() : this.data.options, | ||
files = this.filesSrc || this.data.src, | ||
// Set task as async | ||
done = this.async(), | ||
// Alias for Lo-Dash | ||
_ = grunt.util._, | ||
// Array of arguments to pass into groc | ||
args = []; | ||
// Loops through the files and generate the documentation | ||
_.forEach(this.files, function(f){ | ||
// Add the files to the arguments | ||
args.push(f.src); | ||
// Loop through the options and add them to args | ||
_.each(options, function(value, key) { | ||
// Convert to the key to a switch | ||
var sw = (key.length > 1 ? '--' : '-') + key; | ||
// Add the switch and its value | ||
args.push([sw, value.toString()]); | ||
}); | ||
// Add the files to the arguments | ||
args.push(files); | ||
// Loop through the options and add them to args | ||
_.each(options, function(value, key) { | ||
// Convert to the key to a switch | ||
var sw = (key.length > 1 ? '--' : '-') + key; | ||
// Add the switch and its value | ||
args.push([sw, value.toString()]); | ||
}); | ||
// Pass the args to groc | ||
groc(_.flatten(args), function(error){ | ||
if(error) { | ||
grunt.warn(error); | ||
process.exit(1); | ||
done(false); | ||
return; | ||
} | ||
done(); | ||
}); | ||
// Pass the args to groc | ||
groc(_.flatten(args), function(error){ | ||
if(error) { | ||
grunt.warn(error); | ||
process.exit(1); | ||
done(false); | ||
return; | ||
} | ||
done(); | ||
}); | ||
}); | ||
}; |
Sorry, the diff of this file is not supported yet
4856
68