Comparing version 0.3.8 to 0.3.9
@@ -56,5 +56,5 @@ #!/usr/bin/env node | ||
jake.program = program; | ||
for (var p in utils) { | ||
jake[p] = utils[p]; | ||
} | ||
utils.mixin(jake, utils); | ||
// File utils should be aliased directly on the base namespace | ||
utils.mixin(jake, utils.file); | ||
jake.FileList = require(libPath + '/file_list').FileList; | ||
@@ -61,0 +61,0 @@ jake.PackageTask = require(libPath + '/package_task').PackageTask; |
@@ -20,3 +20,4 @@ /* | ||
, path = require('path') | ||
, minimatch // Lazy-required | ||
, minimatch = require('minimatch') | ||
, utils = require('utilities') | ||
, globSync; | ||
@@ -65,13 +66,2 @@ | ||
// Utility methods | ||
// --------------- | ||
// Escapes special characters in a string to be used in generating | ||
// a regex | ||
var regexpEscape = (function() { | ||
var specials = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\' ] | ||
, sRE = new RegExp('(\\' + specials.join('|\\') + ')', 'g'); | ||
return function (text) { return text.replace(sRE, '\\$1'); }; | ||
})(); | ||
var FileList = function () { | ||
@@ -81,19 +71,2 @@ var self = this | ||
// Lazy-require minimatch so that require of this file in cli.js won't bomb | ||
if (!minimatch) { | ||
try { | ||
minimatch = require('minimatch'); | ||
} | ||
catch(e) { | ||
// Hacky fallback, assume global install at /usr/local? | ||
try { | ||
minimatch = require('/usr/local/lib/node_modules/minimatch'); | ||
} | ||
catch(e) { | ||
fail('FileList requires minimatch ' + | ||
'(https://github.com/isaacs/minimatch). Try `npm install -g minimatch`.'); | ||
} | ||
} | ||
} | ||
// List of glob-patterns or specific filenames | ||
@@ -177,3 +150,3 @@ this.pendingAdd = []; | ||
else { | ||
excl.push(regexpEscape(pat)); | ||
excl.push(utils.string.escapeRegExpChars(pat)); | ||
} | ||
@@ -180,0 +153,0 @@ } |
@@ -23,3 +23,3 @@ /* | ||
fs.existsSync : path.existsSync | ||
, fileUtils = require('./utils/file') | ||
, utils = require('utilities') | ||
, Loader; | ||
@@ -64,3 +64,3 @@ | ||
} | ||
require(fileUtils.absolutize(jakefile)); | ||
require(utils.file.absolutize(jakefile)); | ||
} | ||
@@ -71,3 +71,3 @@ | ||
, dirlist; | ||
dirname = fileUtils.absolutize(dirname); | ||
dirname = utils.file.absolutize(dirname); | ||
if (existsSync(dirname)) { | ||
@@ -74,0 +74,0 @@ dirlist = fs.readdirSync(dirname); |
@@ -23,3 +23,3 @@ var DirectoryTask | ||
if (arguments.length) { | ||
this.constructor.prototype.init.apply(this, arguments); | ||
this.init.apply(this, arguments); | ||
} | ||
@@ -26,0 +26,0 @@ }; |
@@ -119,3 +119,3 @@ var fs = require('fs') | ||
if (arguments.length) { | ||
this.constructor.prototype.init.apply(this, arguments); | ||
this.init.apply(this, arguments); | ||
} | ||
@@ -122,0 +122,0 @@ }; |
@@ -33,3 +33,3 @@ var fs = require('fs') | ||
if (arguments.length) { | ||
this.constructor.prototype.init.apply(this, arguments); | ||
this.init.apply(this, arguments); | ||
} | ||
@@ -36,0 +36,0 @@ }; |
@@ -23,43 +23,6 @@ /* | ||
, EventEmitter = require('events').EventEmitter | ||
, fileUtils = require('./file') | ||
, utils = require('utilities') | ||
, logger = require('./logger') | ||
, utils | ||
, Exec | ||
, _mix, _trim, _truncate; | ||
, Exec; | ||
_mix = function (targ, src, merge, includeProto) { | ||
for (var p in src) { | ||
// Don't copy stuff from the prototype | ||
if (src.hasOwnProperty(p) || includeProto) { | ||
if (merge && | ||
// Assumes the source property is an Object you can | ||
// actually recurse down into | ||
(typeof src[p] == 'object') && | ||
(src[p] !== null) && | ||
!(src[p] instanceof Array)) { | ||
// Create the source property if it doesn't exist | ||
// TODO: What if it's something weird like a String or Number? | ||
if (typeof targ[p] == 'undefined') { | ||
targ[p] = {}; | ||
} | ||
_mix(targ[p], src[p], merge, includeProto); // Recurse | ||
} | ||
// If it's not a merge-copy, just set and forget | ||
else { | ||
targ[p] = src[p]; | ||
} | ||
} | ||
} | ||
}; | ||
_trim = function (s) { | ||
var str = s || ''; | ||
return str.replace(/^\s*|\s*$/g, ''); | ||
}; | ||
_truncate = function (s) { | ||
var str = s ? s.replace(/\n$/, '') : ''; | ||
return str; | ||
}; | ||
/** | ||
@@ -69,3 +32,3 @@ @name jake | ||
*/ | ||
utils = new (function () { | ||
utils.mixin(utils, new (function () { | ||
/** | ||
@@ -125,48 +88,4 @@ @name jake.exec | ||
/* | ||
* Mix in the properties on an object to another object | ||
* yam.mixin(target, source, [source,] [source, etc.] [merge-flag]); | ||
* 'merge' recurses, to merge object sub-properties together instead | ||
* of just overwriting with the source object. | ||
*/ | ||
this.mixin = (function () { | ||
return function () { | ||
var args = Array.prototype.slice.apply(arguments), | ||
merge = false, | ||
targ, sources; | ||
if (args.length > 2) { | ||
if (typeof args[args.length - 1] == 'boolean') { | ||
merge = args.pop(); | ||
} | ||
} | ||
targ = args.shift(); | ||
sources = args; | ||
for (var i = 0, ii = sources.length; i < ii; i++) { | ||
_mix(targ, sources[i], merge); | ||
} | ||
return targ; | ||
}; | ||
}).call(this); | ||
})()); | ||
this.enhance = (function () { | ||
return function () { | ||
var args = Array.prototype.slice.apply(arguments), | ||
merge = false, | ||
targ, sources; | ||
if (args.length > 2) { | ||
if (typeof args[args.length - 1] == 'boolean') { | ||
merge = args.pop(); | ||
} | ||
} | ||
targ = args.shift(); | ||
sources = args; | ||
for (var i = 0, ii = sources.length; i < ii; i++) { | ||
_mix(targ, sources[i], merge, true); | ||
} | ||
return targ; | ||
}; | ||
}).call(this); | ||
})(); | ||
Exec = function () { | ||
@@ -249,3 +168,3 @@ var args | ||
if (config.printStdout) { | ||
console.log(_truncate(data.toString())); | ||
console.log(utils.string.rtrim(data.toString())); | ||
} | ||
@@ -258,3 +177,3 @@ self.emit('stdout', data); | ||
if (config.printStderr) { | ||
console.error(_truncate(d)); | ||
console.error(utils.string.rtrim(d)); | ||
} | ||
@@ -271,3 +190,3 @@ self.emit('stderr', data); | ||
msg = errData || 'Process exited with error.'; | ||
msg = _trim(msg); | ||
msg = utils.string.trim(msg); | ||
self.emit('error', msg, code); | ||
@@ -301,6 +220,4 @@ } | ||
utils.logger = logger; | ||
// Hang all the file utils off this too | ||
utils.mixin(utils, fileUtils); | ||
module.exports = utils; | ||
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", | ||
@@ -23,3 +23,4 @@ "bin": { | ||
"dependencies": { | ||
"minimatch": "0.2.x" | ||
"minimatch": "0.0.x", | ||
"utilities": "0.0.x" | ||
}, | ||
@@ -26,0 +27,0 @@ "devDependencies": {}, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
23
119999
2
26
2786
+ Addedutilities@0.0.x
+ Addedlru-cache@1.0.6(transitive)
+ Addedminimatch@0.0.5(transitive)
+ Addedutilities@0.0.40(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@0.2.14(transitive)
- Removedsigmund@1.0.1(transitive)
Updatedminimatch@0.0.x