You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2013/05/07 17:24:16 UTC
[11/51] [partial] [BlackBerry10] Added support for new platform
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/node_modules/jake/Makefile
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/node_modules/jake/Makefile b/lib/cordova-blackberry/blackberry10/node_modules/jake/Makefile
new file mode 100644
index 0000000..3d0574e
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/node_modules/jake/Makefile
@@ -0,0 +1,44 @@
+#
+# Jake JavaScript build tool
+# Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+.PHONY: all build install clean uninstall
+
+PREFIX=/usr/local
+DESTDIR=
+
+all: build
+
+build:
+ @echo 'Jake built.'
+
+install:
+ @mkdir -p $(DESTDIR)$(PREFIX)/bin && \
+ mkdir -p $(DESTDIR)$(PREFIX)/lib/node_modules/jake && \
+ mkdir -p ./node_modules && \
+ npm install utilities minimatch && \
+ cp -R ./* $(DESTDIR)$(PREFIX)/lib/node_modules/jake/ && \
+ ln -snf ../lib/node_modules/jake/bin/cli.js $(DESTDIR)$(PREFIX)/bin/jake && \
+ chmod 755 $(DESTDIR)$(PREFIX)/lib/node_modules/jake/bin/cli.js && \
+ echo 'Jake installed.'
+
+clean:
+ @true
+
+uninstall:
+ @rm -f $(DESTDIR)$(PREFIX)/bin/jake && \
+ rm -fr $(DESTDIR)$(PREFIX)/lib/node_modules/jake/ && \
+ echo 'Jake uninstalled.'
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/node_modules/jake/README.md
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/node_modules/jake/README.md b/lib/cordova-blackberry/blackberry10/node_modules/jake/README.md
new file mode 100644
index 0000000..5cb7cc9
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/node_modules/jake/README.md
@@ -0,0 +1,946 @@
+### Jake -- JavaScript build tool for Node.js
+
+### Installing with [NPM](http://npmjs.org/)
+
+Install globally with:
+
+ npm install -g jake
+
+Or you may also install it as a development dependency in a package.json file:
+
+ // package.json
+ "devDependencies": {
+ "jake": "latest"
+ }
+
+Then install it with `npm install`
+
+Note Jake is intended to be mostly a command-line tool, but lately there have been
+changes to it so it can be either embedded, or run from inside your project.
+
+### Installing from source
+
+Prerequisites: Jake requires [Node.js](<http://nodejs.org/>), and the
+[utilities](https://npmjs.org/package/utilities) and
+[minimatch](https://npmjs.org/package/minimatch) modules.
+
+Get Jake:
+
+ git clone git://github.com/mde/jake.git
+
+Build Jake:
+
+ cd jake && make && sudo make install
+
+Even if you're installing Jake from source, you'll still need NPM for installing
+the few modules Jake depends on. `make install` will do this automatically for
+you.
+
+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.
+
+### Windows, installing from source
+
+For Windows users installing from source, there are some additional steps.
+
+*Assumed: current directory is the same directory where node.exe is present.*
+
+Get Jake:
+
+ git clone git://github.com/mde/jake.git node_modules/jake
+
+Copy jake.bat and jake to the same directory as node.exe
+
+ copy node_modules/jake/jake.bat jake.bat
+ copy node_modules/jake/jake jake
+
+Add the directory of node.exe to the environment PATH variable.
+
+### Basic usage
+
+ jake [options ...] [env variables ...] target
+
+### Description
+
+ Jake is a simple JavaScript build program with capabilities similar to the
+ regular make or rake command.
+
+ Jake has the following features:
+ * Jakefiles are in standard JavaScript syntax
+ * Tasks with prerequisites
+ * Namespaces for tasks
+ * Async task execution
+
+### Options
+
+ -V/v
+ --version Display the Jake version.
+
+ -h
+ --help Display help message.
+
+ -f *FILE*
+ --jakefile *FILE* Use FILE as the Jakefile.
+
+ -C *DIRECTORY*
+ --directory *DIRECTORY* Change to DIRECTORY before running tasks.
+
+ -q
+ --quiet Do not log messages to standard output.
+
+ -J *JAKELIBDIR*
+ --jakelibdir *JAKELIBDIR* Auto-import any .jake files in JAKELIBDIR.
+ (default is 'jakelib')
+
+ -B
+ --always-make Unconditionally make all targets.
+
+ -t
+ --trace Enable full backtrace.
+
+ -T/ls
+ --tasks Display the tasks (matching optional PATTERN)
+ with descriptions, then exit.
+
+### Jakefile syntax
+
+A Jakefile is just executable JavaScript. You can include whatever JavaScript
+you want in it.
+
+## API Docs
+
+API docs [can be found here](http://mde.github.com/jake/doc/).
+
+## Tasks
+
+Use `task` to define tasks. It has one required argument, the task-name, and
+three optional arguments:
+
+```javascript
+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 action is invoked with the Task object
+itself as the execution context (i.e, "this" inside the action references the
+Task object).
+
+The `opts` argument is the normal JavaScript-style 'options' object. When a
+task's operations are asynchronous, the `async` property should be set to
+`true`, and the task must call `complete()` to signal to Jake that the task is
+done, and execution can proceed. By default the `async` property is `false`.
+
+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.
+
+Use `desc` to add a string description of the task.
+
+Here's an example:
+
+```javascript
+desc('This is the default task.');
+task('default', function (params) {
+ console.log('This is the default task.');
+});
+
+desc('This task has prerequisites.');
+task('hasPrereqs', ['foo', 'bar', 'baz'], function (params) {
+ console.log('Ran some prereqs first.');
+});
+```
+
+And here's an example of an asynchronous task:
+
+```javascript
+desc('This is an asynchronous task.');
+task('asyncTask', {async: true}, function () {
+ setTimeout(complete, 1000);
+});
+```
+
+A Task is also an EventEmitter which emits the 'complete' event when it is
+finished. This allows asynchronous tasks to be run from within other asked via
+either `invoke` or `execute`, and ensure they will complete before the rest of
+the containing task executes. See the section "Running tasks from within other
+tasks," below.
+
+### File-tasks
+
+Create a file-task by calling `file`.
+
+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.
+
+```javascript
+desc('This builds a minified JS file for production.');
+file('foo-minified.js', ['bar', 'foo-bar.js', 'foo-baz.js'], function () {
+ // Code to concat and minify goes here
+});
+```
+
+### Directory-tasks
+
+Create a directory-task by calling `directory`.
+
+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.
+
+```javascript
+desc('This creates the bar directory for use with the foo-minified.js file-task.');
+directory('bar');
+```
+
+This task will create the directory when used as a prerequisite for a file-task,
+or when run from the command-line.
+
+### Namespaces
+
+Use `namespace` to create a namespace of tasks to perform. Call it with two arguments:
+
+```javascript
+namespace(name, namespaceTasks);
+```
+
+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.
+
+Here's an example:
+
+```javascript
+desc('This is the default task.');
+task('default', function () {
+ console.log('This is the default task.');
+});
+
+namespace('foo', function () {
+ desc('This the foo:bar task');
+ task('bar', function () {
+ console.log('doing foo:bar task');
+ });
+
+ desc('This the foo:baz task');
+ task('baz', ['default', 'foo:bar'], function () {
+ console.log('doing foo:baz task');
+ });
+
+});
+```
+
+In this example, the foo:baz task depends on the the default and foo:bar tasks.
+
+### Passing parameters to jake
+
+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:
+
+```javascript
+desc('This is an awesome task.');
+task('awesome', function (a, b, c) {
+ console.log(a, b, c);
+});
+```
+
+You could run `jake` like this:
+
+ jake awesome[foo,bar,baz]
+
+And you'd get the following output:
+
+ foo bar baz
+
+Note that you *cannot* uses spaces between the commas separating the parameters.
+
+Any parameters passed after the Jake task that contain an equals sign (=) will
+be added to process.env.
+
+With the following Jakefile:
+
+```javascript
+desc('This is an awesome task.');
+task('awesome', function (a, b, c) {
+ console.log(a, b, c);
+ console.log(process.env.qux, process.env.frang);
+});
+```
+
+You could run `jake` like this:
+
+ jake awesome[foo,bar,baz] qux=zoobie frang=asdf
+
+And you'd get the following output:
+
+ foo bar baz
+ zoobie asdf
+Running `jake` with no arguments runs the default task.
+
+__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"
+
+### Cleanup after all tasks run, jake 'complete' event
+
+The base 'jake' object is an EventEmitter, and fires a 'complete' event after
+running all tasks.
+
+This is sometimes useful when a task starts a process which keeps the Node
+event-loop running (e.g., a database connection). If you know you want to stop
+the running Node process after all tasks have finished, you can set a listener
+for the 'complete' event, like so:
+
+```javascript
+jake.addListener('complete', function () {
+ process.exit();
+});
+```
+
+### Running tasks from within other tasks
+
+Jake supports the ability to run a task from within another task via the
+`invoke` and `execute` methods.
+
+The `invoke` method will run the desired task, along with its prerequisites:
+
+```javascript
+desc('Calls the foo:bar task and its prerequisites.');
+task('invokeFooBar', function () {
+ // Calls foo:bar and its prereqs
+ jake.Task['foo:bar'].invoke();
+});
+```
+
+The `invoke` method will only run the task once, even if you call it repeatedly.
+
+```javascript
+desc('Calls the foo:bar task and its prerequisites.');
+task('invokeFooBar', function () {
+ // Calls foo:bar and its prereqs
+ jake.Task['foo:bar'].invoke();
+ // Does nothing
+ jake.Task['foo:bar'].invoke();
+});
+```
+
+The `execute` method will run the desired task without its prerequisites:
+
+```javascript
+desc('Calls the foo:bar task without its prerequisites.');
+task('executeFooBar', function () {
+ // Calls foo:bar without its prereqs
+ jake.Task['foo:baz'].execute();
+});
+```
+
+Calling `execute` repeatedly will run the desired task repeatedly.
+
+```javascript
+desc('Calls the foo:bar task without its prerequisites.');
+task('executeFooBar', function () {
+ // Calls foo:bar without its prereqs
+ jake.Task['foo:baz'].execute();
+ // Can keep running this over and over
+ jake.Task['foo:baz'].execute();
+ jake.Task['foo:baz'].execute();
+});
+```
+
+If you want to run the task and its prerequisites more than once, you can use
+`invoke` with the `reenable` method.
+
+```javascript
+desc('Calls the foo:bar task and its prerequisites.');
+task('invokeFooBar', function () {
+ // Calls foo:bar and its prereqs
+ jake.Task['foo:bar'].invoke();
+ // Does nothing
+ jake.Task['foo:bar'].invoke();
+ // Only re-runs foo:bar, but not its prerequisites
+ jake.Task['foo:bar'].reenable();
+ jake.Task['foo:bar'].invoke();
+});
+```
+
+The `reenable` method takes a single Boolean arg, a 'deep' flag, which reenables
+the task's prerequisites if set to true.
+
+```javascript
+desc('Calls the foo:bar task and its prerequisites.');
+task('invokeFooBar', function () {
+ // Calls foo:bar and its prereqs
+ jake.Task['foo:bar'].invoke();
+ // Does nothing
+ jake.Task['foo:bar'].invoke();
+ // Re-runs foo:bar and all of its prerequisites
+ jake.Task['foo:bar'].reenable(true);
+ jake.Task['foo:bar'].invoke();
+});
+```
+
+It's easy to pass params on to a sub-task run via `invoke` or `execute`:
+
+```javascript
+desc('Passes params on to other tasks.');
+task('passParams', function () {
+ var t = jake.Task['foo:bar'];
+ // Calls foo:bar, passing along current args
+ t.invoke.apply(t, arguments);
+});
+```
+
+### Managing asynchrony without prereqs (e.g., when using `invoke`)
+
+You can mix sync and async without problems when using normal prereqs, because
+the Jake execution loop takes care of the difference for you. But when you call
+`invoke` or `execute`, you have to manage the asynchrony yourself.
+
+Here's a correct working example:
+
+```javascript
+task('async1', ['async2'], {async: true}, function () {
+ console.log('-- async1 start ----------------');
+ setTimeout(function () {
+ console.log('-- async1 done ----------------');
+ complete();
+ }, 1000);
+});
+
+task('async2', {async: true}, function () {
+ console.log('-- async2 start ----------------');
+ setTimeout(function () {
+ console.log('-- async2 done ----------------');
+ complete();
+ }, 500);
+});
+
+task('init', ['async1', 'async2'], {async: true}, function () {
+ console.log('-- init start ----------------');
+ setTimeout(function () {
+ console.log('-- init done ----------------');
+ complete();
+ }, 100);
+});
+
+task('default', {async: true}, function () {
+ console.log('-- default start ----------------');
+ var init = jake.Task.init;
+ init.addListener('complete', function () {
+ console.log('-- default done ----------------');
+ complete();
+ });
+ init.invoke();
+});
+```
+
+You have to declare the "default" task as asynchronous as well, and call
+`complete` on it when "init" finishes. Here's the output:
+
+ -- default start ----------------
+ -- async2 start ----------------
+ -- async2 done ----------------
+ -- async1 start ----------------
+ -- async1 done ----------------
+ -- init start ----------------
+ -- init done ----------------
+ -- default done ----------------
+
+You get what you expect -- "default" starts, the rest runs, and finally
+"default" finishes.
+
+### Evented tasks
+
+Tasks are EventEmitters. They can fire 'complete' and 'error' events.
+
+If a task called via `invoke` is asynchronous, you can set a listener on the
+'complete' event to run any code that depends on it.
+
+```javascript
+desc('Calls the async foo:baz task and its prerequisites.');
+task('invokeFooBaz', {async: true}, function () {
+ var t = jake.Task['foo:baz'];
+ t.addListener('complete', function () {
+ console.log('Finished executing foo:baz');
+ // Maybe run some other code
+ // ...
+ // Complete the containing task
+ complete();
+ });
+ // Kick off foo:baz
+ t.invoke();
+});
+```
+
+If you want to handle the errors in a task in some specific way, you can set a
+listener for the 'error' event, like so:
+
+```javascript
+namespace('vronk', function () {
+ task('groo', function () {
+ var t = jake.Task['vronk:zong'];
+ t.addListener('error', function (e) {
+ console.log(e.message);
+ });
+ t.invoke();
+ });
+
+ task('zong', function () {
+ throw new Error('OMFGZONG');
+ });
+});
+```
+
+If no specific listener is set for the "error" event, errors are handled by
+Jake's generic error-handling.
+
+### Aborting a task
+
+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`:
+
+```javascript
+desc('This task fails.');
+task('failTask', function () {
+ fail('Yikes. Something back happened.');
+});
+```
+
+You can also pass an optional exit status-code to the fail command, like so:
+
+```javascript
+desc('This task fails with an exit-status of 42.');
+task('failTaskQuestionCustomStatus', function () {
+ fail('What is the answer?', 42);
+});
+```
+
+The process will exit with a status of 42.
+
+Uncaught errors will also abort the currently running task.
+
+### Showing the list of tasks
+
+Passing `jake` the -T or --tasks flag will display the full list of tasks
+available in a Jakefile, along with their descriptions:
+
+ $ jake -T
+ jake default # This is the default task.
+ jake asdf # This is the asdf task.
+ jake concat.txt # File task, concating two files together
+ jake failure # Failing task.
+ jake lookup # Jake task lookup by name.
+ jake foo:bar # This the foo:bar task
+ jake foo:fonebone # This the foo:fonebone task
+
+Setting a value for -T/--tasks will filter the list by that value:
+
+ $ jake -T foo
+ jake foo:bar # This the foo:bar task
+ jake foo:fonebone # This the foo:fonebone task
+
+The list displayed will be all tasks whose namespace/name contain the filter-string.
+
+## Breaking things up into multiple files
+
+Jake will automatically look for files with a .jake extension in a 'jakelib'
+directory in your project, and load them (via `require`) after loading your
+Jakefile. (The directory name can be overridden using the -J/--jakelibdir
+command-line option.)
+
+This allows you to break your tasks up over multiple files -- a good way to do
+it is one namespace per file: e.g., a `zardoz` namespace full of tasks in
+'jakelib/zardox.jake'.
+
+Note that these .jake files each run in their own module-context, so they don't
+have access to each others' data. However, the Jake API methods, and the
+task-hierarchy are globally available, so you can use tasks in any file as
+prerequisites for tasks in any other, just as if everything were in a single
+file.
+
+Environment-variables set on the command-line are likewise also naturally
+available to code in all files via process.env.
+
+## File-utils
+
+Since shelling out in Node is an asynchronous operation, Jake comes with a few
+useful file-utilities with a synchronous API, that make scripting easier.
+
+The `jake.mkdirP` utility recursively creates a set of nested directories. It
+will not throw an error if any of the directories already exists. Here's an example:
+
+```javascript
+jake.mkdirP('app/views/layouts');
+```
+
+The `jake.cpR` utility does a recursive copy of a file or directory. It takes
+two arguments, the file/directory to copy, and the destination. Note that this
+command can only copy files and directories; it does not perform globbing (so
+arguments like '*.txt' are not possible).
+
+```javascript
+jake.cpR(path.join(sourceDir, '/templates'), currentDir);
+```
+
+This would copy 'templates' (and all its contents) into `currentDir`.
+
+The `jake.readdirR` utility gives you a recursive directory listing, giving you
+output somewhat similar to the Unix `find` command. It only works with a
+directory name, and does not perform filtering or globbing.
+
+```javascript
+jake.readdirR('pkg');
+```
+
+This would return an array of filepaths for all files in the 'pkg' directory,
+and all its subdirectories.
+
+The `jake.rmRf` utility recursively removes a directory and all its contents.
+
+```javascript
+jake.rmRf('pkg');
+```
+
+This would remove the 'pkg' directory, and all its contents.
+
+## Running shell-commands: `jake.exec` and `jake.createExec`
+
+Jake also provides a more general utility function for running a sequence of
+shell-commands.
+
+### `jake.exec`
+
+The `jake.exec` command takes an array of shell-command strings, and an optional
+callback to run after completing them. Here's an example from Jake's Jakefile,
+that runs the tests:
+
+```javascript
+desc('Runs the Jake tests.');
+task('test', {async: true}, function () {
+ var cmds = [
+ 'node ./tests/parseargs.js'
+ , 'node ./tests/task_base.js'
+ , 'node ./tests/file_task.js'
+ ];
+ jake.exec(cmds, {printStdout: true}, function () {
+ console.log('All tests passed.');
+ complete();
+ });
+
+desc('Runs some apps in interactive mode.');
+task('interactiveTask', {async: true}, function () {
+ var cmds = [
+ 'node' // Node conosle
+ , 'vim' // Open Vim
+ ];
+ jake.exec(cmds, {interactive: true}, function () {
+ complete();
+ });
+});
+```
+
+It also takes an optional options-object, with the following options:
+
+ * `interactive` (tasks are interactive, trumps printStdout and
+ printStderr below, default false)
+
+ * `printStdout` (print to stdout, default false)
+
+ * `printStderr` (print to stderr, default false)
+
+ * `breakOnError` (stop execution on error, default true)
+
+This command doesn't pipe input between commands -- it's for simple execution.
+
+### `jake.createExec` and the evented Exec object
+
+Jake also provides an evented interface for running shell commands. Calling
+`jake.createExec` returns an instance of `jake.Exec`, which is an `EventEmitter`
+that fires events as it executes commands.
+
+It emits the following events:
+
+* 'cmdStart': When a new command begins to run. Passes one arg, the command
+being run.
+
+* 'cmdEnd': When a command finishes. Passes one arg, the command
+being run.
+
+* 'stdout': When the stdout for the child-process recieves data. This streams
+the stdout data. Passes one arg, the chunk of data.
+
+* 'stderr': When the stderr for the child-process recieves data. This streams
+the stderr data. Passes one arg, the chunk of data.
+
+* 'error': When a shell-command exits with a non-zero status-code. Passes two
+args -- the error message, and the status code. If you do not set an error
+handler, and a command exits with an error-code, Jake will throw the unhandled
+error. If `breakOnError` is set to true, the Exec object will emit and 'error'
+event after the first error, and stop any further execution.
+
+To begin running the commands, you have to call the `run` method on it. It also
+has an `append` method for adding new commands to the list of commands to run.
+
+Here's an example:
+
+```javascript
+var ex = jake.createExec(['do_thing.sh'], {printStdout: true});
+ex.addListener('error', function (msg, code) {
+ if (code == 127) {
+ console.log("Couldn't find do_thing script, trying do_other_thing");
+ ex.append('do_other_thing.sh');
+ }
+ else {
+ fail('Fatal error: ' + msg, code);
+ }
+});
+ex.run();
+```
+
+Using the evented Exec object gives you a lot more flexibility in running shell
+commmands. But if you need something more sophisticated, Procstreams
+(<https://github.com/polotek/procstreams>) might be a good option.
+
+## Logging and output
+
+Using the -q/--quiet flag at the command-line will stop Jake from sending its
+normal output to standard output. Note that this only applies to built-in output
+from Jake; anything you output normally from your tasks will still be displayed.
+
+If you want to take advantage of the -q/--quiet flag in your own programs, you
+can use `jake.logger.log` and `jake.logger.error` for displaying output. These
+two commands will respect the flag, and suppress output correctly when the
+quiet-flag is on.
+
+You can check the current value of this flag in your own tasks by using
+`jake.program.opts.quiet`. If you want the output of a `jake.exec` shell-command
+to respect the quiet-flag, set your `printStdout` and `printStderr` options to
+false if the quiet-option is on:
+
+```javascript
+task('echo', {async: true}, function () {
+ jake.exec(['echo "hello"'], function () {
+ jake.logger.log('Done.');
+ complete();
+ }, {printStdout: !jake.program.opts.quiet});
+});
+```
+
+## PackageTask
+
+Instantiating a PackageTask programmically creates a set of tasks for packaging
+up your project for distribution. Here's an example:
+
+```javascript
+var t = new jake.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 'clobber' task that removes the pkg/
+directory.
+
+The [PackageTask API
+docs](http://mde.github.com/jake/doc/symbols/jake.PackageTask.html) include a
+lot more information, including different archiving options.
+
+### 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 the [minimatch](https://github.com/isaacs/minimatch) module.
+
+To build the list of files, use FileList's `include` and `exclude` methods:
+
+```javascript
+var list = new jake.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.
+
+## TestTask
+
+Instantiating a TestTask programmically creates a simple task for running tests
+for your project. The first argument of the constructor is the project-name
+(used in the description of the task), and the second argument is a function
+that defines the task. It allows you to specifify what files to run as tests,
+and what to name the task that gets created (defaults to "test" if unset).
+
+```javascript
+var t = new jake.TestTask('fonebone', function () {
+ var fileList = [
+ 'tests/*'
+ , 'lib/adapters/**/test.js'
+ ];
+ this.testFiles.include(fileList);
+ this.testFiles.exclude('tests/helper.js');
+ this.testName = 'testMainAndAdapters';
+});
+```
+
+Tests in the specified file should be in the very simple format of
+test-functions hung off the export. These tests are converted into Jake tasks
+which Jake then runs normally.
+
+If a test needs to run asynchronously, simply define the test-function with a
+single argument, a callback. Jake will define this as an asynchronous task, and
+will wait until the callback is called in the test function to run the next test.
+
+Here's an example test-file:
+
+```javascript
+var assert = require('assert')
+ , tests;
+
+tests = {
+ 'sync test': function () {
+ // Assert something
+ assert.ok(true);
+ }
+, 'async test': function (next) {
+ // Assert something else
+ assert.ok(true);
+ // Won't go next until this is called
+ next();
+ }
+, 'another sync test': function () {
+ // Assert something else
+ assert.ok(true);
+ }
+};
+
+module.exports = tests;
+```
+
+Jake's tests are also a good example of use of a TestTask.
+
+## 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:
+
+```javascript
+var p = new jake.NpmPublishTask('jake', [
+ 'Makefile'
+, 'Jakefile'
+, 'README.md'
+, 'package.json'
+, 'lib/*'
+, 'bin/*'
+, 'tests/*'
+]);
+```
+
+The NpmPublishTask 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
+7. Clean up the package
+
+## CoffeeScript Jakefiles
+
+Jake can also handle Jakefiles in CoffeeScript. Be sure to make it
+Jakefile.coffee so Jake knows it's in CoffeeScript.
+
+Here's an example:
+
+```coffeescript
+util = require('util')
+
+desc 'This is the default task.'
+task 'default', (params) ->
+ console.log 'Ths is the default task.'
+ console.log(util.inspect(arguments))
+ jake.Task['new'].invoke []
+
+task 'new', ->
+ console.log 'ello from new'
+ jake.Task['foo:next'].invoke ['param']
+
+namespace 'foo', ->
+ task 'next', (param) ->
+ console.log 'ello from next with param: ' + param
+```
+
+## Related projects
+
+James Coglan's "Jake": <http://github.com/jcoglan/jake>
+
+Confusingly, this is a Ruby tool for building JavaScript packages from source code.
+
+280 North's Jake: <http://github.com/280north/jake>
+
+This is also a JavaScript port of Rake, which runs on the Narwhal platform.
+
+### License
+
+Licensed under the Apache License, Version 2.0
+(<http://www.apache.org/licenses/LICENSE-2.0>)
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/node_modules/jake/bin/cli.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/node_modules/jake/bin/cli.js b/lib/cordova-blackberry/blackberry10/node_modules/jake/bin/cli.js
new file mode 100755
index 0000000..e241f2b
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/node_modules/jake/bin/cli.js
@@ -0,0 +1,23 @@
+#!/usr/bin/env node
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var args = process.argv.slice(2)
+ , jake = require('../lib/jake');
+
+jake.run.apply(jake, args);
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/api.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/api.js b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/api.js
new file mode 100644
index 0000000..97d7c78
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/api.js
@@ -0,0 +1,241 @@
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+var exec = require('child_process').exec;
+
+var api = new (function () {
+ /**
+ @name task
+ @static
+ @function
+ @description Creates a Jake Task
+ `
+ @param {String} name The name of the Task
+ @param {Array} [prereqs] Prerequisites to be run before this task
+ @param {Function} [action] The action to perform for this task
+ @param {Object} [opts]
+ @param {Boolean} [opts.asyc=false] Perform this task asynchronously.
+ If you flag a task with this option, you must call the global
+ `complete` method inside the task's action, for execution to proceed
+ to the next task.
+
+ @example
+ desc('This is the default task.');
+ task('default', function (params) {
+ console.log('This is the default task.');
+ });
+
+ desc('This task has prerequisites.');
+ task('hasPrereqs', ['foo', 'bar', 'baz'], function (params) {
+ console.log('Ran some prereqs first.');
+ });
+
+ desc('This is an asynchronous task.');
+ task('asyncTask', function () {
+ setTimeout(complete, 1000);
+ }, {async: true});
+ */
+ this.task = function (name, prereqs, action, opts) {
+ var args = Array.prototype.slice.call(arguments)
+ , type
+ , createdTask;
+ args.unshift('task');
+ createdTask = jake.createTask.apply(global, args);
+ jake.currentTaskDescription = null;
+ return createdTask;
+ };
+
+ /**
+ @name directory
+ @static
+ @function
+ @description Creates a Jake DirectoryTask. Can be used as a prerequisite
+ for FileTasks, or for simply ensuring a directory exists for use with a
+ Task's action.
+ `
+ @param {String} name The name of the DiretoryTask
+
+ @example
+
+ // Creates the package directory for distribution
+ directory('pkg');
+ */
+ this.directory = function (name) {
+ var args = Array.prototype.slice.call(arguments)
+ , createdTask;
+ args.unshift('directory');
+ createdTask = jake.createTask.apply(global, args);
+ jake.currentTaskDescription = null;
+ return createdTask;
+ };
+
+ /**
+ @name file
+ @static
+ @function
+ @description Creates a Jake FileTask.
+ `
+ @param {String} name The name of the FileTask
+ @param {Array} [prereqs] Prerequisites to be run before this task
+ @param {Function} [action] The action to create this file, if it doesn't
+ exist already.
+ @param {Object} [opts]
+ @param {Array} [opts.asyc=false] Perform this task asynchronously.
+ If you flag a task with this option, you must call the global
+ `complete` method inside the task's action, for execution to proceed
+ to the next task.
+
+ */
+ this.file = function (name, prereqs, action, opts) {
+ var args = Array.prototype.slice.call(arguments)
+ , createdTask;
+ args.unshift('file');
+ createdTask = jake.createTask.apply(global, args);
+ jake.currentTaskDescription = null;
+ return createdTask;
+ };
+
+ /**
+ @name desc
+ @static
+ @function
+ @description Creates a description for a Jake Task (or FileTask,
+ DirectoryTask). When invoked, the description that iscreated will
+ be associated with whatever Task is created next.
+ `
+ @param {String} description The description for the Task
+ */
+ this.desc = function (description) {
+ jake.currentTaskDescription = description;
+ };
+
+ /**
+ @name namespace
+ @static
+ @function
+ @description Creates a namespace which allows logical grouping
+ of tasks, and prevents name-collisions with task-names. Namespaces
+ can be nested inside of other namespaces.
+ `
+ @param {String} name The name of the namespace
+ @param {Function} scope The enclosing scope for the namespaced tasks
+
+ @example
+ namespace('doc', function () {
+ task('generate', ['doc:clobber'], function () {
+ // Generate some docs
+ });
+
+ task('clobber', function () {
+ // Clobber the doc directory first
+ });
+ });
+ */
+ this.namespace = function (name, scope) {
+ var curr = jake.currentNamespace
+ , ns = curr.childNamespaces[name] || new jake.Namespace(name, curr);
+ curr.childNamespaces[name] = ns;
+ jake.currentNamespace = ns;
+ scope();
+ jake.currentNamespace = curr;
+ jake.currentTaskDescription = null;
+ return ns;
+ };
+
+ /**
+ @name complete
+ @static
+ @function
+ @description Complets an asynchronous task, allowing Jake's
+ execution to proceed to the next task
+ `
+ @example
+ task('generate', ['doc:clobber'], function () {
+ exec('./generate_docs.sh', function (err, stdout, stderr) {
+ if (err || stderr) {
+ fail(err || stderr);
+ }
+ else {
+ console.log(stdout);
+ complete();
+ }
+ });
+ }, {async: true});
+ */
+ this.complete = function () {
+ var current = jake._invocationChain.pop();
+ if (current) {
+ current.complete();
+ }
+ };
+
+ /**
+ @name fail
+ @static
+ @function
+ @description Causes Jake execution to abort with an error.
+ Allows passing an optional error code, which will be used to
+ set the exit-code of exiting process.
+ `
+ @param {Error|String} err The error to thow when aborting execution.
+ If this argument is an Error object, it will simply be thrown. If
+ a String, it will be used as the error-message. (If it is a multi-line
+ String, the first line will be used as the Error message, and the
+ remaining lines will be used as the error-stack.)
+
+ @example
+ task('createTests, function () {
+ if (!fs.existsSync('./tests')) {
+ fail('Test directory does not exist.');
+ }
+ else {
+ // Do some testing stuff ...
+ }
+ });
+ */
+ this.fail = function (err, code) {
+ var msg
+ , errObj;
+ if (code) {
+ jake.errorCode = code;
+ }
+ if (err) {
+ if (typeof err == 'string') {
+ // Use the initial or only line of the error as the error-message
+ // If there was a multi-line error, use the rest as the stack
+ msg = err.split('/n');
+ errObj = new Error(msg.shift());
+ if (msg.length) {
+ errObj.stack = msg.join('\n');
+ }
+ throw errObj;
+ }
+ else if (err instanceof Error) {
+ throw err;
+ }
+ else {
+ throw new Error(err.toString());
+ }
+ }
+ else {
+ throw new Error();
+ }
+ };
+
+})();
+
+module.exports = api;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/file_list.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/file_list.js b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/file_list.js
new file mode 100644
index 0000000..f0dd732
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/file_list.js
@@ -0,0 +1,284 @@
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+var fs = require('fs')
+, path = require('path')
+, minimatch = require('minimatch')
+, utils = require('utilities')
+, globSync;
+
+globSync = function (pat) {
+ var dirname = jake.basedir(pat)
+ , files = jake.readdirR(dirname)
+ , matches;
+ pat = path.normalize(pat);
+ // Hack, Minimatch doesn't support backslashes in the pattern
+ // https://github.com/isaacs/minimatch/issues/7
+ pat = pat.replace(/\\/g, '/');
+ matches = minimatch.match(files, pat, {});
+ return matches;
+};
+
+// Constants
+// ---------------
+// List of all the builtin Array methods we want to override
+var ARRAY_METHODS = Object.getOwnPropertyNames(Array.prototype)
+// Array methods that return a copy instead of affecting the original
+ , SPECIAL_RETURN = {
+ 'concat': true
+ , 'slice': true
+ , 'filter': true
+ , 'map': true
+ }
+// Default file-patterns we want to ignore
+ , DEFAULT_IGNORE_PATTERNS = [
+ /(^|[\/\\])CVS([\/\\]|$)/
+ , /(^|[\/\\])\.svn([\/\\]|$)/
+ , /(^|[\/\\])\.git([\/\\]|$)/
+ , /\.bak$/
+ , /~$/
+ ]
+// Ignore core files
+ , DEFAULT_IGNORE_FUNCS = [
+ function (name) {
+ var isDir = false
+ , stats;
+ try {
+ stats = fs.statSync(name);
+ isDir = stats.isDirectory();
+ }
+ catch(e) {}
+ return (/(^|[\/\\])core$/).test(name) && !isDir;
+ }
+ ];
+
+var FileList = function () {
+ var self = this
+ , wrap;
+
+ // List of glob-patterns or specific filenames
+ this.pendingAdd = [];
+ // Switched to false after lazy-eval of files
+ this.pending = true;
+ // Used to calculate exclusions from the list of files
+ this.excludes = {
+ pats: DEFAULT_IGNORE_PATTERNS.slice()
+ , funcs: DEFAULT_IGNORE_FUNCS.slice()
+ , regex: null
+ };
+ this.items = [];
+
+ // Wrap the array methods with the delegates
+ wrap = function (prop) {
+ var arr;
+ self[prop] = function () {
+ if (self.pending) {
+ self.resolve();
+ }
+ if (typeof self.items[prop] == 'function') {
+ // Special method that return a copy
+ if (SPECIAL_RETURN[prop]) {
+ arr = self.items[prop].apply(self.items, arguments);
+ return FileList.clone(self, arr);
+ }
+ else {
+ return self.items[prop].apply(self.items, arguments);
+ }
+ }
+ else {
+ return self.items[prop];
+ }
+ };
+ };
+ for (var i = 0, ii = ARRAY_METHODS.length; i < ii; i++) {
+ wrap(ARRAY_METHODS[i]);
+ }
+
+ // Include whatever files got passed to the constructor
+ this.include.apply(this, arguments);
+
+ // Fix constructor linkage
+ this.constructor = FileList;
+};
+
+FileList.prototype = new (function () {
+ var globPattern = /[*?\[\{]/;
+
+ var _addMatching = function (pat) {
+ var matches = globSync(pat);
+ this.items = this.items.concat(matches);
+ }
+
+ , _resolveAdd = function (name) {
+ if (globPattern.test(name)) {
+ _addMatching.call(this, name);
+ }
+ else {
+ this.push(name);
+ }
+ }
+
+ , _calculateExcludeRe = function () {
+ var pats = this.excludes.pats
+ , pat
+ , excl = []
+ , matches = [];
+
+ for (var i = 0, ii = pats.length; i < ii; i++) {
+ pat = pats[i];
+ if (typeof pat == 'string') {
+ // Glob, look up files
+ if (/[*?]/.test(pat)) {
+ matches = globSync(pat);
+ excl = excl.concat(matches);
+ }
+ // String for regex
+ else {
+ excl.push(utils.string.escapeRegExpChars(pat));
+ }
+ }
+ // Regex, grab the string-representation
+ else if (pat instanceof RegExp) {
+ excl.push(pat.toString().replace(/^\/|\/$/g, ''));
+ }
+ }
+ if (excl.length) {
+ this.excludes.regex = new RegExp('(' + excl.join(')|(') + ')');
+ }
+ else {
+ this.excludes.regex = /^$/;
+ }
+ }
+
+ , _resolveExclude = function () {
+ var self = this;
+ _calculateExcludeRe.call(this);
+ // No `reject` method, so use reverse-filter
+ this.items = this.items.filter(function (name) {
+ return !self.shouldExclude(name);
+ });
+ }
+
+ /**
+ * Includes file-patterns in the FileList. Should be called with one or more
+ * pattern for finding file to include in the list. Arguments should be strings
+ * for either a glob-pattern or a specific file-name, or an array of them
+ */
+ this.include = function () {
+ var args = Array.isArray(arguments[0]) ? arguments[0] : arguments;
+ for (var i = 0, ii = args.length; i < ii; i++) {
+ this.pendingAdd.push(args[i]);
+ }
+ return this;
+ };
+
+ /**
+ * Indicates whether a particular file would be filtered out by the current
+ * exclusion rules for this FileList.
+ * @param {String} name The filename to check
+ * @return {Boolean} Whether or not the file should be excluded
+ */
+ this.shouldExclude = function (name) {
+ if (!this.excludes.regex) {
+ _calculateExcludeRe.call(this);
+ }
+ var excl = this.excludes;
+ return excl.regex.test(name) || excl.funcs.some(function (f) {
+ return !!f(name);
+ });
+ };
+
+ /**
+ * Excludes file-patterns from the FileList. Should be called with one or more
+ * pattern for finding file to include in the list. Arguments can be:
+ * 1. Strings for either a glob-pattern or a specific file-name
+ * 2. Regular expression literals
+ * 3. Functions to be run on the filename that return a true/false
+ */
+ this.exclude = function () {
+ var args = Array.isArray(arguments[0]) ? arguments[0] : arguments
+ , arg;
+ for (var i = 0, ii = args.length; i < ii; i++) {
+ arg = args[i];
+ if (typeof arg == 'function' && !(arg instanceof RegExp)) {
+ this.excludes.funcs.push(arg);
+ }
+ else {
+ this.excludes.pats.push(arg);
+ }
+ }
+ if (!this.pending) {
+ _resolveExclude.call(this);
+ }
+ return this;
+ };
+
+ /**
+ * Populates the FileList from the include/exclude rules with a list of
+ * actual files
+ */
+ this.resolve = function () {
+ var name;
+ if (this.pending) {
+ this.pending = false;
+ while ((name = this.pendingAdd.shift())) {
+ _resolveAdd.call(this, name);
+ }
+ _resolveExclude.call(this);
+ }
+ return this;
+ };
+
+ /**
+ * Convert to a plain-jane array
+ */
+ this.toArray = function () {
+ // Call slice to ensure lazy-resolution before slicing items
+ var ret = this.slice().items.slice();
+ return ret;
+ };
+
+ /**
+ * Get rid of any current exclusion rules
+ */
+ this.clearExclude = function () {
+ this.excludes = {
+ pats: []
+ , funcs: []
+ , regex: null
+ };
+ return this;
+ };
+
+})();
+
+// Static method, used to create copy returned by special
+// array methods
+FileList.clone = function (list, items) {
+ var clone = new FileList();
+ if (items) {
+ clone.items = items;
+ }
+ clone.pendingAdd = list.pendingAdd;
+ clone.pending = list.pending;
+ for (var p in list.excludes) {
+ clone.excludes[p] = list.excludes[p];
+ }
+ return clone;
+};
+
+exports.FileList = FileList;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/jake.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/jake.js b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/jake.js
new file mode 100644
index 0000000..e271342
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/jake.js
@@ -0,0 +1,280 @@
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var jake
+ , EventEmitter = require('events').EventEmitter
+ , fs = require('fs')
+ , path = require('path')
+ , taskNs = require('./task')
+ , Task = taskNs.Task
+ , FileTask = taskNs.FileTask
+ , DirectoryTask = taskNs.DirectoryTask
+ , api = require('./api')
+ , utils = require('./utils')
+ , Program = require('./program').Program
+ , Loader = require('./loader').Loader
+ , pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json').toString());
+
+var Namespace = function (name, parentNamespace) {
+ this.name = name;
+ this.parentNamespace = parentNamespace;
+ this.childNamespaces = {};
+ this.tasks = {};
+
+ this.resolve = function(relativeName) {
+ var parts = relativeName.split(':')
+ , name = parts.pop()
+ , ns = this
+ , task;
+ for(var i = 0, l = parts.length; ns && i < l; i++) {
+ ns = ns.childNamespaces[parts[i]];
+ }
+
+ return (ns && ns.tasks[name]) ||
+ (this.parentNamespace && this.parentNamespace.resolve(relativeName));
+ }
+
+};
+
+var Invocation = function (taskName, args) {
+ this.taskName = taskName;
+ this.args = args;
+};
+
+// And so it begins
+jake = new EventEmitter();
+
+// Globalize jake and top-level API methods (e.g., `task`, `desc`)
+global.jake = jake;
+utils.mixin(global, api);
+
+// Copy utils onto base jake
+utils.mixin(jake, utils);
+// File utils should be aliased directly on base jake as well
+utils.mixin(jake, utils.file);
+
+utils.mixin(jake, new (function () {
+
+ this._invocationChain = [];
+
+ // Private variables
+ // =================
+ // Local reference for scopage
+ var self = this;
+
+ // Public properties
+ // =================
+ this.version = pkg.version;
+ // Used when Jake exits with a specific error-code
+ this.errorCode = undefined;
+ // Loads Jakefiles/jakelibdirs
+ this.loader = new Loader();
+ // Name/value map of all the various tasks defined in a Jakefile.
+ // Non-namespaced tasks are placed into 'default.'
+ this.defaultNamespace = new Namespace('default', null);
+ // For namespaced tasks -- tasks with no namespace are put into the
+ // 'default' namespace so lookup code can work the same for both
+ // namespaced and non-namespaced.
+ this.currentNamespace = this.defaultNamespace;
+ // Saves the description created by a 'desc' call that prefaces a
+ // 'task' call that defines a task.
+ this.currentTaskDescription = null;
+ this.program = new Program()
+ this.FileList = require('./file_list').FileList;
+ this.PackageTask = require('./package_task').PackageTask;
+ this.NpmPublishTask = require('./npm_publish_task').NpmPublishTask;
+ this.TestTask = require('./test_task').TestTask;
+ this.Task = Task;
+ this.FileTask = FileTask;
+ this.DirectoryTask = DirectoryTask;
+ this.Namespace = Namespace;
+
+ this.parseAllTasks = function () {
+ var _parseNs = function (name, ns) {
+ var nsTasks = ns.tasks
+ , task
+ , nsNamespaces = ns.childNamespaces
+ , fullName;
+ // Iterate through the tasks in each namespace
+ for (var q in nsTasks) {
+ task = nsTasks[q];
+ // Preface only the namespaced tasks
+ fullName = name == 'default' ? q : name + ':' + q;
+ // Save with 'taskname' or 'namespace:taskname' key
+ task.fullName = fullName;
+ jake.Task[fullName] = task;
+ }
+ for (var p in nsNamespaces) {
+ fullName = name == 'default' ? p : name + ':' + p;
+ _parseNs(fullName, nsNamespaces[p]);
+ }
+ };
+
+ _parseNs('default', jake.defaultNamespace);
+ };
+
+ /**
+ * Displays the list of descriptions avaliable for tasks defined in
+ * a Jakefile
+ */
+ this.showAllTaskDescriptions = function (f) {
+ var maxTaskNameLength = 0
+ , task
+ , str = ''
+ , padding
+ , name
+ , descr
+ , filter = typeof f == 'string' ? f : null;
+
+ for (var p in jake.Task) {
+ task = jake.Task[p];
+ // Record the length of the longest task name -- used for
+ // pretty alignment of the task descriptions
+ maxTaskNameLength = p.length > maxTaskNameLength ?
+ p.length : maxTaskNameLength;
+ }
+ // Print out each entry with descriptions neatly aligned
+ for (var p in jake.Task) {
+ if (filter && p.indexOf(filter) == -1) {
+ continue;
+ }
+ task = jake.Task[p];
+
+ name = '\033[32m' + p + '\033[39m ';
+
+ // Create padding-string with calculated length
+ padding = (new Array(maxTaskNameLength - p.length + 2)).join(' ');
+
+ descr = task.description
+ if (descr) {
+ descr = '\033[90m # ' + descr + '\033[39m \033[37m \033[39m';
+ console.log('jake ' + name + padding + descr);
+ }
+ }
+ };
+
+ this.createTask = function () {
+ var args = Array.prototype.slice.call(arguments)
+ , arg
+ , task
+ , type
+ , name
+ , action
+ , opts = {}
+ , prereqs = [];
+
+ type = args.shift()
+
+ // name, [deps], [action]
+ // Name (string) + deps (array) format
+ if (typeof args[0] == 'string') {
+ name = args.shift();
+ if (Array.isArray(args[0])) {
+ prereqs = args.shift();
+ }
+ }
+ // name:deps, [action]
+ // Legacy object-literal syntax, e.g.: {'name': ['depA', 'depB']}
+ else {
+ obj = args.shift()
+ for (var p in obj) {
+ prereqs = prereqs.concat(obj[p]);
+ name = p;
+ }
+ }
+
+ // Optional opts/callback or callback/opts
+ while ((arg = args.shift())) {
+ if (typeof arg == 'function') {
+ action = arg;
+ }
+ else {
+ opts = arg;
+ }
+ }
+
+ task = jake.currentNamespace.resolve(name);
+ if (task && !action) {
+ // Task already exists and no action, just update prereqs, and return it.
+ task.prereqs = task.prereqs.concat(prereqs);
+ return task;
+ }
+
+ switch (type) {
+ case 'directory':
+ action = function () {
+ jake.mkdirP(name);
+ };
+ task = new DirectoryTask(name, prereqs, action, opts);
+ break;
+ case 'file':
+ task = new FileTask(name, prereqs, action, opts);
+ break;
+ default:
+ task = new Task(name, prereqs, action, opts);
+ }
+
+ if (jake.currentTaskDescription) {
+ task.description = jake.currentTaskDescription;
+ jake.currentTaskDescription = null;
+ }
+ jake.currentNamespace.tasks[name] = task;
+ task.namespace = jake.currentNamespace;
+
+ // FIXME: Should only need to add a new entry for the current
+ // task-definition, not reparse the entire structure
+ jake.parseAllTasks();
+
+ return task;
+ };
+
+ this.init = function () {
+ var self = this;
+ process.addListener('uncaughtException', function (err) {
+ self.program.handleErr(err);
+ });
+
+ };
+
+ this.run = function () {
+ var args = Array.prototype.slice.call(arguments)
+ , program = this.program
+ , loader = this.loader
+ , preempt
+ , opts;
+
+ program.parseArgs(args);
+ program.init();
+
+ preempt = program.firstPreemptiveOption();
+ if (preempt) {
+ preempt();
+ }
+ else {
+ opts = program.opts;
+ // Load Jakefile and jakelibdir files
+ loader.loadFile(opts.jakefile);
+ loader.loadDirectory(opts.jakelibdir);
+
+ program.run();
+ }
+ };
+
+})());
+
+module.exports = jake;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/loader.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/loader.js b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/loader.js
new file mode 100644
index 0000000..58c7080
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/loader.js
@@ -0,0 +1,94 @@
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var path = require('path')
+ , fs = require('fs')
+ , existsSync = typeof fs.existsSync == 'function' ?
+ fs.existsSync : path.existsSync
+ , utils = require('utilities')
+ , Loader;
+
+
+Loader = function () {
+
+ var JAKEFILE_PAT = /\.jake(\.js|\.coffee)?$/;
+
+ var _requireCoffee = function () {
+ try {
+ return require('coffee-script');
+ }
+ catch (e) {
+ fail('CoffeeScript is missing! Try `npm install coffee-script`');
+ }
+ };
+
+ this.loadFile = function (file) {
+ var jakefile = file ?
+ file.replace(/\.js$/, '').replace(/\.coffee$/, '') : 'Jakefile'
+ , fileSpecified = !!file
+ // Dear God, why?
+ , isCoffee = false
+ // Warning, recursive
+ , exists;
+
+ exists = function () {
+ var cwd = process.cwd();
+ if (existsSync(jakefile) || existsSync(jakefile + '.js') ||
+ existsSync(jakefile + '.coffee')) {
+ return true;
+ }
+ if (!fileSpecified) {
+ process.chdir("..");
+ if (cwd === process.cwd()) {
+ return false;
+ }
+ return exists();
+ }
+ };
+
+ if (!exists()) {
+ fail('No Jakefile. Specify a valid path with -f/--jakefile, ' +
+ 'or place one in the current directory.');
+ }
+
+ isCoffee = existsSync(jakefile + '.coffee');
+ if (isCoffee) {
+ CoffeeScript = _requireCoffee();
+ }
+ require(utils.file.absolutize(jakefile));
+ };
+
+ this.loadDirectory = function (d) {
+ var dirname = d || 'jakelib'
+ , dirlist;
+ dirname = utils.file.absolutize(dirname);
+ if (existsSync(dirname)) {
+ dirlist = fs.readdirSync(dirname);
+ dirlist.forEach(function (filePath) {
+ if (JAKEFILE_PAT.test(filePath)) {
+ if (/\.coffee$/.test(filePath)) {
+ CoffeeScript = _requireCoffee();
+ }
+ require(path.join(dirname, filePath));
+ }
+ });
+ }
+ };
+};
+
+module.exports.Loader = Loader;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/npm_publish_task.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/npm_publish_task.js b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/npm_publish_task.js
new file mode 100644
index 0000000..d4f029b
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/npm_publish_task.js
@@ -0,0 +1,193 @@
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var fs = require('fs')
+ , exec = require('child_process').exec
+ , utils = require('utilities')
+ , currDir = process.cwd();
+
+var NpmPublishTask = function (name, packageFiles) {
+ this.name = name;
+ this.packageFiles = packageFiles;
+ this.define();
+};
+
+
+NpmPublishTask.prototype = new (function () {
+
+ var _currentBranch = null;
+
+ var getPackage = function () {
+ var pkg = JSON.parse(fs.readFileSync(process.cwd() + '/package.json').toString());
+ return pkg;
+ }
+ , getPackageVersionNumber = function () {
+ return getPackage().version;
+ };
+
+ this.define = function () {
+ var self = this;
+
+ namespace('npm', function () {
+ task('fetchTags', {async: true}, function () {
+ // Make sure local tags are up to date
+ cmds = [
+ 'git fetch --tags'
+ ];
+ jake.exec(cmds, function () {
+ console.log('Fetched remote tags.');
+ complete();
+ });
+ });
+
+ task('getCurrentBranch', {async: true}, function () {
+ // Figure out what branch to push to
+ exec('git symbolic-ref --short HEAD',
+ function (err, stdout, stderr) {
+ if (err) {
+ fail(err);
+ }
+ if (stderr) {
+ fail(new Error(stderr));
+ }
+ if (!stdout) {
+ fail(new Error('No current Git branch found'));
+ }
+ _currentBranch = utils.string.trim(stdout);
+ console.log('On branch ' + _currentBranch);
+ complete();
+ });
+ });
+
+ task('version', {async: true}, function () {
+ // Only bump, push, and tag if the Git repo is clean
+ exec('git status --porcelain --untracked-files=no',
+ function (err, stdout, stderr) {
+ var cmds
+ , path
+ , pkg
+ , version
+ , arr
+ , patch
+ , message;
+
+ if (err) {
+ fail(err);
+ }
+ if (stderr) {
+ fail(new Error(stderr));
+ }
+ if (stdout.length) {
+ fail(new Error('Git repository is not clean.'));
+ }
+
+ // Grab the current version-string
+ path = process.cwd() + '/package.json';
+ pkg = getPackage();
+ version = pkg.version;
+ // Increment the patch-number for the version
+ arr = version.split('.');
+ patch = parseInt(arr.pop(), 10) + 1;
+ arr.push(patch);
+ version = arr.join('.');
+ // New package-version
+ pkg.version = version;
+ // Commit-message
+ message = 'Version ' + version
+
+ // Update package.json with the new version-info
+ fs.writeFileSync(path, JSON.stringify(pkg, true, 2));
+
+ cmds = [
+ 'git commit package.json -m "' + message + '"'
+ , 'git push origin ' + _currentBranch
+ , 'git tag -a v' + version + ' -m "' + message + '"'
+ , 'git push --tags'
+ ];
+
+ jake.exec(cmds, function () {
+ var version = getPackageVersionNumber();
+ console.log('Bumped version number to v' + version + '.');
+ complete();
+ });
+ });
+ });
+
+ task('definePackage', function () {
+ var version = getPackageVersionNumber()
+ , t;
+ t = new jake.PackageTask(self.name, 'v' + version, function () {
+ this.packageFiles.include(self.packageFiles);
+ this.needTarGz = true;
+ });
+ });
+
+ task('package', {async: true}, function () {
+ var definePack = jake.Task['npm:definePackage']
+ , pack = jake.Task['package']
+ , version = getPackageVersionNumber();
+ // May have already been run
+ definePack.reenable(true);
+ definePack.addListener('complete', function () {
+ pack.addListener('complete', function () {
+ console.log('Created package for ' + self.name + ' v' + version);
+ complete();
+ });
+ pack.invoke();
+ });
+ definePack.invoke();
+ });
+
+ task('publish', {async: true}, function () {
+ var version = getPackageVersionNumber();
+ console.log('Publishing ' + self.name + ' v' + version);
+ cmds = [
+ 'npm publish pkg/' + self.name + '-v' + version + '.tar.gz'
+ ];
+ // Hackity hack -- NPM publish sometimes returns errror like:
+ // Error sending version data\nnpm ERR!
+ // Error: forbidden 0.2.4 is modified, should match modified time
+ setTimeout(function () {
+ jake.exec(cmds, function () {
+ console.log('Published to NPM');
+ complete();
+ }, {stdout: true});
+ }, 5000);
+ });
+
+ task('cleanup', function () {
+ var clobber = jake.Task['clobber'];
+ clobber.reenable(true);
+ clobber.invoke();
+ console.log('Cleaned up package');
+ });
+
+ });
+
+ desc('Bump version-number, package, and publish to NPM.');
+ task('publish', ['npm:fetchTags', 'npm:getCurrentBranch', 'npm:version',
+ 'npm:package', 'npm:publish', 'npm:cleanup'], function () {});
+
+ jake.Task['npm:definePackage'].invoke();
+ };
+
+})();
+
+jake.NpmPublishTask = NpmPublishTask;
+exports.NpmPublishTask = NpmPublishTask;
+
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/package_task.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/package_task.js b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/package_task.js
new file mode 100644
index 0000000..6d972ef
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/package_task.js
@@ -0,0 +1,365 @@
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var path = require('path')
+ , fs = require('fs')
+ , exec = require('child_process').exec
+ , FileList = require('./file_list').FileList;
+
+/**
+ @name jake
+ @namespace jake
+*/
+/**
+ @name jake.PackageTask
+ @constructor
+ @description Instantiating a PackageTask creates a number of Jake
+ Tasks that make packaging and distributing your software easy.
+
+ @param {String} name The name of the project
+ @param {String} version The current project version (will be
+ appended to the project-name in the package-archive
+ @param {Function} definition Defines the contents of the package,
+ and format of the package-archive. Will be executed on the instantiated
+ PackageTask (i.e., 'this', will be the PackageTask instance),
+ to set the various instance-propertiess.
+
+ @example
+ var t = new jake.PackageTask('rous', 'v' + version, function () {
+ var files = [
+ 'Capfile'
+ , 'Jakefile'
+ , 'README.md'
+ , 'package.json'
+ , 'app/*'
+ , 'bin/*'
+ , 'config/*'
+ , 'lib/*'
+ , 'node_modules/*'
+ ];
+ this.packageFiles.include(files);
+ this.packageFiles.exclude('node_modules/foobar');
+ this.needTarGz = true;
+ });
+
+ */
+var PackageTask = function (name, version, definition) {
+ /**
+ @name jake.PackageTask#name
+ @public
+ @type {String}
+ @description The name of the project
+ */
+ this.name = name;
+ /**
+ @name jake.PackageTask#version
+ @public
+ @type {String}
+ @description The project version-string
+ */
+ this.version = version;
+ /**
+ @name jake.PackageTask#version
+ @public
+ @type {String='pkg'}
+ @description The directory-name to use for packaging the software
+ */
+ this.packageDir = 'pkg';
+ /**
+ @name jake.PackageTask#packageFiles
+ @public
+ @type {jake.FileList}
+ @description The list of files and directories to include in the
+ package-archive
+ */
+ this.packageFiles = new FileList();
+ /**
+ @name jake.PackageTask#needTar
+ @public
+ @type {Boolean=false}
+ @description If set to true, uses the `tar` utility to create
+ a gzip .tgz archive of the pagckage
+ */
+ this.needTar = false;
+ /**
+ @name jake.PackageTask#needTar
+ @public
+ @type {Boolean=false}
+ @description If set to true, uses the `tar` utility to create
+ a gzip .tar.gz archive of the pagckage
+ */
+ this.needTarGz = false;
+ /**
+ @name jake.PackageTask#needTarBz2
+ @public
+ @type {Boolean=false}
+ @description If set to true, uses the `tar` utility to create
+ a bzip2 .bz2 archive of the pagckage
+ */
+ this.needTarBz2 = false;
+ /**
+ @name jake.PackageTask#needJar
+ @public
+ @type {Boolean=false}
+ @description If set to true, uses the `jar` utility to create
+ a .jar archive of the pagckage
+ */
+ this.needJar = false;
+ /**
+ @name jake.PackageTask#needZip
+ @public
+ @type {Boolean=false}
+ @description If set to true, uses the `zip` utility to create
+ a .zip archive of the pagckage
+ */
+ this.needZip = false;
+ /**
+ @name jake.PackageTask#manifestFile
+ @public
+ @type {String=null}
+ @description Can be set to point the `jar` utility at a manifest
+ file to use in a .jar archive. If unset, one will be automatically
+ created by the `jar` utility. This path should be relative to the
+ root of the package directory (this.packageDir above, likely 'pkg')
+ */
+ this.manifestFile = null;
+ /**
+ @name jake.PackageTask#tarCommand
+ @public
+ @type {String='tar'}
+ @description The shell-command to use for creating tar archives.
+ */
+ this.tarCommand = 'tar';
+ /**
+ @name jake.PackageTask#jarCommand
+ @public
+ @type {String='jar'}
+ @description The shell-command to use for creating jar archives.
+ */
+ this.jarCommand = 'jar';
+ /**
+ @name jake.PackageTask#zipCommand
+ @public
+ @type {String='zip'}
+ @description The shell-command to use for creating zip archives.
+ */
+ this.zipCommand = 'zip';
+ /**
+ @name jake.PackageTask#archiveChangeDir
+ @public
+ @type {String=null}
+ @description Equivalent to the '-C' command for the `tar` and `jar`
+ commands. ("Change to this directory before adding files.")
+ */
+ this.archiveChangeDir = null;
+ /**
+ @name jake.PackageTask#archiveContentDir
+ @public
+ @type {String=null}
+ @description Specifies the files and directories to include in the
+ package-archive. If unset, this will default to the main package
+ directory -- i.e., name + version.
+ */
+ this.archiveContentDir = null;
+
+ if (typeof definition == 'function') {
+ definition.call(this);
+ }
+ this.define();
+};
+
+PackageTask.prototype = new (function () {
+
+ var _compressOpts = {
+ Tar: {
+ ext: '.tgz'
+ , flags: 'cvzf'
+ , cmd: 'tar'
+ }
+ , TarGz: {
+ ext: '.tar.gz'
+ , flags: 'cvzf'
+ , cmd: 'tar'
+ }
+ , TarBz2: {
+ ext: '.tar.bz2'
+ , flags: 'cvjf'
+ , cmd: 'tar'
+ }
+ , Jar: {
+ ext: '.jar'
+ , flags: 'cf'
+ , cmd: 'jar'
+ }
+ , Zip: {
+ ext: '.zip'
+ , flags: 'r'
+ , cmd: 'zip'
+ }
+ };
+
+ this.define = function () {
+ var self = this
+ , packageDirPath = this.packageDirPath()
+ , compressTaskArr = [];
+
+ desc('Build the package for distribution');
+ task('package', ['clobberPackage', 'buildPackage']);
+ // Backward-compat alias
+ task('repackage', ['package']);
+
+ task('clobberPackage', function () {
+ jake.rmRf(self.packageDir, {silent: true});
+ });
+
+ desc('Remove the package');
+ task('clobber', ['clobberPackage']);
+
+ for (var p in _compressOpts) {
+ if (this['need' + p]) {
+ (function (p) {
+ var filename = path.resolve(self.packageDir + '/' + self.packageName() +
+ _compressOpts[p].ext);
+ compressTaskArr.push(filename);
+
+ file(filename, [packageDirPath], function () {
+ var cmd
+ , opts = _compressOpts[p]
+ // Directory to move to when doing the compression-task
+ // Changes in the case of zip for emulating -C option
+ , chdir = self.packageDir
+ // Save the current dir so it's possible to pop back up
+ // after compressing
+ , currDir = process.cwd();
+
+ cmd = self[opts.cmd + 'Command'];
+ cmd += ' -' + opts.flags;
+ if (opts.cmd == 'jar' && self.manifestFile) {
+ cmd += 'm';
+ }
+
+ // The name of the archive to create -- use full path
+ // so compression can be performed from a different dir
+ // if needed
+ cmd += ' ' + filename;
+
+ if (opts.cmd == 'jar' && self.manifestFile) {
+ cmd += ' ' + self.manifestFile;
+ }
+
+ // Where to perform the compression -- -C option isn't
+ // supported in zip, so actually do process.chdir for this
+ if (self.archiveChangeDir) {
+ if (opts.cmd == 'zip') {
+ chdir = path.join(chdir, self.archiveChangeDir);
+ }
+ else {
+ cmd += ' -C ' + self.archiveChangeDir;
+ }
+ }
+
+ // Where to stick the archive
+ if (self.archiveContentDir) {
+ cmd += ' ' + self.archiveContentDir;
+ }
+ else {
+ cmd += ' ' + self.packageName();
+ }
+
+ // Move into the desired dir (usually packageDir) to compress
+ // Return back up to the current dir after the exec
+ process.chdir(chdir);
+
+ exec(cmd, function (err, stdout, stderr) {
+ if (err) { throw err; }
+
+ // Return back up to the starting directory (see above,
+ // before exec)
+ process.chdir(currDir);
+
+ complete();
+ });
+ }, {async: true});
+ })(p);
+ }
+ }
+
+ task('buildPackage', compressTaskArr, function () {});
+
+ directory(this.packageDir);
+
+ file(packageDirPath,
+ FileList.clone(this.packageFiles).include(this.packageDir), function () {
+ var fileList = [];
+ self.packageFiles.forEach(function (name) {
+ var f = path.join(self.packageDirPath(), name)
+ , fDir = path.dirname(f)
+ , stats;
+ jake.mkdirP(fDir, {silent: true});
+
+ // Add both files and directories
+ fileList.push({
+ from: name
+ , to: f
+ });
+ });
+ var _copyFile = function () {
+ var cmd
+ , file = fileList.pop()
+ , stat;
+ if (file) {
+ stat = fs.statSync(file.from);
+ // Target is a directory, just create it
+ if (stat.isDirectory()) {
+ jake.mkdirP(file.to, {silent: true});
+ _copyFile();
+ }
+ // Otherwise copy the file
+ else {
+ jake.cpR(file.from, file.to, {silent: true});
+ _copyFile();
+ }
+ }
+ else {
+ complete();
+ }
+ };
+ _copyFile();
+ }, {async: true});
+
+
+ };
+
+ this.packageName = function () {
+ if (this.version) {
+ return this.name + '-' + this.version;
+ }
+ else {
+ return this.name;
+ }
+ };
+
+ this.packageDirPath = function () {
+ return this.packageDir + '/' + this.packageName();
+ };
+
+})();
+
+jake.PackageTask = PackageTask;
+exports.PackageTask = PackageTask;
+
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/parseargs.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/parseargs.js b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/parseargs.js
new file mode 100644
index 0000000..dd2495b
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/parseargs.js
@@ -0,0 +1,134 @@
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var parseargs = {};
+
+/**
+ * @constructor
+ * Parses a list of command-line args into a key/value object of
+ * options and an array of positional commands.
+ * @ param {Array} opts A list of options in the following format:
+ * [{full: 'foo', abbr: 'f'}, {full: 'bar', abbr: 'b'}]]
+ */
+parseargs.Parser = function (opts) {
+ // A key/value object of matching options parsed out of the args
+ this.opts = {};
+ this.taskNames = null;
+ this.envVars = null;
+
+ // Data structures used for parsing
+ this.reg = [];
+ this.shortOpts = {};
+ this.longOpts = {};
+
+ var item;
+ for (var i = 0, ii = opts.length; i < ii; i++) {
+ item = opts[i];
+ this.shortOpts[item.abbr] = item;
+ this.longOpts[item.full] = item;
+ }
+ this.reg = opts;
+};
+
+parseargs.Parser.prototype = new function () {
+
+ var _trueOrNextVal = function (argParts, args) {
+ if (argParts[1]) {
+ return argParts[1];
+ }
+ else {
+ return (!args[0] || (args[0].indexOf('-') == 0)) ?
+ true : args.shift();
+ }
+ };
+
+ /**
+ * Parses an array of arguments into options and positional commands
+ * @param {Array} args The command-line args to parse
+ */
+ this.parse = function (args) {
+ var cmds = []
+ , cmd
+ , envVars = {}
+ , opts = {}
+ , arg
+ , argItem
+ , argParts
+ , cmdItems
+ , taskNames = []
+ , preempt;
+
+ while (args.length) {
+ arg = args.shift();
+
+ if (arg.indexOf('-') == 0) {
+ arg = arg.replace(/^--/, '').replace(/^-/, '');
+ argParts = arg.split('=');
+ argItem = this.longOpts[argParts[0]] || this.shortOpts[argParts[0]];
+ if (argItem) {
+ // First-encountered preemptive opt takes precedence -- no further opts
+ // or possibility of ambiguity, so just look for a value, or set to
+ // true and then bail
+ if (argItem.preempts) {
+ opts[argItem.full] = _trueOrNextVal(argParts, args);
+ preempt = true;
+ break;
+ }
+ // If the opt requires a value, see if we can get a value from the
+ // next arg, or infer true from no-arg -- if it's followed by another
+ // opt, throw an error
+ if (argItem.expectValue) {
+ opts[argItem.full] = _trueOrNextVal(argParts, args);
+ if (!opts[argItem.full]) {
+ throw new Error(argItem.full + ' option expects a value.');
+ }
+ }
+ else {
+ opts[argItem.full] = true;
+ }
+ }
+ }
+ else {
+ cmds.unshift(arg);
+ }
+ }
+
+ if (!preempt) {
+ // Parse out any env-vars and task-name
+ while (!!(cmd = cmds.pop())) {
+ cmdItems = cmd.split('=');
+ if (cmdItems.length > 1) {
+ envVars[cmdItems[0]] = cmdItems[1];
+ }
+ else {
+ taskNames.push(cmd);
+ }
+ }
+
+ }
+
+ return {
+ opts: opts
+ , envVars: envVars
+ , taskNames: taskNames
+ };
+ };
+
+};
+
+module.exports = parseargs;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/program.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/program.js b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/program.js
new file mode 100644
index 0000000..b64b7b9
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/node_modules/jake/lib/program.js
@@ -0,0 +1,235 @@
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var fs = require('fs')
+ , parseargs = require('./parseargs')
+ , utils = require('./utils')
+ , Program
+ , optsReg
+ , preempts
+ , usage
+ , die;
+
+optsReg = [
+ { full: 'jakefile'
+ , abbr: 'f'
+ , preempts: false
+ , expectValue: true
+ }
+, { full: 'quiet'
+ , abbr: 'q'
+ , preempts: false
+ , expectValue: false
+ }
+, { full: 'directory'
+ , abbr: 'C'
+ , preempts: false
+ , expectValue: true
+ }
+, { full: 'always-make'
+ , abbr: 'B'
+ , preempts: false
+ , expectValue: false
+ }
+, { full: 'tasks'
+ , abbr: 'T'
+ , preempts: true
+ }
+// Alias ls
+, { full: 'tasks'
+ , abbr: 'ls'
+ , preempts: true
+ }
+, { full: 'trace'
+ , abbr: 't'
+ , preempts: false
+ , expectValue: false
+ }
+, { full: 'help'
+ , abbr: 'h'
+ , preempts: true
+ }
+, { full: 'version'
+ , abbr: 'V'
+ , preempts: true
+ }
+ // Alias lowercase v
+, { full: 'version'
+ , abbr: 'v'
+ , preempts: true
+ }
+, { full: 'jakelibdir'
+ , abbr: 'J'
+ , preempts: false
+ , expectValue: true
+ }
+];
+
+preempts = {
+ version: function () {
+ die(jake.version);
+ }
+, help: function () {
+ die(usage);
+ }
+};
+
+usage = ''
+ + 'Jake JavaScript build tool\n'
+ + '********************************************************************************\n'
+ + 'If no flags are given, Jake looks for a Jakefile or Jakefile.js in the current directory.\n'
+ + '********************************************************************************\n'
+ + '{Usage}: jake [options ...] [env variables ...] target\n'
+ + '\n'
+ + '{Options}:\n'
+ + ' -f, --jakefile FILE Use FILE as the Jakefile.\n'
+ + ' -C, --directory DIRECTORY Change to DIRECTORY before running tasks.\n'
+ + ' -q, --quiet Do not log messages to standard output.\n'
+ + ' -B, --always-make Unconditionally make all targets.\n'
+ + ' -T/ls, --tasks Display the tasks (matching optional PATTERN) with descriptions, then exit.\n'
+ + ' -J, --jakelibdir JAKELIBDIR Auto-import any .jake files in JAKELIBDIR. (default is \'jakelib\')\n'
+ + ' -t, --trace Enable full backtrace.\n'
+ + ' -h, --help Display this help message.\n'
+ + ' -V/v, --version Display the Jake version.\n'
+ + '';
+
+Program = function () {
+ this.opts = {};
+ this.taskNames = null;
+ this.taskArgs = null;
+ this.envVars = null;
+};
+
+Program.prototype = new (function () {
+
+ this.handleErr = function (err) {
+ var msg;
+ utils.logger.error('jake aborted.');
+ if (this.opts.trace && err.stack) {
+ utils.logger.error(err.stack);
+ }
+ else {
+ if (err.stack) {
+ msg = err.stack.split('\n').slice(0, 2).join('\n');
+ utils.logger.error(msg);
+ utils.logger.error('(See full trace by running task with --trace)');
+ }
+ else {
+ utils.logger.error(err.message);
+ }
+ }
+ process.exit(jake.errorCode || 1);
+ };
+
+ this.parseArgs = function (args) {
+ var result = (new parseargs.Parser(optsReg)).parse(args);
+ this.setOpts(result.opts);
+ this.setTaskNames(result.taskNames);
+ this.setEnvVars(result.envVars);
+ };
+
+ this.setOpts = function (options) {
+ var opts = options || {};
+ utils.mixin(this.opts, opts);
+ };
+
+ this.setTaskNames = function (names) {
+ if (names && !Array.isArray(names)) {
+ throw new Error('Task names must be an array');
+ }
+ this.taskNames = (names && names.length) ? names : ['default'];
+ };
+
+ this.setEnvVars = function (vars) {
+ this.envVars = vars || null;
+ };
+
+ this.firstPreemptiveOption = function () {
+ var opts = this.opts;
+ for (var p in opts) {
+ if (preempts[p]) {
+ return preempts[p];
+ }
+ }
+ return false;
+ };
+
+ this.init = function (configuration) {
+ var self = this
+ , config = configuration || {};
+ if (config.options) {
+ this.setOpts(config.options);
+ }
+ if (config.taskNames) {
+ this.setTaskNames(config.taskNames);
+ }
+ if (config.envVars) {
+ this.setEnvVars(config.envVars);
+ }
+ process.addListener('uncaughtException', function (err) {
+ self.handleErr(err);
+ });
+ if (this.envVars) {
+ utils.mixin(process.env, this.envVars);
+ }
+ };
+
+ this.run = function () {
+ var taskNames
+ , dirname
+ , opts = this.opts;
+
+ // Run with `jake -T`, just show descriptions
+ if (opts.tasks) {
+ return jake.showAllTaskDescriptions(opts.tasks);
+ }
+
+ taskNames = this.taskNames;
+ if (!(Array.isArray(taskNames) && taskNames.length)) {
+ throw new Error('Please pass jake.runTasks an array of task-names');
+ }
+
+ // Set working dir
+ dirname = opts.directory;
+ if (dirname) {
+ if (utils.file.existsSync(dirname) &&
+ fs.statSync(dirname).isDirectory()) {
+ process.chdir(dirname);
+ }
+ else {
+ throw new Error(dirname + ' is not a valid directory path');
+ }
+ }
+
+ task('__root__', taskNames, function () {});
+
+ rootTask = jake.Task['__root__'];
+ rootTask.once('complete', function () {
+ jake.emit('complete');
+ });
+ rootTask.invoke();
+ };
+
+})();
+
+die = function (msg) {
+ console.log(msg);
+ process.exit();
+};
+
+module.exports.Program = Program;