Socket
Socket
Sign inDemoInstall

jake

Package Overview
Dependencies
0
Maintainers
1
Versions
166
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.19 to 0.1.20

27

lib/file_list.js

@@ -19,4 +19,20 @@ /*

var fs = require('fs')
, glob; // Lazy-required
, path = require('path')
, minimatch // Lazy-required
, glob = {};
glob.globSync = function (pat) {
var dirname = path.dirname(pat)
, files = fs.readdirSync(dirname)
, filePat = path.basename(pat)
, matches;
matches = minimatch.match(files, filePat, {'null': true});
if (matches && matches.length) {
for (var i = 0, ii = matches.length; i < ii; i++) {
matches[i] = dirname + '/' + matches[i];
}
}
return matches
};
// Constants

@@ -70,9 +86,10 @@ // ---------------

// Lazy-require glob so that require of this file in cli.js won't bomb
if (!glob) {
// Lazy-require minimatch so that require of this file in cli.js won't bomb
if (!minimatch) {
try {
glob = require('glob');
minimatch = require('minimatch');
}
catch(e) {
fail('FileList requires glob (https://github.com/isaacs/node-glob). Try `npm install glob`.');
fail('FileList requires minimatch ' +
'(https://github.com/isaacs/minimatch). Try `npm install minimatch`.');
}

@@ -79,0 +96,0 @@ }

46

lib/jake.js

@@ -253,5 +253,31 @@ /*

, prereqTask
, actionRan
, stats
, modTime;
// Finalize the mod-time of the previously processed file-task, if any
if (_taskIndex > 0) {
name = _taskList[_taskIndex - 1].taskName;
task = this.getTask(name);
if (task instanceof FileTask) {
// The action may have created/modified the file
// ---------
// If there's a valid file at the end of running the task,
// use its mod-time as last modified
try {
stats = fs.statSync(task.name);
modTime = stats.ctime;
}
// If there's still no actual file after running the file-task,
// treat this simply as a plain task -- the current time will be
// the mod-time for anything that depends on this file-task
catch (e) {
modTime = new Date();
}
_modTimes[name] = modTime;
}
}
// If there are still tasks to run, do it

@@ -290,2 +316,3 @@ if (invocation) {

if (prereqs.length) {
actionRan = false;
for (var i = 0, ii = prereqs.length; i < ii; i++) {

@@ -300,18 +327,5 @@ prereqName = prereqs[i];

|| (!modTime || _modTimes[prereqName] >= modTime)) {
actionRan = true;
if (typeof task.action == 'function') {
task.action.apply(task, args || []);
// The action may have created/modified the file
// ---------
// If there's a valid file at the end of running the task,
// use its mod-time as last modified
try {
stats = fs.statSync(task.name);
modTime = stats.ctime;
}
// If there's still no actual file after running the file-task,
// treat this simply as a plain task -- the current time will be
// the mod-time for anything that depends on this file-task
catch (e) {
modTime = new Date();
}
}

@@ -331,4 +345,4 @@ break;

// Async tasks call this themselves
if (!task.async) {
// Async tasks whose action has actually run call this themselves
if (!task.async || !actionRan) {
complete();

@@ -335,0 +349,0 @@ }

@@ -59,3 +59,5 @@ /*

}
jakefile = path.join(process.cwd(), jakefile);
if (jakefile.indexOf('/') != 0) {
jakefile = path.join(process.cwd(), jakefile);
}
require(jakefile);

@@ -62,0 +64,0 @@ };

@@ -116,2 +116,4 @@ /*

, stats;
// Make any necessary container directories
fDirArr.forEach(function (dir) {

@@ -123,17 +125,16 @@ baseDir += baseDir ? '/' + dir : dir;

});
stats = fs.statSync(name);
if (stats.isDirectory()) {
fs.mkdirSync(f, 0755);
}
else {
fileList.push({
to: name
, from: f
});
}
// Add both files and directories, will be copied with -R
fileList.push({
to: name
, from: f
});
});
var _copyFile = function () {
var file = fileList.pop();
var cmd
, file = fileList.pop();
if (file) {
exec('cp ' + file.to + ' ' + file.from, function (err, stdout, stderr) {
// Do recursive copy of files and directories
cmd = 'cp -R ' + file.to + ' ' + file.from;
exec(cmd, function (err, stdout, stderr) {
if (err) { throw err; }

@@ -140,0 +141,0 @@ _copyFile();

{ "name": "jake"
, "version": "0.1.19"
, "version": "0.1.20"
, "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)"

@@ -4,0 +4,0 @@ , "bin": { "jake": "./bin/cli.js" }

@@ -195,2 +195,10 @@ ### Jake -- JavaScript build tool for Node.js

__Note for zsh users__ : you will need to escape the brackets or wrap in single quotes like this to pass parameters :
jake 'awesome[foo,bar,baz]'
An other solution is to desactivate permannently file-globbing for the `jake` command. You can do this by adding this line to your `.zshrc` file :
alias jake="noglob jake"
### Running tasks from within other tasks

@@ -339,3 +347,3 @@

PackageTask requires NodeJS's glob module (https://github.com/isaacs/node-glob). It is used in FileList, which is used to specify the list of files to include in your PackageTask (the packageFiles property). (See FileList, below.)
PackageTask requires NodeJS's minimatchmodule (https://github.com/isaacs/minimatch). It is used in FileList, which is used to specify the list of files to include in your PackageTask (the packageFiles property). (See FileList, below.)

@@ -346,3 +354,3 @@ ### FileList

When any of the normal JavaScript Array methods (or the `toArray` method) are called on the FileList, the pending patterns are resolved into an actual list of file-names. FileList uses NodeJS's glob module (https://github.com/isaacs/node-glob).
When any of the normal JavaScript Array methods (or the `toArray` method) are called on the FileList, the pending patterns are resolved into an actual list of file-names. FileList uses NodeJS's minimatchmodule (https://github.com/isaacs/minimatch).

@@ -349,0 +357,0 @@ To build the list of files, use FileList's `include` and `exclude` methods:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc