You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/06/13 19:09:08 UTC
[16/19] [CB-606] Added create script for unix and windows
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/node_modules/nodeunit/test/test-runfiles.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/nodeunit/test/test-runfiles.js b/bin/node_modules/nodeunit/test/test-runfiles.js
new file mode 100644
index 0000000..9cbf519
--- /dev/null
+++ b/bin/node_modules/nodeunit/test/test-runfiles.js
@@ -0,0 +1,213 @@
+var assert = require('assert'),
+ fs = require('fs'),
+ path = require('path'),
+ nodeunit = require('../lib/nodeunit');
+
+
+var setup = function (fn) {
+ return function (test) {
+ process.chdir(__dirname);
+ require.paths.push(__dirname);
+ var env = {
+ mock_module1: require('./fixtures/mock_module1'),
+ mock_module2: require('./fixtures/mock_module2'),
+ mock_module3: require('./fixtures/dir/mock_module3'),
+ mock_module4: require('./fixtures/dir/mock_module4')
+ };
+ fn.call(env, test);
+ };
+};
+
+
+exports.testRunFiles = setup(function (test) {
+ test.expect(24);
+ var runModule_copy = nodeunit.runModule;
+
+ var runModule_calls = [];
+ var modules = [];
+
+ var opts = {
+ moduleStart: function () {
+ return 'moduleStart';
+ },
+ testDone: function () {
+ return 'testDone';
+ },
+ testStart: function () {
+ return 'testStart';
+ },
+ log: function () {
+ return 'log';
+ },
+ done: function (assertions) {
+ test.equals(assertions.failures(), 0, 'failures');
+ test.equals(assertions.length, 4, 'length');
+ test.ok(typeof assertions.duration === "number");
+
+ var called_with = function (name) {
+ return runModule_calls.some(function (m) {
+ return m.name === name;
+ });
+ };
+ test.ok(called_with('mock_module1'), 'mock_module1 ran');
+ test.ok(called_with('mock_module2'), 'mock_module2 ran');
+ test.ok(called_with('mock_module3'), 'mock_module3 ran');
+ test.ok(called_with('mock_module4'), 'mock_module4 ran');
+ test.equals(runModule_calls.length, 4);
+
+ nodeunit.runModule = runModule_copy;
+ test.done();
+ }
+ };
+
+ nodeunit.runModule = function (name, mod, options, callback) {
+ test.equals(options.testDone, opts.testDone);
+ test.equals(options.testStart, opts.testStart);
+ test.equals(options.log, opts.log);
+ test.ok(typeof name === "string");
+ runModule_calls.push(mod);
+ var m = [{failed: function () {
+ return false;
+ }}];
+ modules.push(m);
+ callback(null, m);
+ };
+
+ nodeunit.runFiles(
+ ['fixtures/mock_module1.js', 'fixtures/mock_module2.js', 'fixtures/dir'],
+ opts
+ );
+});
+
+exports.testRunFilesEmpty = function (test) {
+ test.expect(3);
+ nodeunit.runFiles([], {
+ moduleStart: function () {
+ test.ok(false, 'should not be called');
+ },
+ testDone: function () {
+ test.ok(false, 'should not be called');
+ },
+ testStart: function () {
+ test.ok(false, 'should not be called');
+ },
+ log: function () {
+ test.ok(false, 'should not be called');
+ },
+ done: function (assertions) {
+ test.equals(assertions.failures(), 0, 'failures');
+ test.equals(assertions.length, 0, 'length');
+ test.ok(typeof assertions.duration === "number");
+ test.done();
+ }
+ });
+};
+
+
+exports.testEmptyDir = function (test) {
+ var dir2 = __dirname + '/fixtures/dir2';
+
+ // git doesn't like empty directories, so we have to create one
+ path.exists(dir2, function (exists) {
+ if (!exists) {
+ fs.mkdirSync(dir2, 0777);
+ }
+
+ // runFiles on empty directory:
+ nodeunit.runFiles([dir2], {
+ moduleStart: function () {
+ test.ok(false, 'should not be called');
+ },
+ testDone: function () {
+ test.ok(false, 'should not be called');
+ },
+ testStart: function () {
+ test.ok(false, 'should not be called');
+ },
+ log: function () {
+ test.ok(false, 'should not be called');
+ },
+ done: function (assertions) {
+ test.equals(assertions.failures(), 0, 'failures');
+ test.equals(assertions.length, 0, 'length');
+ test.ok(typeof assertions.duration === "number");
+ test.done();
+ }
+ });
+ });
+};
+
+
+var CoffeeScript;
+try {
+ CoffeeScript = require('coffee-script');
+} catch (e) {
+}
+
+if (CoffeeScript) {
+ exports.testCoffeeScript = function (test) {
+ process.chdir(__dirname);
+ require.paths.push(__dirname);
+ var env = {
+ mock_coffee_module: require('./fixtures/coffee/mock_coffee_module')
+ };
+
+ test.expect(9);
+ var runModule_copy = nodeunit.runModule;
+
+ var runModule_calls = [];
+ var modules = [];
+
+ var opts = {
+ moduleStart: function () {
+ return 'moduleStart';
+ },
+ testDone: function () {
+ return 'testDone';
+ },
+ testStart: function () {
+ return 'testStart';
+ },
+ log: function () {
+ return 'log';
+ },
+ done: function (assertions) {
+ test.equals(assertions.failures(), 0, 'failures');
+ test.equals(assertions.length, 1, 'length');
+ test.ok(typeof assertions.duration === "number");
+
+ var called_with = function (name) {
+ return runModule_calls.some(function (m) {
+ return m.name === name;
+ });
+ };
+ test.ok(
+ called_with('mock_coffee_15'),
+ 'mock_coffee_module ran'
+ );
+ test.equals(runModule_calls.length, 1);
+
+ nodeunit.runModule = runModule_copy;
+ test.done();
+ }
+ };
+
+ nodeunit.runModule = function (name, mod, options, callback) {
+ test.equals(options.testDone, opts.testDone);
+ test.equals(options.testStart, opts.testStart);
+ test.equals(options.log, opts.log);
+ test.ok(typeof name === "string");
+ runModule_calls.push(mod);
+ var m = [{failed: function () {
+ return false;
+ }}];
+ modules.push(m);
+ callback(null, m);
+ };
+
+ nodeunit.runFiles(
+ ['fixtures/coffee/mock_coffee_module.coffee'],
+ opts
+ );
+ };
+}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/node_modules/nodeunit/test/test-runmodule.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/nodeunit/test/test-runmodule.js b/bin/node_modules/nodeunit/test/test-runmodule.js
new file mode 100644
index 0000000..d07b47c
--- /dev/null
+++ b/bin/node_modules/nodeunit/test/test-runmodule.js
@@ -0,0 +1,177 @@
+/* THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
+ * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build.
+ * Only code on that line will be removed, its mostly to avoid requiring code
+ * that is node specific
+ */
+
+var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER
+
+
+exports.testRunModule = function (test) {
+ test.expect(11);
+ var call_order = [];
+ var testmodule = {
+ test1: function (test) {
+ call_order.push('test1');
+ test.ok(true, 'ok true');
+ test.done();
+ },
+ test2: function (test) {
+ call_order.push('test2');
+ test.ok(false, 'ok false');
+ test.ok(false, 'ok false');
+ test.done();
+ },
+ test3: function (test) {
+ call_order.push('test3');
+ test.done();
+ }
+ };
+ nodeunit.runModule('testmodule', testmodule, {
+ log: function (assertion) {
+ call_order.push('log');
+ },
+ testStart: function (name) {
+ call_order.push('testStart');
+ test.ok(
+ name.toString() === 'test1' ||
+ name.toString() === 'test2' ||
+ name.toString() === 'test3',
+ 'testStart called with test name '
+ );
+ },
+ testDone: function (name, assertions) {
+ call_order.push('testDone');
+ test.ok(
+ name.toString() === 'test1' ||
+ name.toString() === 'test2' ||
+ name.toString() === 'test3',
+ 'testDone called with test name'
+ );
+ },
+ moduleDone: function (name, assertions) {
+ call_order.push('moduleDone');
+ test.equals(assertions.length, 3);
+ test.equals(assertions.failures(), 2);
+ test.equals(name, 'testmodule');
+ test.ok(typeof assertions.duration === "number");
+ test.same(call_order, [
+ 'testStart', 'test1', 'log', 'testDone',
+ 'testStart', 'test2', 'log', 'log', 'testDone',
+ 'testStart', 'test3', 'testDone',
+ 'moduleDone'
+ ]);
+ }
+ }, test.done);
+};
+
+
+exports.testRunModuleTestSpec = function (test) {
+ test.expect(6);
+ var call_order = [];
+ var testmodule = {
+ test1: function (test) {
+ test.ok(true, 'ok true');
+ test.done();
+ },
+ test2: function (test) {
+ call_order.push('test2');
+ test.ok(false, 'ok false');
+ test.ok(false, 'ok false');
+ test.done();
+ },
+ test3: function (test) {
+ test.done();
+ }
+ };
+ nodeunit.runModule('testmodule', testmodule, {
+ testspec: "test2",
+ log: function (assertion) {
+ call_order.push('log');
+ },
+ testStart: function (name) {
+ call_order.push('testStart');
+ test.ok(
+ name.toString() === 'test2',
+ 'testStart called with test name '
+ );
+ },
+ testDone: function (name, assertions) {
+ call_order.push('testDone');
+ test.ok(
+ name.toString() === 'test2',
+ 'testDone called with test name'
+ );
+ },
+ moduleDone: function (name, assertions) {
+ call_order.push('moduleDone');
+ test.equals(assertions.length, 2);
+ test.equals(name, 'testmodule');
+ test.ok(typeof assertions.duration === "number");
+ test.same(call_order, [
+ 'testStart', 'test2', 'log', 'log', 'testDone',
+ 'moduleDone'
+ ]);
+ }
+ }, test.done);
+};
+
+exports.testRunModuleEmpty = function (test) {
+ nodeunit.runModule('module with no exports', {}, {
+ log: function (assertion) {
+ test.ok(false, 'log should not be called');
+ },
+ testStart: function (name) {
+ test.ok(false, 'testStart should not be called');
+ },
+ testDone: function (name, assertions) {
+ test.ok(false, 'testDone should not be called');
+ },
+ moduleDone: function (name, assertions) {
+ test.equals(assertions.length, 0);
+ test.equals(assertions.failures(), 0);
+ test.equals(name, 'module with no exports');
+ test.ok(typeof assertions.duration === "number");
+ }
+ }, test.done);
+};
+
+
+exports.testNestedTests = function (test) {
+ var call_order = [];
+ var m = {
+ test1: function (test) {
+ test.done();
+ },
+ suite: {
+ t1: function (test) {
+ test.done();
+ },
+ t2: function (test) {
+ test.done();
+ },
+ another_suite: {
+ t3: function (test) {
+ test.done();
+ }
+ }
+ }
+ };
+ nodeunit.runModule('modulename', m, {
+ testStart: function (name) {
+ call_order.push(['testStart'].concat(name));
+ },
+ testDone: function (name, assertions) {
+ call_order.push(['testDone'].concat(name));
+ }
+ }, function () {
+ test.same(call_order, [
+ ['testStart', 'test1'], ['testDone', 'test1'],
+ ['testStart', 'suite', 't1'], ['testDone', 'suite', 't1'],
+ ['testStart', 'suite', 't2'], ['testDone', 'suite', 't2'],
+ ['testStart', 'suite', 'another_suite', 't3'],
+ ['testDone', 'suite', 'another_suite', 't3']
+ ]);
+ test.done();
+ });
+};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/node_modules/nodeunit/test/test-runtest.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/nodeunit/test/test-runtest.js b/bin/node_modules/nodeunit/test/test-runtest.js
new file mode 100644
index 0000000..8fc3d52
--- /dev/null
+++ b/bin/node_modules/nodeunit/test/test-runtest.js
@@ -0,0 +1,46 @@
+/* THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
+ * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build.
+ * Only code on that line will be removed, its mostly to avoid requiring code
+ * that is node specific
+ */
+
+var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER
+
+
+exports.testArgs = function (test) {
+ test.ok(test.expect instanceof Function, 'test.expect');
+ test.ok(test.done instanceof Function, 'test.done');
+ test.ok(test.ok instanceof Function, 'test.ok');
+ test.ok(test.same instanceof Function, 'test.same');
+ test.ok(test.equals instanceof Function, 'test.equals');
+ test.done();
+};
+
+exports.testDoneCallback = function (test) {
+ test.expect(4);
+ nodeunit.runTest('testname', exports.testArgs, {
+ testDone: function (name, assertions) {
+ test.equals(assertions.failures(), 0, 'failures');
+ test.equals(assertions.length, 5, 'length');
+ test.ok(typeof assertions.duration === "number");
+ test.equals(name, 'testname');
+ }
+ }, test.done);
+};
+
+exports.testThrowError = function (test) {
+ test.expect(3);
+ var err = new Error('test');
+ var testfn = function (test) {
+ throw err;
+ };
+ nodeunit.runTest('testname', testfn, {
+ log: function (assertion) {
+ test.same(assertion.error, err, 'assertion.error');
+ },
+ testDone: function (name, assertions) {
+ test.equals(assertions.failures(), 1);
+ test.equals(assertions.length, 1);
+ }
+ }, test.done);
+};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/node_modules/nodeunit/test/test-sandbox.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/nodeunit/test/test-sandbox.js b/bin/node_modules/nodeunit/test/test-sandbox.js
new file mode 100644
index 0000000..1b249d7
--- /dev/null
+++ b/bin/node_modules/nodeunit/test/test-sandbox.js
@@ -0,0 +1,31 @@
+var nodeunit = require('../lib/nodeunit');
+var sandbox = require('../lib/utils').sandbox;
+var testCase = nodeunit.testCase;
+
+exports.testSimpleSandbox = function (test) {
+ var raw_jscode1 = sandbox(__dirname + '/fixtures/raw_jscode1.js');
+ test.equal(raw_jscode1.hello_world('foo'), '_foo_', 'evaluation ok');
+ test.done();
+};
+
+exports.testSandboxContext = function (test) {
+ var a_variable = 42; // should not be visible in the sandbox
+ var raw_jscode2 = sandbox(__dirname + '/fixtures/raw_jscode2.js');
+ a_variable = 42; // again for the win
+ test.equal(
+ raw_jscode2.get_a_variable(),
+ 'undefined',
+ 'the variable should not be defined'
+ );
+ test.done();
+};
+
+exports.testSandboxMultiple = function (test) {
+ var raw_jscode3 = sandbox([
+ __dirname + '/fixtures/raw_jscode3.js',
+ __dirname + '/fixtures/raw_jscode3.js',
+ __dirname + '/fixtures/raw_jscode3.js'
+ ]);
+ test.equal(raw_jscode3.t, 3, 'two files loaded');
+ test.done();
+};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/node_modules/nodeunit/test/test-testcase.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/nodeunit/test/test-testcase.js b/bin/node_modules/nodeunit/test/test-testcase.js
new file mode 100644
index 0000000..a3ea331
--- /dev/null
+++ b/bin/node_modules/nodeunit/test/test-testcase.js
@@ -0,0 +1,234 @@
+/* THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
+ * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build.
+ * Only code on that line will be removed, its mostly to avoid requiring code
+ * that is node specific
+ */
+
+var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER
+var testCase = nodeunit.testCase;
+
+exports.testTestCase = function (test) {
+ test.expect(7);
+ var call_order = [];
+ var s = testCase({
+ setUp: function (callback) {
+ call_order.push('setUp');
+ test.equals(this.one, undefined);
+ this.one = 1;
+ callback();
+ },
+ tearDown: function (callback) {
+ call_order.push('tearDown');
+ test.ok(true, 'tearDown called');
+ callback();
+ },
+ test1: function (t) {
+ call_order.push('test1');
+ test.equals(this.one, 1);
+ this.one = 2;
+ t.done();
+ },
+ test2: function (t) {
+ call_order.push('test2');
+ test.equals(this.one, 1);
+ t.done();
+ }
+ });
+ nodeunit.runSuite(null, s, {}, function () {
+ test.same(call_order, [
+ 'setUp', 'test1', 'tearDown',
+ 'setUp', 'test2', 'tearDown'
+ ]);
+ test.done();
+ });
+};
+
+exports.tearDownAfterError = function (test) {
+ test.expect(1);
+ var s = testCase({
+ tearDown: function (callback) {
+ test.ok(true, 'tearDown called');
+ callback();
+ },
+ test: function (t) {
+ throw new Error('some error');
+ }
+ });
+ nodeunit.runSuite(null, s, {}, function () {
+ test.done();
+ });
+};
+
+exports.catchSetUpError = function (test) {
+ test.expect(2);
+ var test_error = new Error('test error');
+ var s = testCase({
+ setUp: function (callback) {
+ throw test_error;
+ },
+ test: function (t) {
+ test.ok(false, 'test function should not be called');
+ t.done();
+ }
+ });
+ nodeunit.runSuite(null, s, {}, function (err, assertions) {
+ test.equal(assertions.length, 1);
+ test.equal(assertions[0].error, test_error);
+ test.done();
+ });
+};
+
+exports.setUpErrorCallback = function (test) {
+ test.expect(2);
+ var test_error = new Error('test error');
+ var s = testCase({
+ setUp: function (callback) {
+ callback(test_error);
+ },
+ test: function (t) {
+ test.ok(false, 'test function should not be called');
+ t.done();
+ }
+ });
+ nodeunit.runSuite(null, s, {}, function (err, assertions) {
+ test.equal(assertions.length, 1);
+ test.equal(assertions[0].error, test_error);
+ test.done();
+ });
+};
+
+exports.catchTearDownError = function (test) {
+ test.expect(2);
+ var test_error = new Error('test error');
+ var s = testCase({
+ tearDown: function (callback) {
+ throw test_error;
+ },
+ test: function (t) {
+ t.done();
+ }
+ });
+ nodeunit.runSuite(null, s, {}, function (err, assertions) {
+ test.equal(assertions.length, 1);
+ test.equal(assertions[0].error, test_error);
+ test.done();
+ });
+};
+
+exports.tearDownErrorCallback = function (test) {
+ test.expect(2);
+ var test_error = new Error('test error');
+ var s = testCase({
+ tearDown: function (callback) {
+ callback(test_error);
+ },
+ test: function (t) {
+ t.done();
+ }
+ });
+ nodeunit.runSuite(null, s, {}, function (err, assertions) {
+ test.equal(assertions.length, 1);
+ test.equal(assertions[0].error, test_error);
+ test.done();
+ });
+};
+
+exports.testErrorAndtearDownError = function (test) {
+ test.expect(3);
+ var error1 = new Error('test error one');
+ var error2 = new Error('test error two');
+ var s = testCase({
+ tearDown: function (callback) {
+ callback(error2);
+ },
+ test: function (t) {
+ t.done(error1);
+ }
+ });
+ nodeunit.runSuite(null, s, {}, function (err, assertions) {
+ test.equal(assertions.length, 2);
+ test.equal(assertions[0].error, error1);
+ test.equal(assertions[1].error, error2);
+ test.done();
+ });
+};
+
+exports.testCaseGroups = function (test) {
+ var call_order = [];
+ var s = testCase({
+ setUp: function (callback) {
+ call_order.push('setUp');
+ callback();
+ },
+ tearDown: function (callback) {
+ call_order.push('tearDown');
+ callback();
+ },
+ test1: function (test) {
+ call_order.push('test1');
+ test.done();
+ },
+ group1: {
+ test2: function (test) {
+ call_order.push('group1.test2');
+ test.done();
+ }
+ }
+ });
+ nodeunit.runSuite(null, s, {}, function (err, assertions) {
+ test.same(call_order, [
+ 'setUp',
+ 'test1',
+ 'tearDown',
+ 'setUp',
+ 'group1.test2',
+ 'tearDown'
+ ]);
+ test.done();
+ });
+};
+
+exports.nestedTestCases = function (test) {
+ var call_order = [];
+ var s = testCase({
+ setUp: function (callback) {
+ call_order.push('setUp');
+ callback();
+ },
+ tearDown: function (callback) {
+ call_order.push('tearDown');
+ callback();
+ },
+ test1: function (test) {
+ call_order.push('test1');
+ test.done();
+ },
+ group1: testCase({
+ setUp: function (callback) {
+ call_order.push('group1.setUp');
+ callback();
+ },
+ tearDown: function (callback) {
+ call_order.push('group1.tearDown');
+ callback();
+ },
+ test2: function (test) {
+ call_order.push('group1.test2');
+ test.done();
+ }
+ })
+ });
+ nodeunit.runSuite(null, s, {}, function (err, assertions) {
+ test.same(call_order, [
+ 'setUp',
+ 'test1',
+ 'tearDown',
+ 'setUp',
+ 'group1.setUp',
+ 'group1.test2',
+ 'group1.tearDown',
+ 'tearDown'
+ ]);
+ test.done();
+ });
+};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/node_modules/nodeunit/test/test.html
----------------------------------------------------------------------
diff --git a/bin/node_modules/nodeunit/test/test.html b/bin/node_modules/nodeunit/test/test.html
new file mode 100644
index 0000000..31bda30
--- /dev/null
+++ b/bin/node_modules/nodeunit/test/test.html
@@ -0,0 +1,26 @@
+<html>
+ <head>
+ <title>Nodeunit Test Suite</title>
+ <!--
+ Note this file is only used for 'make browser', when it is copied to
+ dist/browser/test.html for running the browser test suite
+ -->
+ <link rel="stylesheet" href="nodeunit.css" type="text/css" media="screen" />
+ <script src="nodeunit.js"></script>
+ <script src="test-base.js"></script>
+ <script src="test-runmodule.js"></script>
+ <script src="test-runtest.js"></script>
+ <script src="test-testcase.js"></script>
+ </head>
+ <body>
+ <h1 id="nodeunit-header">Nodeunit Test Suite</h1>
+ <script>
+ nodeunit.run({
+ 'test-base': test_base,
+ 'test-runmodule': test_runmodule,
+ 'test-runtest': test_runtest,
+ 'test-testcase': test_testcase
+ });
+ </script>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/package.json
----------------------------------------------------------------------
diff --git a/bin/package.json b/bin/package.json
new file mode 100644
index 0000000..df27c19
--- /dev/null
+++ b/bin/package.json
@@ -0,0 +1,26 @@
+{
+ "name": "cordova-blackberry-webworks-cli",
+ "description": "CLI tooling for the cordova-blackberry-webworks project",
+ "version": "0.0.1",
+ "licenses": [{
+ "type": "APL 2.0",
+ "url": "http://www.apache.org/licenses/LICENSE-2.0"
+ }],
+ "main" : "./create",
+ "bin": {
+ "create": "./create",
+ "bench": "./bench",
+ "autotest": "./autotest",
+ "BOOM": "./BOOM",
+ "test": "./test"
+ },
+ "homepage": "http://incubator.apache.org/cordova",
+ "repository": {
+ "type": "git",
+ "url": "http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks.git"
+ },
+ "dependencies":{
+ "coffee-script":"1.1.2",
+ "nodeunit":"0.5.3"
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/templates/dist/README.md
----------------------------------------------------------------------
diff --git a/bin/templates/dist/README.md b/bin/templates/dist/README.md
new file mode 100644
index 0000000..35a8393
--- /dev/null
+++ b/bin/templates/dist/README.md
@@ -0,0 +1,90 @@
+Cordova BlackBerry Distribution
+===============================
+
+Cordova BlackBerry is a framework that allows for Cordova based projects to be built for the [BlackBerry WebWorks Platform](https://bdsc.webapps.blackberry.com/html5/). Cordova based applications are, at the core, an application written with web technology: HTML, CSS and JavaScript. The Cordova BlackBerry project allows web developers to develop applications targeting BlackBerry OS 5.0+ and PlayBook devices using the common [Cordova API](http://docs.phonegap.com).
+
+Apache Cordova is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator project. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+Pre-requisites
+--------------
+
+- Windows XP (32-bit) or Windows 7 (32-bit and 64-bit) or Mac OSX 10.6.4+
+- Java JDK 1.5
+- Apache ANT
+- [BlackBerry WebWorks SDK](https://bdsc.webapps.blackberry.com/html5/download/sdk)
+- PlayBook development requires [Adobe Air SDK](http://www.adobe.com/devnet/air/air-sdk-download.html)
+
+Directory Structure
+-------------------
+
+ sample/ ... Ready-to-run sample project
+ www/ ...... Barebones project assets
+
+### Ready-to-Run Sample Project
+
+The quickest way to get started with Cordova BlackBerry is to make a copy of the `sample` folder. The `sample` folder is a complete Cordova BlackBerry project including build scripts. Copy the `sample` folder to a desired location to create a new Cordova BlackBerry project.
+
+#### Building and Deploying a Project
+
+The build scripts included in the `sample` folder automate common tasks, such as compiling your project, and deploying it to simulators or devices. To see what options are available, use:
+
+ $ cd C:\development\my_new_project
+ $ ant help
+
+Every command is in the form `ant TARGET COMMAND [options]`, where
+target is either `blackberry` or `playbook`.
+
+To build your project into a deployable application (.cod/.jad) file:
+
+ $ ant TARGET build
+
+To build your project and load it in a BlackBerry simulator:
+
+ $ ant TARGET load-simulator
+
+To build your project and load it onto a USB-attached device:
+
+ $ ant TARGET load-device
+
+### Barebones Project Assets
+
+The `www` folder contains the Cordova specific assets that must be available in a BlackBerry WebWorks project. If you have an existing BlackBerry WebWorks project, copy/merge these files into your project to enable the project for Cordova.
+
+ ext/cordova.jar - Native Cordova API implementations for smartphones.
+ ext-air/ - PlayBook Adobe Air extensions for Cordova API.
+ playbook/cordova.js - PlayBook Cordova JavaScript API.
+ cordova.js - Smartphone Cordova JavaScript API.
+ config.xml - BlackBerry WebWorks configuration file.
+ plugins.xml - Cordova plugin configuration file.
+
+`config.xml` is a sample that you are free to alter or merge with an existing BlackBerry WebWorks configuration file. The necessary Cordova sections are contained in the `<feature>` and `<access>` sections:
+
+ <!-- Cordova API -->
+ <feature ... />
+ <feature ... />
+
+ <!-- Cordova API -->
+ <access ... />
+ <access ... />
+
+Frequently Asked Questions
+--------------------------
+
+__Q: My simulator screen is not refreshing and I see blocks on a clicked position.__
+
+__A:__ Windows 7 and the simulator's graphics acceleration do not mix. On the simulator, set View -> Graphics Acceleration to Off.
+
+__Q: When I use the Cordova [Camera.getPicture API](http://docs.phonegap.com/phonegap_camera_camera.md.html#camera.getPicture) on my device, the camera never returns to my application. Why does this happen?__
+
+__A:__ Cordova uses a JavaScript Extension to invoke the native camera application so the user can take a picture. When the picture is taken, Cordova will close the native camera application by emulating a key injection (pressing the back/escape button). On a physical device, users will have to set permissions to allow the application to simulate key injections. Setting application permissions is device-specific. On a Storm2 (9550), for example, select the BlackBerry button from the Home screen to get to All Applications screen, then Options > Applications > Your Application. Then select Edit Default Permissions > Interactions > Input Simulation and set it to 'Allow'. Save your changes.
+
+__Q: None of the Cordova APIs are working, why is that?__
+
+__A:__ You probably need to update your plugins.xml file in the root of your application.
+
+Additional Information
+----------------------
+- [Cordova home](http://incubator.apache.org/cordova/)
+- [Cordova Documentation](http://docs.phonegap.com)
+- [Cordova Issue Tracker](https://issues.apache.org/jira/browse/CB)
+- [BlackBerry WebWorks Framework](https://bdsc.webapps.blackberry.com/html5/)
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/templates/project/blackberry.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/blackberry.xml b/bin/templates/project/blackberry.xml
new file mode 100644
index 0000000..59c0278
--- /dev/null
+++ b/bin/templates/project/blackberry.xml
@@ -0,0 +1,333 @@
+<project default="help">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+ <!-- LOAD PROPERTIES -->
+
+ <property prefix="properties" file="project.properties" />
+ <property name="build.dir" location="build" />
+ <property name="widget.dir" location="${build.dir}/widget" />
+ <property name="code.sign" value="false" />
+ <property name="generate.ext" value="cod" />
+
+ <!-- BlackBerry WebWorks Packager directory is required. -->
+ <fail unless="properties.blackberry.bbwp.dir" message="Please specify BlackBerry WebWorks Packager directory using 'blackberry.bbwp.dir' in your 'project.properties' file." />
+
+ <!-- OS identification -->
+ <condition property="isMacOSX" else="false">
+ <and>
+ <os family="mac" />
+ <os family="unix" />
+ </and>
+ </condition>
+
+ <condition property="javaloader" value="${properties.blackberry.bbwp.dir}/bin/javaloader" else="${properties.blackberry.bbwp.dir}/bin/JavaLoader.exe">
+ <equals arg1="${isMacOSX}" arg2="true" />
+ </condition>
+
+ <condition property="bbwp" value="${properties.blackberry.bbwp.dir}/bbwp" else="${properties.blackberry.bbwp.dir}/bbwp.exe">
+ <equals arg1="${isMacOSX}" arg2="true" />
+ </condition>
+
+
+ <!-- LOAD DEVICE -->
+
+ <target name="load-device" depends="package-app">
+ <bbwp code-sign="true" />
+ <exec executable="${javaloader}" dir="." failonerror="true">
+ <arg value="-u" />
+ <arg value="-w${properties.blackberry.sim.password}" />
+ <arg value="load" />
+ <arg file="${build.dir}/StandardInstall/${cod.name}.cod" />
+ </exec>
+ </target>
+
+ <!-- LOAD SIMULATOR -->
+
+ <target name="load-simulator" depends="build">
+
+ <!-- Find the simulator directory -->
+ <set-simulator-dir />
+
+ <!-- Locate BBWP simulator directory. There may be multiple, so choose the first. -->
+ <path id="bbwp.sim.path">
+ <first>
+ <fileset dir="${properties.blackberry.bbwp.dir}/simpack">
+ <include name="**/handhelds.manifest.txt" />
+ </fileset>
+ </first>
+ </path>
+ <dirname property="bbwp.sim.dir" file="${toString:bbwp.sim.path}" />
+
+ <!-- Simulator directory: Use sim.dir property if set in project.properties file.
+ Otherwise, use bbwp simulator directory. -->
+ <condition
+ property="simulator.dir"
+ value="${properties.blackberry.sim.dir}"
+ else="${bbwp.sim.dir}">
+ <available file="${properties.blackberry.sim.dir}" type="dir" />
+ </condition>
+ <echo message="Simulator directory=${simulator.dir}" />
+
+ <!-- Simulator binary: Use sim.bin property if set in project.properties file
+ or try setting to 'defaultSimulator.bat' in simulator directory. -->
+ <condition
+ property="sim.bin"
+ value="${properties.blackberry.sim.bin}"
+ else="defaultSimulator.bat">
+ <available file="${simulator.dir}/${properties.blackberry.sim.bin}"/>
+ </condition>
+
+ <!-- If simulator executable does not exist, use the first device listed
+ in the 'handhelds.manifest.txt' file in the simulator directory. -->
+ <loadfile
+ property="device.list"
+ srcFile="${simulator.dir}/handhelds.manifest.txt">
+ <filterchain>
+ <tokenFilter>
+ <stringtokenizer/>
+ </tokenFilter>
+ </filterchain>
+ </loadfile>
+
+ <propertyregex property="device"
+ input="${device.list}"
+ regexp="^\d{4}"
+ select="\0"
+ override="true" />
+ <property name="device.bin" value="${device}.bat" />
+
+ <condition
+ property="simulator.bin"
+ value="${sim.bin}"
+ else="${device.bin}">
+ <available file="${simulator.dir}/${sim.bin}" />
+ </condition>
+
+ <echo message="Simulator executable=${simulator.dir}/${simulator.bin}" />
+
+ <!-- Close running simulators -->
+ <echo message="Closing all running simulators..." />
+ <exec executable="${simulator.dir}/fledgecontroller.exe" dir="${simulator.dir}" spawn="false">
+ <arg value="/execute=kill" />
+ </exec>
+
+ <!-- MDS directory: Use mds.dir property if set in project.properties file.
+ Otherwise, use bbwp MDS directory. -->
+ <condition
+ property="mds.dir"
+ value="${properties.blackberry.mds.dir}"
+ else="${properties.blackberry.bbwp.dir}/mds">
+ <available file="${properties.blackberry.mds.dir}" type="dir" />
+ </condition>
+ <echo message="MDS directory=${mds.dir}" />
+
+ <copy todir="${simulator.dir}">
+ <fileset dir="${build.dir}/StandardInstall" includes="*.cod, *.cso, *.csl, *.alx" />
+ </copy>
+ <exec executable="${mds.dir}/run.bat" dir="${mds.dir}" spawn="true" />
+ <exec executable="${simulator.dir}/${simulator.bin}" dir="${simulator.dir}" spawn="true" />
+
+ <!-- Only invoke FledgeHook.exe if it is found. Newer versions of the
+ WebWorks SDK do not include it. -->
+ <if>
+ <available file="${properties.blackberry.bbwp.dir}/FledgeHook.exe" />
+ <then>
+ <exec executable="${properties.blackberry.bbwp.dir}/FledgeHook.exe" dir="${properties.blackberry.bbwp.dir}" spawn="true" />
+ </then>
+ </if>
+ </target>
+
+ <!-- PACKAGE-APP -->
+
+ <target name="package-app" depends="generate-cod-name, clean">
+ <!-- Copy the WebWorks application -->
+ <mkdir dir="${widget.dir}" />
+ <copy todir="${widget.dir}" overwrite="true">
+ <fileset dir="www" excludes="ext-air/**,playbook/**"/>
+ </copy>
+
+ <!-- Package the WebWorks app by zipping the widget dir. -->
+ <mkdir dir="${build.dir}" />
+ <zip compress="false" destfile="${build.dir}/${cod.name}.zip" basedir="${widget.dir}" excludes="**/build/**,**/.settings/**,**/.project" />
+ </target>
+
+ <!-- BUILD -->
+
+ <target name="build" depends="package-app">
+ <bbwp code-sign="${code.sign}" />
+ </target>
+
+ <!-- BBWP MACRO -->
+
+ <macrodef name="bbwp">
+ <attribute name="code-sign" default="false" />
+ <sequential>
+
+ <!-- Ensure bbwp executable exists. -->
+ <property name="properties.blackberry.bbwp.bin" location="${bbwp}" />
+ <available file="${properties.blackberry.bbwp.bin}" property="properties.blackberry.bbwp.exists" />
+ <fail unless="properties.blackberry.bbwp.exists" message="Cannot find ${properties.blackberry.bbwp.bin}. Please edit 'blackberry.bbwp.dir' in your 'project.properties' file." />
+
+ <if>
+ <equals arg1="@{code-sign}" arg2="true" />
+ <then>
+ <exec executable="${properties.blackberry.bbwp.bin}">
+ <arg file="${build.dir}/${cod.name}.zip" />
+ <arg value="/g" />
+ <arg value="${properties.blackberry.sigtool.password}" />
+ <arg value="/o" />
+ <arg file="${build.dir}" />
+ </exec>
+ </then>
+ <else>
+ <exec executable="${properties.blackberry.bbwp.bin}">
+ <arg file="${build.dir}/${cod.name}.zip" />
+ <arg value="/o" />
+ <arg file="${build.dir}" />
+ </exec>
+ </else>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!-- CLEAN -->
+
+ <target name="clean">
+ <delete dir="${build.dir}" />
+ <delete dir="${widget.dir}" />
+ </target>
+
+ <!-- CLEAN DEVICE -->
+
+ <target name="clean-device" depends="generate-cod-name">
+ <exec executable="${javaloader}">
+ <arg value="-usb" />
+ <arg value="erase" />
+ <arg value="-f" />
+ <arg value="${cod.name}.cod" />
+ </exec>
+ </target>
+
+ <!-- CLEAN SIMULATOR -->
+
+ <target name="clean-simulator">
+ <!-- Find the simulator directory -->
+ <set-simulator-dir />
+
+ <exec executable="${simulator.dir}/clean.bat" dir="${simulator.dir}" />
+
+ <delete>
+ <fileset dir="${simulator.dir}" includes="*.cod,*.csl,*.cso,*.debug,*.jar" />
+ </delete>
+ </target>
+
+ <!-- HELPER TASKS -->
+
+ <target name="generate-cod-name">
+ <xmlproperty file="www/config.xml" prefix="config.xml" />
+ <propertyregex property="cod.name"
+ input="${config.xml.widget.name}"
+ regexp="(\W+)"
+ replace=""
+ casesensitive="false"
+ global="true"
+ defaultValue="${config.xml.widget.name}" />
+ <echo message="Generated name: ${cod.name}.cod" />
+ </target>
+
+ <!-- MACRO: SET SIMULATOR DIRECTORY -->
+
+ <macrodef name="set-simulator-dir">
+ <sequential>
+ <!-- Locate BBWP simulator directory. There may be multiple, so choose the first. -->
+ <path id="bbwp.sim.path">
+ <first>
+ <fileset dir="${properties.blackberry.bbwp.dir}/simpack">
+ <include name="**/handhelds.manifest.txt" />
+ </fileset>
+ </first>
+ </path>
+ <dirname property="bbwp.sim.dir" file="${toString:bbwp.sim.path}" />
+
+ <!-- Simulator directory: Use sim.dir property if set in project.properties file.
+ Otherwise, use bbwp simulator directory. -->
+ <condition
+ property="simulator.dir"
+ value="${properties.blackberry.sim.dir}"
+ else="${bbwp.sim.dir}">
+ <available file="${properties.blackberry.sim.dir}" type="dir" />
+ </condition>
+ <echo message="Simulator directory=${simulator.dir}" />
+ </sequential>
+ </macrodef>
+
+ <!-- HELP -->
+
+ <target name="help">
+ <echo>
+NAME
+ ${ant.project.name}
+
+SYNOPSIS
+ ant TARGET COMMAND [-D<argument>=<value>]...
+
+DESCRIPTION
+ You can build and deploy your project to a device or simulator.
+
+TARGETS
+ blackberry ........ Builds a cod file and deploys to a device or simulator
+
+ playbook .......... Builds a bar file and deploys to a device or simulator
+
+COMMANDS
+ help .............. Show this help menu.
+ ant, ant help
+
+ load-device ....... Builds and deploys project to a connected USB device.
+ ant load-device
+
+ load-simulator .... Builds and deploys project to default simulator.
+ ant load-simulator
+
+ build ............. Compiles and packages the project for deployment.
+ ant build
+
+ clean ............. Remove all files from the build/ directory.
+ ant clean
+
+ clean-device ...... Remove this project from the connected USB device.
+ ant clean-device
+
+ clean-simulator ... Remove this project from the simulator (takes a while).
+ ant clean-simulator
+
+GETTING STARTED
+ 1. Edit project.properties
+
+ 2. <ant load-simulator> to run the project on the simulator
+
+ 3. Customize your project by editing www/config.xml
+
+ 4. To run the project on a BlackBerry device, you will need to obtain
+ code signing keys from RIM. Once you have the key, a project is
+ installed by connecting a BlackBerry via USB and running
+ <ant load-device>.
+ </echo>
+ </target>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/templates/project/build.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/build.xml b/bin/templates/project/build.xml
new file mode 100644
index 0000000..9cf3e37
--- /dev/null
+++ b/bin/templates/project/build.xml
@@ -0,0 +1,132 @@
+<project name="Build and Deploy a Cordova BlackBerry WebWorks Project" default="help">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+ <!-- LOAD ANT-CONTRIB LIBRARY -->
+
+ <taskdef resource="net/sf/antcontrib/antcontrib.properties">
+ <classpath>
+ <pathelement location="./lib/ant-contrib/ant-contrib-1.0b3.jar" />
+ </classpath>
+ </taskdef>
+
+ <!-- LOAD PROPERTIES -->
+
+ <property prefix="properties" file="project.properties" />
+ <property name="build.dir" location="build" />
+ <property name="widget.dir" location="${build.dir}/widget" />
+ <property name="code.sign" value="false" />
+
+ <target name="blackberry" >
+ <property name="subant.file" value="blackberry.xml" />
+ </target>
+
+ <target name="playbook" >
+ <property name="subant.file" value="playbook.xml" />
+ </target>
+
+ <target name="load-device">
+ <subant target="load-device">
+ <fileset dir="." includes="${subant.file}"/>
+ </subant>
+ </target>
+
+ <target name="load-simulator">
+ <subant target="load-simulator">
+ <fileset dir="." includes="${subant.file}"/>
+ </subant>
+ </target>
+
+ <target name="build">
+ <subant target="build">
+ <fileset dir="." includes="${subant.file}"/>
+ </subant>
+ </target>
+
+ <target name="clean">
+ <subant target="clean">
+ <fileset dir="." includes="${subant.file}"/>
+ </subant>
+ </target>
+
+ <target name="clean-device">
+ <subant target="clean-device">
+ <fileset dir="." includes="${subant.file}"/>
+ </subant>
+ </target>
+
+ <target name="clean-simulator">
+ <subant target="clean-simulator">
+ <fileset dir="." includes="${subant.file}"/>
+ </subant>
+ </target>
+
+ <!-- HELP -->
+
+ <target name="help">
+ <echo>
+NAME
+ ${ant.project.name}
+
+SYNOPSIS
+ ant TARGET COMMAND [-D<argument>=<value>]...
+
+DESCRIPTION
+ You can build and deploy your project to a device or simulator.
+
+TARGETS
+ blackberry ........ Builds a cod file and deploys to a device or simulator
+
+ playbook .......... Builds a bar file and deploys to a device or simulator
+
+COMMANDS
+ help .............. Show this help menu.
+ ant, ant help
+
+ load-device ....... Builds and deploys project to a connected USB device.
+ ant load-device
+
+ load-simulator .... Builds and deploys project to default simulator.
+ ant load-simulator
+
+ build ............. Compiles and packages the project for deployment.
+ ant build
+
+ clean ............. Remove all files from the build/ directory.
+ ant clean
+
+ clean-device ...... Remove this project from the connected USB device.
+ ant clean-device
+
+ clean-simulator ... Remove this project from the simulator (takes a while).
+ ant clean-simulator
+
+GETTING STARTED
+ 1. Edit project.properties
+
+ 2. <ant load-simulator> to run the project on the simulator
+
+ 3. Customize your project by editing www/config.xml
+
+ 4. To run the project on a BlackBerry device, you will need to obtain
+ code signing keys from RIM. Once you have the key, a project is
+ installed by connecting a BlackBerry via USB and running
+ <ant load-device>.
+ </echo>
+ </target>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/templates/project/lib/ant-contrib/LICENSE.txt
----------------------------------------------------------------------
diff --git a/bin/templates/project/lib/ant-contrib/LICENSE.txt b/bin/templates/project/lib/ant-contrib/LICENSE.txt
new file mode 100644
index 0000000..4d8c2fb
--- /dev/null
+++ b/bin/templates/project/lib/ant-contrib/LICENSE.txt
@@ -0,0 +1,47 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001-2003 Ant-Contrib project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Ant-Contrib project (http://sourceforge.net/projects/ant-contrib)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The name Ant-Contrib must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact
+ * ant-contrib-developers@lists.sourceforge.net.
+ *
+ * 5. Products derived from this software may not be called "Ant-Contrib"
+ * nor may "Ant-Contrib" appear in their names without prior written
+ * permission of the Ant-Contrib project.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE ANT-CONTRIB PROJECT OR ITS
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ */
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/templates/project/lib/ant-contrib/ant-contrib-1.0b3.jar
----------------------------------------------------------------------
diff --git a/bin/templates/project/lib/ant-contrib/ant-contrib-1.0b3.jar b/bin/templates/project/lib/ant-contrib/ant-contrib-1.0b3.jar
new file mode 100644
index 0000000..0625376
Binary files /dev/null and b/bin/templates/project/lib/ant-contrib/ant-contrib-1.0b3.jar differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/templates/project/playbook.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/playbook.xml b/bin/templates/project/playbook.xml
new file mode 100644
index 0000000..2584f9c
--- /dev/null
+++ b/bin/templates/project/playbook.xml
@@ -0,0 +1,255 @@
+<project default="help">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+ <!-- LOAD PROPERTIES -->
+
+ <property prefix="properties" file="project.properties" />
+ <property name="build.dir" location="build" />
+ <property name="widget.dir" location="${build.dir}/widget" />
+ <property name="code.sign" value="false" />
+ <property name="generate.ext" value="cod" />
+ <property name="build.num.file" value="buildId.txt" />
+
+ <!-- BlackBerry WebWorks Packager for Tablets directory is required. -->
+ <fail unless="properties.playbook.bbwp.dir" message="Please specify BlackBerry WebWorks Packager directory using 'playbook.bbwp.dir' in your 'project.properties' file." />
+
+ <!-- OS identification -->
+ <condition property="isMacOSX" else="false">
+ <and>
+ <os family="mac" />
+ <os family="unix" />
+ </and>
+ </condition>
+
+ <condition property="bbwp" value="${properties.playbook.bbwp.dir}/bbwp" else="${properties.playbook.bbwp.dir}/bbwp.exe">
+ <equals arg1="${isMacOSX}" arg2="true" />
+ </condition>
+
+ <condition property="blackberry-deploy" value="${properties.playbook.bbwp.dir}/blackberry-tablet-sdk/bin/blackberry-deploy" else="${properties.playbook.bbwp.dir}/blackberry-tablet-sdk/bin/blackberry-deploy.bat">
+ <equals arg1="${isMacOSX}" arg2="true" />
+ </condition>
+
+ <!-- LOAD DEVICE -->
+
+ <target name="load-device" depends="package-app">
+ <bbwp code-sign="true" />
+
+ <exec executable="${blackberry-deploy}" dir="." failonerror="true">
+ <arg value="-installApp" />
+ <arg value="-launchApp" />
+ <arg value="-device" />
+ <arg value="${properties.playbook.device.ip}" />
+ <arg value="-password" />
+ <arg value="${properties.playbook.device.password}" />
+ <arg value="-package" />
+ <arg file="${build.dir}/${cod.name}.bar" />
+ </exec>
+ </target>
+
+ <!-- LOAD SIMULATOR -->
+
+ <target name="load-simulator" depends="build">
+
+ <echo>This tool will not open the simulator for you </echo>
+
+ <exec executable="${blackberry-deploy}" dir="." failonerror="true">
+ <arg value="-installApp" />
+ <arg value="-launchApp" />
+ <arg value="-device" />
+ <arg value="${properties.playbook.sim.ip}" />
+ <arg value="-password" />
+ <arg value="${properties.playbook.sim.password}" />
+ <arg value="-package" />
+ <arg file="${build.dir}/${cod.name}.bar" />
+ </exec>
+ </target>
+
+ <!-- PACKAGE-APP -->
+
+ <target name="package-app" depends="generate-cod-name, clean">
+ <!-- Copy the WebWorks application -->
+ <mkdir dir="${widget.dir}" />
+ <copy todir="${widget.dir}" overwrite="true">
+ <fileset dir="www" >
+ <exclude name="ext/**"/>
+ <exclude name="ext-air/**"/>
+ <exclude name="playbook/**"/>
+ </fileset>
+ </copy>
+
+ <!-- Overwrite the cordova js with the playbook specific cordova js -->
+ <copy todir="${widget.dir}" overwrite="true">
+ <fileset dir="www/playbook">
+ <include name="*.js" />
+ </fileset>
+ </copy>
+
+ <!-- Update WebWorks Packager with the AIR APIs -->
+ <copy todir="${properties.playbook.bbwp.dir}\ext" overwrite="true">
+ <fileset dir="www/ext-air" excludes="README.md" />
+ </copy>
+
+ <!-- Package the WebWorks app by zipping the widget dir. -->
+ <mkdir dir="${build.dir}" />
+ <zip compress="false" destfile="${build.dir}/${cod.name}.zip" basedir="${widget.dir}" excludes="**/build/**,**/.settings/**,**/.project" />
+ </target>
+
+ <!-- BUILD -->
+
+ <target name="build" depends="package-app">
+ <bbwp code-sign="${code.sign}" />
+ </target>
+
+ <!-- BBWP MACRO -->
+
+ <macrodef name="bbwp">
+ <attribute name="code-sign" default="false" />
+ <sequential>
+ <buildnumber file="${build.num.file}" />
+ <if>
+ <equals arg1="@{code-sign}" arg2="true" />
+ <then>
+ <exec executable="${bbwp}">
+ <arg file="${build.dir}/${cod.name}.zip" />
+ <arg value="-gcsk" />
+ <arg value="${properties.playbook.sigtool.csk.password}" />
+ <arg value="-gp12" />
+ <arg value="${properties.playbook.sigtool.p12.password}" />
+ <arg value="-o" />
+ <arg file="${build.dir}" />
+ <arg value="-buildId" />
+ <arg value="${build.number}" />
+ </exec>
+ </then>
+ <else>
+ <exec executable="${bbwp}">
+ <arg file="${build.dir}/${cod.name}.zip" />
+ <arg value="-o" />
+ <arg file="${build.dir}" />
+ <arg value="-buildId" />
+ <arg value="${build.number}" />
+ </exec>
+ </else>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!-- CLEAN -->
+
+ <target name="clean">
+ <delete dir="${build.dir}" />
+ <delete dir="${widget.dir}" />
+ </target>
+
+ <!-- CLEAN DEVICE -->
+
+ <target name="clean-device" depends="generate-cod-name">
+ <exec executable="${blackberry-deploy}" dir="." failonerror="true">
+ <arg value="-uninstallApp" />
+ <arg value="-device" />
+ <arg value="${properties.playbook.device.ip}" />
+ <arg value="-password" />
+ <arg value="${properties.playbook.device.password}" />
+ <arg value="-package" />
+ <arg file="${build.dir}/${cod.name}.bar" />
+ </exec>
+ </target>
+
+ <!-- CLEAN SIMULATOR -->
+
+ <target name="clean-simulator">
+ <exec executable="${blackberry-deploy}" dir="." failonerror="true">
+ <arg value="-uninstallApp" />
+ <arg value="-device" />
+ <arg value="${properties.playbook.sim.ip}" />
+ <arg value="-password" />
+ <arg value="${properties.playbook.sim.password}" />
+ <arg value="-package" />
+ <arg file="${build.dir}/${cod.name}.bar" />
+ </exec>
+ </target>
+
+ <!-- HELPER TASKS -->
+
+ <target name="generate-cod-name">
+ <xmlproperty file="www/config.xml" prefix="config.xml" />
+ <propertyregex property="cod.name"
+ input="${config.xml.widget.name}"
+ regexp="(\W+)"
+ replace=""
+ casesensitive="false"
+ global="true"
+ defaultValue="${config.xml.widget.name}" />
+ <echo message="Generated name: ${cod.name}.bar" />
+ </target>
+
+ <!-- HELP -->
+
+ <target name="help">
+ <echo>
+NAME
+ ${ant.project.name}
+
+SYNOPSIS
+ ant TARGET COMMAND [-D<argument>=<value>]...
+
+DESCRIPTION
+ You can build and deploy your project to a device or simulator.
+
+TARGETS
+ blackberry ........ Builds a cod file and deploys to a device or simulator
+
+ playbook .......... Builds a bar file and deploys to a device or simulator
+
+COMMANDS
+ help .............. Show this help menu.
+ ant, ant help
+
+ load-device ....... Builds and deploys project to a connected USB device.
+ ant load-device
+
+ load-simulator .... Builds and deploys project to default simulator.
+ ant load-simulator
+
+ build ............. Compiles and packages the project for deployment.
+ ant build
+
+ clean ............. Remove all files from the build/ directory.
+ ant clean
+
+ clean-device ...... Remove this project from the connected USB device.
+ ant clean-device
+
+ clean-simulator ... Remove this project from the simulator (takes a while).
+ ant clean-simulator
+
+GETTING STARTED
+ 1. Edit project.properties
+
+ 2. <ant <TARGET> load-simulator> to run the project on the simulator
+
+ 3. Customize your project by editing www/config.xml
+
+ 4. To run the project on a BlackBerry device, you will need to obtain
+ code signing keys from RIM. Once you have the key, a project is
+ installed by connecting a BlackBerry via USB and running
+ <ant <TARGET> load-device>.
+ </echo>
+ </target>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/templates/project/project.properties
----------------------------------------------------------------------
diff --git a/bin/templates/project/project.properties b/bin/templates/project/project.properties
new file mode 100644
index 0000000..ee05983
--- /dev/null
+++ b/bin/templates/project/project.properties
@@ -0,0 +1,97 @@
+# BlackBerry WebWorks Packager Directory
+#
+# The BlackBerry WebWorks Packager (bbwp) is required for compiling and packaging
+# BlackBerry WebWorks applications for deployment to a BlackBerry device
+# or simulator. The bbwp utility is installed with the standalone BlackBerry
+# WebWorks SDK, and as part of the BlackBerry Web Plugin for Eclipse.
+#
+# Please specify the location of the BlackBerry WebWorks Packager in your
+# environment.
+#
+# Typical location of bbwp for standalone BlackBerry WebWorks SDK installation:
+# C:\Program Files (x86)\Research In Motion\BlackBerry Widget Packager
+#
+# Typical location of bbwp for BlackBerry Web Plugin for Eclipse installation:
+# C:\Eclipse-3.5.2\plugins\net.rim.browser.tools.wcpc_1.0.0.201003191451-126\wcpc
+#
+# The ANT script is brittle and requires you to escape the backslashes.
+# e.g. C:\some\path must be C:\\some\\path
+#
+# Please remember to:
+# - Double escape your backslahses (i.e. \ must be \\)
+# - Do not add a trailing slash (e.g. C:\some\path)
+#
+blackberry.bbwp.dir=C:\\Program Files\\Research In Motion\\BlackBerry WebWorks Packager
+
+playbook.bbwp.dir=C:\\Program Files\\Research In Motion\\BlackBerry WebWorks SDK for TabletOS 2.1.0.6\\bbwp
+
+# (Optional) Simulator Directory
+#
+# If sim.dir is not specified, the build script will use the simulator directory
+# within the Blackberry WebWorks Packager.
+#
+blackberry.sim.dir=C:\\Program Files\\Research In Motion\BlackBerry WebWorks Packager\\simpack\\6.0.0.227
+
+# (Optional) Simulator Binary
+#
+# If sim.bin is not specified, the build script will attempt to use the default
+# simulator in the simulator directory.
+#
+#blackberry.sim.bin=9700.bat
+
+# (Optional) MDS Directory
+#
+# If mds.dir is not specified, the build script will attempt to use the MDS that
+# is installed with the Blackberry WebWorks Packager.
+#
+blackberry.mds.dir=C:\\Program Files\\Research In Motion\\BlackBerry WebWorks Packager\\mds
+
+# BlackBerry Code Signing Password
+#
+# If you leave this field blank, then
+# the signing tool will prompt you each time
+#
+blackberry.sigtool.password=
+
+# Playbook Code Signing Password
+#
+# If you leave these fields blank, then
+# signing will fail
+#
+playbook.sigtool.csk.password=
+playbook.sigtool.p12.password=
+
+# BlackBerry Simulator Password
+#
+# If you leave this field blank, then
+# you cannot deploy to simulator
+#
+blackberry.sim.password=
+
+# Playbook Simulator IP
+#
+# If you leave this field blank, then
+# you cannot deploy to simulator
+#
+playbook.sim.ip=
+
+# Playbook Simulator Password
+#
+# If you leave this field blank, then
+# you cannot deploy to simulator
+#
+playbook.sim.password=
+
+# Playbook Device IP
+#
+# If you leave this field blank, then
+# you cannot deploy to device
+#
+playbook.device.ip=
+
+# Playbook Device Password
+#
+# If you leave this field blank, then
+# you cannot deploy to device
+#
+playbook.device.password=
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/5f3fbff2/bin/templates/project/www/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/www/config.xml b/bin/templates/project/www/config.xml
new file mode 100644
index 0000000..b210573
--- /dev/null
+++ b/bin/templates/project/www/config.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<!--
+ Widget Configuration Reference:
+ http://docs.blackberry.com/en/developers/deliverables/15274/
+-->
+
+<widget xmlns="http://www.w3.org/ns/widgets"
+ xmlns:rim="http://www.blackberry.com/ns/widgets"
+ version="1.0.0.0">
+
+ <name>__NAME__</name>
+
+ <description>
+ A sample application written with Cordova.
+ </description>
+
+ <license href="http://opensource.org/licenses/alphabetical">
+ </license>
+
+ <!-- Cordova API -->
+ <feature id="blackberry.system" required="true" version="1.0.0.0" />
+ <feature id="org.apache.cordova" required="true" version="1.0.0" />
+ <feature id="blackberry.find" required="true" version="1.0.0.0" />
+ <feature id="blackberry.identity" required="true" version="1.0.0.0" />
+ <feature id="blackberry.pim.Address" required="true" version="1.0.0.0" />
+ <feature id="blackberry.pim.Contact" required="true" version="1.0.0.0" />
+ <feature id="blackberry.io.file" required="true" version="1.0.0.0" />
+ <feature id="blackberry.utils" required="true" version="1.0.0.0" />
+ <feature id="blackberry.io.dir" required="true" version="1.0.0.0" />
+ <feature id="blackberry.app" required="true" version="1.0.0.0" />
+ <feature id="blackberry.app.event" required="true" version="1.0.0.0" />
+ <feature id="blackberry.system.event" required="true" version="1.0.0.0"/>
+ <feature id="blackberry.widgetcache" required="true" version="1.0.0.0"/>
+ <feature id="blackberry.media.camera" />
+ <feature id="blackberry.ui.dialog" />
+
+ <!-- Cordova API -->
+ <access subdomains="true" uri="file:///store/home" />
+ <access subdomains="true" uri="file:///SDCard" />
+
+ <!-- Expose access to all URIs, including the file and http protocols -->
+ <access subdomains="true" uri="*" />
+
+ <icon rim:hover="false" src="resources/icon.png" />
+ <icon rim:hover="true" src="resources/icon.png" />
+
+ <rim:loadingScreen backgroundColor="#CFCFCF"
+ foregroundImage="resources/loading_foreground.png"
+ onFirstLaunch="true">
+ <rim:transitionEffect type="fadeOut" />
+ </rim:loadingScreen>
+
+ <content src="index.html" />
+
+ <rim:permissions>
+ <rim:permit>use_camera</rim:permit>
+ <rim:permit>read_device_identifying_information</rim:permit>
+ <rim:permit>access_shared</rim:permit>
+ <rim:permit>read_geolocation</rim:permit>
+ </rim:permissions>
+
+</widget>