Changeset 516 for Dev/trunk/node_modules/grunt/lib
- Timestamp:
- 03/14/14 12:36:58 (11 years ago)
- Location:
- Dev/trunk
- Files:
-
- 1 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk
- Property svn:ignore
-
old new 1 1 build 2 quod-erat.git
-
- Property svn:ignore
-
Dev/trunk/node_modules/grunt/lib/grunt.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT … … 23 23 return grunt[name] = require('./grunt/' + name); 24 24 } 25 var util = gRequire('util'); 25 26 var util = require('grunt-legacy-util'); 27 grunt.util = util; 28 grunt.util.task = require('./util/task'); 29 26 30 gRequire('template'); 27 31 gRequire('event'); … … 153 157 // allows the error callback to execute multiple times. 154 158 tasks.forEach(function(name) { task.run(name); }); 155 task.start(); 159 // Run tasks async internally to reduce call-stack, per: 160 // https://github.com/gruntjs/grunt/pull/1026 161 task.start({asyncDone:true}); 156 162 }; -
Dev/trunk/node_modules/grunt/lib/grunt/cli.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT … … 22 22 // CLI-parsed options override any passed-in "default" options. 23 23 if (options) { 24 // For each def ult option...24 // For each default option... 25 25 Object.keys(options).forEach(function(key) { 26 26 if (!(key in cli.options)) { … … 62 62 short: 'd', 63 63 info: 'Enable debugging mode for tasks that support it.', 64 type: Number64 type: [Number, Boolean] 65 65 }, 66 66 stack: { -
Dev/trunk/node_modules/grunt/lib/grunt/config.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT -
Dev/trunk/node_modules/grunt/lib/grunt/event.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT -
Dev/trunk/node_modules/grunt/lib/grunt/fail.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT -
Dev/trunk/node_modules/grunt/lib/grunt/file.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT … … 134 134 var pathSeparatorRe = /[\/\\]/g; 135 135 136 // The "ext" option refers to either everything after the first dot (default) 137 // or everything after the last dot. 138 var extDotRe = { 139 first: /(\.[^\/]*)?$/, 140 last: /(\.[^\/\.]*)?$/, 141 }; 142 136 143 // Build a multi task "files" object dynamically. 137 144 file.expandMapping = function(patterns, destBase, options) { 138 145 options = grunt.util._.defaults({}, options, { 146 extDot: 'first', 139 147 rename: function(destBase, destPath) { 140 148 return path.join(destBase || '', destPath); … … 151 159 } 152 160 // Change the extension? 153 if ( options.ext) {154 destPath = destPath.replace( /(\.[^\/]*)?$/, options.ext);161 if ('ext' in options) { 162 destPath = destPath.replace(extDotRe[options.extDot], options.ext); 155 163 } 156 164 // Generate destination filename. -
Dev/trunk/node_modules/grunt/lib/grunt/help.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT -
Dev/trunk/node_modules/grunt/lib/grunt/log.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT -
Dev/trunk/node_modules/grunt/lib/grunt/option.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT -
Dev/trunk/node_modules/grunt/lib/grunt/task.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT … … 108 108 } 109 109 } else if (Array.isArray(data.files)) { 110 data.files.forEach(function(obj) {110 grunt.util._.flatten(data.files).forEach(function(obj) { 111 111 var prop; 112 112 if ('src' in obj || 'dest' in obj) { … … 245 245 return options; 246 246 }; 247 // Expose the current target. 248 this.target = target; 249 // Recreate flags object so that the target isn't set as a flag. 250 this.flags = {}; 251 this.args.forEach(function(arg) { this.flags[arg] = true; }, this); 247 252 // Expose data on `this` (as well as task.current). 248 253 this.data = grunt.config([name, target]); … … 256 261 }.bind(this) 257 262 }); 258 // Expose the current target.259 this.target = target;260 // Recreate flags object so that the target isn't set as a flag.261 this.flags = {};262 this.args.forEach(function(arg) { this.flags[arg] = true; }, this);263 263 // Call original task function, passing in the target and any other args. 264 264 return fn.apply(this, this.args); … … 278 278 // Override built-in renameTask to use the registry. 279 279 task.renameTask = function(oldname, newname) { 280 // Add and remove task. 281 registry.untasks.push(oldname); 282 registry.tasks.push(newname); 283 // Actually rename task. 284 return parent.renameTask.apply(task, arguments); 280 var result; 281 try { 282 // Actually rename task. 283 result = parent.renameTask.apply(task, arguments); 284 // Add and remove task. 285 registry.untasks.push(oldname); 286 registry.tasks.push(newname); 287 // Return result. 288 return result; 289 } catch(e) { 290 grunt.log.error(e.message); 291 } 285 292 }; 286 293 -
Dev/trunk/node_modules/grunt/lib/grunt/template.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT -
Dev/trunk/node_modules/grunt/lib/util/task.js
r484 r516 3 3 * http://gruntjs.com/ 4 4 * 5 * Copyright (c) 201 3"Cowboy" Ben Alman5 * Copyright (c) 2014 "Cowboy" Ben Alman 6 6 * Licensed under the MIT license. 7 7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT … … 90 90 // easier to implement than some kind of in-task "super" functionality. 91 91 Task.prototype.renameTask = function(oldname, newname) { 92 if (!this._tasks[oldname]) { 93 throw new Error('Cannot rename missing "' + oldname + '" task.'); 94 } 92 95 // Rename task. 93 96 this._tasks[newname] = this._tasks[oldname]; … … 186 189 187 190 // Run a task function, handling this.async / return value. 188 Task.prototype.runTaskFn = function(context, fn, done ) {191 Task.prototype.runTaskFn = function(context, fn, done, asyncDone) { 189 192 // Async flag. 190 193 var async = false; … … 213 216 this._options.error.call({name: context.name, nameArgs: context.nameArgs}, err); 214 217 } 215 done(err, success); 218 // only call done async if explicitly requested to 219 // see: https://github.com/gruntjs/grunt/pull/1026 220 if (asyncDone) { 221 process.nextTick(function () { 222 done(err, success); 223 }); 224 } else { 225 done(err, success); 226 } 216 227 }.bind(this); 217 228 … … 244 255 245 256 // Begin task queue processing. Ie. run all tasks. 246 Task.prototype.start = function() { 257 Task.prototype.start = function(opts) { 258 if (!opts) { 259 opts = {}; 260 } 247 261 // Abort if already running. 248 262 if (this._running) { return false; } … … 281 295 this.runTaskFn(context, function() { 282 296 return thing.task.fn.apply(this, this.args); 283 }, nextTask );297 }, nextTask, !!opts.asyncDone); 284 298 285 299 }.bind(this);
Note: See TracChangeset
for help on using the changeset viewer.