Comparing version 0.2.2 to 0.2.3
@@ -51,3 +51,2 @@ /* | ||
, t; | ||
console.log('Defining package for ' + self.name + ' v' + version); | ||
t = new jake.PackageTask(self.name, 'v' + version, function () { | ||
@@ -61,3 +60,4 @@ this.packageFiles.include(self.packageFiles); | ||
var definePack = jake.Task['npm:definePackage'] | ||
, pack = jake.Task['package']; | ||
, pack = jake.Task['package'] | ||
, version = jake.getPackageVersionNumber(); | ||
// May have already been run | ||
@@ -67,3 +67,3 @@ definePack.reenable(true); | ||
pack.addListener('complete', function () { | ||
console.log('Created package.'); | ||
console.log('Created package for ' + self.name + ' v' + version); | ||
complete(); | ||
@@ -70,0 +70,0 @@ }); |
{ | ||
"name": "jake", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", | ||
@@ -5,0 +5,0 @@ "bin": { |
157
README.md
@@ -15,13 +15,11 @@ ### Jake -- JavaScript build tool for Node.js | ||
By default Jake is installed in "/usr/local." To install it into a | ||
different directory (e.g., one that doesn't require super-user | ||
privilege), pass the PREFIX variable to the `make install` command. | ||
For example, to install it into a "jake" directory in your home | ||
directory, you could use this: | ||
By default Jake is installed in "/usr/local." To install it into a different | ||
directory (e.g., one that doesn't require super-user privilege), pass the PREFIX | ||
variable to the `make install` command. For example, to install it into a | ||
"jake" directory in your home directory, you could use this: | ||
make && make install PREFIX=~/jake | ||
If do you install Jake somewhere special, you'll need to add the | ||
"bin" directory in the install target to your PATH to get access | ||
to the `jake` executable. | ||
If do you install Jake somewhere special, you'll need to add the "bin" directory | ||
in the install target to your PATH to get access to the `jake` executable. | ||
@@ -54,3 +52,4 @@ ### Installing with [NPM](http://npmjs.org/) | ||
Jake is a simple JavaScript build program with capabilities similar to the regular make or rake command. | ||
Jake is a simple JavaScript build program with capabilities similar to the | ||
regular make or rake command. | ||
@@ -82,15 +81,29 @@ Jake has the following features: | ||
A Jakefile is just executable JavaScript. You can include whatever JavaScript you want in it. | ||
A Jakefile is just executable JavaScript. You can include whatever JavaScript | ||
you want in it. | ||
## Tasks | ||
Use `task` to define tasks. Call it with two arguments (and one optional argument): | ||
Use `task` to define tasks. Call it with two arguments (and one optional | ||
argument): | ||
task(name, [prerequisites], action, [opts]); | ||
The `name` argument is a String with the name of the task, and `prerequisites` is an optional Array arg of the list of prerequisite tasks to perform first. The `action` is a Function defininng the action to take for the task. (Note that Object-literal syntax for name/prerequisites in a single argument a la Rake is also supported, but JavaScript's lack of support for dynamic keys in Object literals makes it not very useful.) | ||
The `name` argument is a String with the name of the task, and `prerequisites` | ||
is an optional Array arg of the list of prerequisite tasks to perform first. The | ||
`action` is a Function defininng the action to take for the task. (Note that | ||
Object-literal syntax for name/prerequisites in a single argument a la Rake is | ||
also supported, but JavaScript's lack of support for dynamic keys in Object | ||
literals makes it not very useful.) | ||
The `opts` argument is optional, and when it includes an `async` property set to `true`, indicates the task executes asynchronously. Asynchronous tasks need to call `complete()` to signal they have completed. (Passing a final `async` Boolean flag is deprecated, but still supported.) | ||
The `opts` argument is optional, and when it includes an `async` property set to | ||
`true`, indicates the task executes asynchronously. Asynchronous tasks need to | ||
call `complete()` to signal they have completed. (Passing a final `async` | ||
Boolean flag is deprecated, but still supported.) | ||
Tasks created with `task` are always executed when asked for (or are a prerequisite). Tasks created with `file` are only executed if no file with the given name exists or if any of its file-prerequisites are more recent than the file named by the task. Also, if any prerequisite is a regular task, the file task will always be executed. | ||
Tasks created with `task` are always executed when asked for (or are a | ||
prerequisite). Tasks created with `file` are only executed if no file with the | ||
given name exists or if any of its file-prerequisites are more recent than the | ||
file named by the task. Also, if any prerequisite is a regular task, the file | ||
task will always be executed. | ||
@@ -122,3 +135,6 @@ Use `desc` to add a string description of the task. | ||
File-tasks create a file from one or more other files. With a file-task, Jake checks both that the file exists, and also that it is not older than the files specified by any prerequisite tasks. File-tasks are particularly useful for compiling something from a tree of source files. | ||
File-tasks create a file from one or more other files. With a file-task, Jake | ||
checks both that the file exists, and also that it is not older than the files | ||
specified by any prerequisite tasks. File-tasks are particularly useful for | ||
compiling something from a tree of source files. | ||
@@ -134,3 +150,4 @@ desc('This builds a minified JS file for production.'); | ||
Directory-tasks create a directory for use with for file-tasks. Jake checks for the existence of the directory, and only creates it if needed. | ||
Directory-tasks create a directory for use with for file-tasks. Jake checks for | ||
the existence of the directory, and only creates it if needed. | ||
@@ -140,3 +157,4 @@ desc('This creates the bar directory for use with the foo-minified.js file-task.'); | ||
This task will create the directory when used as a prerequisite for a file-task, or when run from the command-line. | ||
This task will create the directory when used as a prerequisite for a file-task, | ||
or when run from the command-line. | ||
@@ -149,3 +167,5 @@ ### Namespaces | ||
Where is `name` is the name of the namespace, and `namespaceTasks` is a function with calls inside it to `task` or `desc` definining all the tasks for that namespace. | ||
Where is `name` is the name of the namespace, and `namespaceTasks` is a function | ||
with calls inside it to `task` or `desc` definining all the tasks for that | ||
namespace. | ||
@@ -176,5 +196,8 @@ Here's an example: | ||
Parameters can be passed to Jake two ways: plain arguments, and environment variables. | ||
Parameters can be passed to Jake two ways: plain arguments, and environment | ||
variables. | ||
To pass positional arguments to the Jake tasks, enclose them in square braces, separated by commas, after the name of the task on the command-line. For example, with the following Jakefile: | ||
To pass positional arguments to the Jake tasks, enclose them in square braces, | ||
separated by commas, after the name of the task on the command-line. For | ||
example, with the following Jakefile: | ||
@@ -196,3 +219,4 @@ desc('This is an awesome task.'); | ||
Any parameters passed after the Jake task that contain an equals sign (=) will be added to process.env. | ||
Any parameters passed after the Jake task that contain an equals sign (=) will | ||
be added to process.env. | ||
@@ -217,8 +241,10 @@ With the following Jakefile: | ||
__Note for zsh users__ : you will need to escape the brackets or wrap in single quotes like this to pass parameters : | ||
__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 : | ||
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" | ||
@@ -228,3 +254,4 @@ | ||
Jake supports the ability to run a task from within another task via the `invoke` and `execute` methods. | ||
Jake supports the ability to run a task from within another task via the | ||
`invoke` and `execute` methods. | ||
@@ -268,3 +295,4 @@ The `invoke` method will run the desired task, along with its prerequisites: | ||
If you want to run the task and its prerequisites more than once, you can use `invoke` with the `reenable` method. | ||
If you want to run the task and its prerequisites more than once, you can use | ||
`invoke` with the `reenable` method. | ||
@@ -282,3 +310,4 @@ desc('Calls the foo:bar task and its prerequisites.'); | ||
The `reenable` method takes a single Boolean arg, a 'deep' flag, which reenables the task's prerequisites if set to true. | ||
The `reenable` method takes a single Boolean arg, a 'deep' flag, which reenables | ||
the task's prerequisites if set to true. | ||
@@ -307,3 +336,4 @@ desc('Calls the foo:bar task and its prerequisites.'); | ||
You can abort a task by calling the `fail` function, and Jake will abort the currently running task. You can pass a customized error message to `fail`: | ||
You can abort a task by calling the `fail` function, and Jake will abort the | ||
currently running task. You can pass a customized error message to `fail`: | ||
@@ -328,3 +358,4 @@ desc('This task fails.'); | ||
Passing `jake` the -T or --tasks flag will display the full list of tasks available in a Jakefile, along with their descriptions: | ||
Passing `jake` the -T or --tasks flag will display the full list of tasks | ||
available in a Jakefile, along with their descriptions: | ||
@@ -350,3 +381,4 @@ $ jake -T | ||
Jake's PackageTask programmically creates a set of tasks for packaging up your project for distribution. Here's an example: | ||
Jake's PackageTask programmically creates a set of tasks for packaging up your | ||
project for distribution. Here's an example: | ||
@@ -367,3 +399,5 @@ var t = new jake.PackageTask('fonebone', 'v0.1.2112', function () { | ||
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/: | ||
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/: | ||
@@ -374,11 +408,20 @@ fonebone-v0.1.2112 | ||
PackageTask also creates a 'clobberPackage' task that removes the pkg/ directory, and a 'repackage' task that forces the package to be rebuilt. | ||
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 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.) | ||
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.) | ||
### 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. | ||
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 minimatchmodule (https://github.com/isaacs/minimatch). | ||
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). | ||
@@ -395,9 +438,44 @@ To build the list of files, use FileList's `include` and `exclude` methods: | ||
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 `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. | ||
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. | ||
### NpmPublishTask | ||
The NpmPublishTask builds on top of PackageTask to allow you to do a version | ||
bump of your project, package it, and publish it to NPM. Define the task with | ||
your project's name, and the list of files you want packaged and published to | ||
NPM. | ||
Here's an example from Jake's Jakefile: | ||
var p = new jake.NpmPublishTask('jake', [ | ||
'Makefile' | ||
, 'Jakefile' | ||
, 'README.md' | ||
, 'package.json' | ||
, 'lib/*' | ||
, 'bin/*' | ||
, 'tests/*' | ||
]); | ||
The NpmPublisTask will automatically create a `publish` task which performs the | ||
following steps: | ||
1. Bump the version number in your package.json | ||
2. Commit change in git, push it to GitHub | ||
3. Create a git tag for the version | ||
4. Push the tag to GitHub | ||
5. Package the new version of your project | ||
6. Publish it to NPM | ||
### CoffeeScript Jakefiles | ||
Jake can also handle Jakefiles in CoffeeScript. Be sure to make it Jakefile.coffee so Jake knows it's in CoffeeScript. | ||
Jake can also handle Jakefiles in CoffeeScript. Be sure to make it | ||
Jakefile.coffee so Jake knows it's in CoffeeScript. | ||
@@ -446,2 +524,3 @@ Here's an example: | ||
Licensed under the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>) | ||
Licensed under the Apache License, Version 2.0 | ||
(<http://www.apache.org/licenses/LICENSE-2.0>) |
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
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
81593
507