Socket
Socket
Sign inDemoInstall

jake

Package Overview
Dependencies
Maintainers
0
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jake - npm Package Compare versions

Comparing version 0.1.13 to 0.1.14

tests/Jakefile2

2

lib/file_list.js

@@ -284,2 +284,2 @@ /*

jake.FileList = FileList;
module.exports.FileList = FileList;
exports.FileList = FileList;

@@ -27,14 +27,18 @@ /*

*/
var Task = function (name, prereqs, action, async, type) {
this.name = name;
this.fullName = null;
this.prereqs = prereqs;
this.action = action;
this.desription = null;
this.async = async === true;
this.type = type;
this.done = false;
var Task = function () {
this.constructor.prototype.initialize.apply(this, arguments);
};
Task.prototype = new (function () {
this.initialize = function (name, prereqs, action, async, type) {
this.name = name;
this.prereqs = prereqs;
this.action = action;
this.async = (async === true);
this.type = type;
this.done = false;
this.fullName = null;
this.desription = null;
};
this.invoke = function () {

@@ -53,3 +57,16 @@ jake.runTask(this.fullName, arguments, true);

})();
Task.prototype.constructor = Task;
var FileTask = function (name, prereqs, action, async, type) {
this.constructor.prototype.initialize.apply(this, arguments);
};
FileTask.prototype = new Task();
FileTask.prototype.constructor = FileTask;
var DirectoryTask = function (name, prereqs, action, async, type) {
this.constructor.prototype.initialize.apply(this, arguments);
};
DirectoryTask.prototype = new Task();
DirectoryTask.prototype.constructor = DirectoryTask;
var Namespace = function (name, parentNamespace) {

@@ -221,16 +238,2 @@ this.name = name;

/**
* Looks up a function object based on its name or namespace:name.
* Returns null rather than throwing an exception if no such object exists.
* @param {String} name The name of the task to look up
*/
this.tryGetTask = function (name) {
try {
return this.getTask(name);
}
catch (e) {
return null;
}
};
/**
* Runs the next task in the _taskList queue until none are left

@@ -257,3 +260,3 @@ * Synchronous tasks require calling "complete" afterward, and async

// Task or file-task
// Task, FileTask, DirectoryTask
if (task) {

@@ -271,3 +274,3 @@ prereqs = task.prereqs;

if (task.type == 'file') {
if (task instanceof FileTask) {
try {

@@ -281,2 +284,3 @@ stats = fs.statSync(name);

// Compare mod-time of all the prereqs with the mod-time of this task
if (prereqs.length) {

@@ -286,6 +290,8 @@ for (var i = 0, ii = prereqs.length; i < ii; i++) {

prereqTask = this.getTask(prereqName);
// Run the action if the prereq is a normal task, or a file/directory
// task with a mod-date more recent than the one for this file
if ((prereqTask && prereqTask.type == 'task') || !modTime ||
_modTimes[prereqName] > modTime) {
// Run the action if:
// 1. The prereq is a normal task
// 2. A file/directory task with a mod-date more recent than
// the one for this file (or this file doesn't exist yet)
if (!(prereqTask instanceof FileTask || prereqTask instanceof DirectoryTask)
|| (!modTime || _modTimes[prereqName] > modTime)) {
if (typeof task.action == 'function') {

@@ -341,3 +347,4 @@ task.action.apply(task, args || []);

// Task doesn't exist; assume file. Just get the mod-time if the file
// actually exists
// actually exists. If it doesn't exist, we're dealing with a missing
// task -- just blow up
else {

@@ -454,6 +461,11 @@ stats = fs.statSync(name);

};
task = new DirectoryTask(name, prereqs, action, async, type);
}
else if (type == 'file') {
task = new FileTask(name, prereqs, action, async, type);
}
else {
task = new Task(name, prereqs, action, async, type);
}
task = new jake.Task(name, prereqs, action, async, type);
if (jake.currentTaskDescription) {

@@ -460,0 +472,0 @@ task.description = jake.currentTaskDescription;

@@ -22,3 +22,4 @@ /*

, list = require('file_list')
, exec = require('child_process').exec;
, exec = require('child_process').exec
, currDir = process.cwd();

@@ -62,3 +63,5 @@ var PackageTask = function (name, version, definition) {

, packageDirPath = this.packageDirPath()
, taskObj = {};
, taskObj = {}
, compressTaskArr = [];
// Stub tasks

@@ -74,2 +77,3 @@ desc('Build all the packages');

exec('rm -fr ' + self.packageDir, function (err, stdout, stderr) {
complete();
});

@@ -85,7 +89,8 @@ }, true);

, taskObj = {};
task({'package': [filename]}, function () {
});
compressTaskArr.push(filename);
taskObj[filename] = [packageDirPath];
file(taskObj, function () {
var opts = _compressOpts[p];
// Move into the package dir to compress
process.chdir(self.packageDir);

@@ -95,3 +100,4 @@ var cmd = self.tarCommand + ' -' + opts.flag + 'cvf ' +

exec(cmd, function (err, stdout, stderr) {
if (err) { throw err }
// Return back up to the project directory
process.chdir(currDir);
complete();

@@ -104,2 +110,4 @@ });

task({'package': compressTaskArr}, function () {});
directory(this.packageDir);

@@ -166,3 +174,3 @@

jake.PackageTask = PackageTask;
module.exports.PackageTask = PackageTask;
exports.PackageTask = PackageTask;
{ "name": "jake"
, "version": "0.1.13"
, "version": "0.1.14"
, "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)"

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

@@ -56,3 +56,3 @@ ### Jake -- JavaScript build tool for Node.js

### Tasks
j## Tasks

@@ -290,2 +290,52 @@ Use `task` or `file` to define tasks. Call it with two arguments (and one optional argument):

### PackageTask
Jake's PackageTask programmically creates a set of tasks for packaging up your project for distribution. Here's an example:
var PackageTask = require('package_task').PackageTask
, t = new PackageTask('fonebone', 'v0.1.2112', function () {
var fileList = [
'Jakefile'
, 'README.md'
, 'package.json'
, 'lib/*'
, 'bin/*'
, 'tests/*'
];
this.packageFiles.include(fileList);
this.needTarGz = true;
this.needTarBz2 = true;
});
This will automatically create a 'package' task that will assemble the specified files in 'pkg/fonebone-v0.1.2112,' and compress them according to the specified options. After running `jake package`, you'll have the following in pkg/:
fonebone-v0.1.2112
fonebone-v0.1.2112.tar.bz2
fonebone-v0.1.2112.tar.gz
PackageTask also creates a 'clobberPackage' task that removes the pkg/ directory, and a 'repackage' task that forces the package to be rebuilt.
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.)
### FileList
Jake's FileList takes a list of glob-patterns and file-names, and lazy-creates a list of files to include. Instead of immediately searching the filesystem to find the files, a FileList holds the pattern until it is actually used.
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).
To build the list of files, use FileList's `include` and `exclude` methods:
var FileList = require('file_list').FileList
, list = new FileList();
list.include('foo/*.txt');
list.include(['bar/*.txt', 'README.md']);
list.include('Makefile', 'package.json');
list.exclude('foo/zoobie.txt');
list.exclude(/foo\/src.*.txt/);
console.log(list.toArray());
The `include` method can be called either with an array of items, or multiple single parameters. Items can be either glob-patterns, or individual file-names.
The `exclude` method will prevent files from being included in the list. These files must resolve to actual files on the filesystem. It can be called either with an array of items, or mutliple single parameters. Items can be glob-patterns, individual file-names, string-representations of regular-expressions, or regular-expression literals.
### CoffeeScript Jakefiles

@@ -292,0 +342,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc