Browse Source

Added minimum documentation for tools.

fredck 11 years ago
parent
commit
1e25caa88f
1 changed files with 25 additions and 0 deletions
  1. 25 0
      dev/tasks/res/tools.js

+ 25 - 0
dev/tasks/res/tools.js

@@ -6,6 +6,12 @@ var dirtyFiles,
 	ignoreList;
 
 module.exports = {
+	/**
+	 * Check if a task (including its optional target) is in the queue of tasks to be executed by grunt.
+	 * @param grunt {Object} The grunt object.
+	 * @param task {String} The task name. May optionally include the target (e.g. 'task:target').
+	 * @returns {Boolean} "true" if the task is in the queue.
+	 */
 	checkTaskInQueue: function( grunt, task ) {
 		var cliTasks = grunt.cli.tasks;
 
@@ -20,6 +26,11 @@ module.exports = {
 		return isDirectCall || isTaskInDefault;
 	},
 
+	/**
+	 * Configures a multi-task and defines targets that are queued to be run by grunt.
+	 * @param grunt {Object} The grunt object.
+	 * @param options {Object} A list of options for the method. See the jscs and jshint tasks for example.
+	 */
 	setupMultitaskConfig: function( grunt, options ) {
 		var task = options.task,
 			taskConfig = {},
@@ -46,6 +57,11 @@ module.exports = {
 		grunt.config.merge( taskConfig );
 	},
 
+	/**
+	 * Gets the list of ignores from .gitignore.
+	 * @param grunt {Object} The grunt object.
+	 * @returns {Array} The list of ignores.
+	 */
 	getGitIgnore: function( grunt ) {
 		if ( !ignoreList ) {
 			ignoreList = grunt.file.read( '.gitignore' );
@@ -64,6 +80,10 @@ module.exports = {
 		return ignoreList;
 	},
 
+	/**
+	 * Gets the list of files that are supposed to be included in the next git commit.
+	 * @returns {Array} A list of file paths.
+	 */
 	getGitDirtyFiles: function() {
 		// Cache it, so it is executed only once when running multiple tasks.
 		if ( !dirtyFiles ) {
@@ -83,6 +103,11 @@ module.exports = {
 		return dirtyFiles;
 	},
 
+	/**
+	 * Executes a shell command.
+	 * @param command {String} The command to be executed.
+	 * @returns {String} The command output.
+	 */
 	shExec: function( command ) {
 		var sh = require( 'shelljs' );
 		sh.config.silent = true;