You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bh...@apache.org on 2013/11/03 17:53:29 UTC
webworks commit: CB-5254 log useful error info to std err
Updated Branches:
refs/heads/master 1639fc17f -> 43ab50f5c
CB-5254 log useful error info to std err
Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/43ab50f5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/43ab50f5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/43ab50f5
Branch: refs/heads/master
Commit: 43ab50f5cf229e120f29c84f4bd4b63ecf4fd397
Parents: 1639fc1
Author: Bryan Higgins <br...@bryanhiggins.net>
Authored: Sun Nov 3 11:30:39 2013 -0500
Committer: Bryan Higgins <br...@bryanhiggins.net>
Committed: Sun Nov 3 11:53:09 2013 -0500
----------------------------------------------------------------------
blackberry10/bin/create.js | 9 +-
.../bin/templates/project/cordova/lib/build | 135 -------------------
.../bin/templates/project/cordova/lib/build.js | 135 +++++++++++++++++++
.../bin/templates/project/cordova/lib/clean | 24 ----
.../bin/templates/project/cordova/lib/clean.js | 24 ++++
.../bin/templates/project/cordova/lib/logger.js | 2 +-
.../bin/templates/project/cordova/lib/run | 89 ------------
.../bin/templates/project/cordova/lib/run.js | 87 ++++++++++++
8 files changed, 252 insertions(+), 253 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/43ab50f5/blackberry10/bin/create.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/create.js b/blackberry10/bin/create.js
index 2c6e945..547a93a 100644
--- a/blackberry10/bin/create.js
+++ b/blackberry10/bin/create.js
@@ -26,7 +26,8 @@
var build,
path = require("path"),
- fs = require("fs"),
+ fs = require("fs")
+ os = require("os"),
wrench = require("wrench"),
utils = require(path.join(__dirname, 'lib/utils')),
version = getVersion(),
@@ -196,8 +197,8 @@ if ( process.argv[2] === "-h" || process.argv[2] === "--help" ) {
clean();
process.exit();
} catch (ex) {
- console.log("Project creation failed!\n" + "Error: " + ex);
- process.exit(1);
+ console.log("Project creation failed!");
+ console.error(os.EOL + ex);
+ process.exit(2);
}
}
-
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/43ab50f5/blackberry10/bin/templates/project/cordova/lib/build
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/build b/blackberry10/bin/templates/project/cordova/lib/build
deleted file mode 100755
index 5273dd5..0000000
--- a/blackberry10/bin/templates/project/cordova/lib/build
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/env node
-
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * 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"),
- command = require("commander"),
- utils = require("./utils"),
- bbProperties = utils.getProperties(),
- bbwpArgv = [
- process.argv[0],
- path.resolve(path.join(__dirname, process.argv[1])),
- path.resolve(path.join(__dirname, "..", "..", "www")),
- "-o",
- path.resolve(path.join(__dirname, "..", "..", "build"))
- ],
- async = require("async"),
- childProcess = require("child_process"),
- logger = require("./logger"),
- pkgrUtils = require("./packager-utils"),
- session = require("./session"),
- commandStr;
-
-function copyArgIfExists(arg) {
- if (command[arg]) {
- bbwpArgv.push("--" + arg);
- bbwpArgv.push(command[arg]);
- }
-}
-
-command
- .usage('[--debug] [--release] [--query] [-k | --keystorepass] [-b | --buildId <number>] [-p | --params <json>] [-ll | --loglevel <level>]')
- .option('--debug', 'build in debug mode.')
- .option('--release', 'build in release mode. This will sign the resulting bar.')
- .option('--query', 'query on the commandline when a password is needed')
- .option('-k, --keystorepass <password>', 'signing key password')
- .option('-b, --buildId <num>', 'specifies the build number for signing (typically incremented from previous signing).')
- .option('-d, --web-inspector', 'enables webinspector. Enabled by default in debug mode.).')
- .option('-p, --params <params JSON file>', 'specifies additional parameters to pass to downstream tools.')
- .option('-ll, --loglevel <loglevel>', 'set the logging level (error, warn, verbose)');
-
-try {
- command.parse(process.argv);
-
- if (command.debug && command.release) {
- logger.warn("Invalid build command: cannot specify both debug and release parameters.");
- console.log(command.helpInformation());
- process.exit(2);
- }
-
- async.series(
- [
- function clean (done) {
- var cmd = utils.isWindows() ? "clean" : "./clean",
- args = [],
- opts = { "cwd": path.normalize(__dirname + "/..") };
-
- utils.exec(cmd, args, opts, done);
- },
- function releaseBuild (allDone) {
- var childTasks = [],
- keystorepass = session.getKeyStorePass(command),
- err;
-
- if (command.release) {
- copyArgIfExists("buildId");
- //Note: Packager refers to signing password as "password" not "keystorepass"
- bbwpArgv.push("--password");
- if (keystorepass) {
- bbwpArgv.push(keystorepass);
- } else if (command.query) {
- childTasks.push(utils.prompt.bind(this, {description: "Please enter your keystore password: ", hidden: true}));
- childTasks.push(function (password, done) {
- bbwpArgv.push(password);
- done();
- });
- } else {
- err = "No signing password provided. Please enter a value for 'keystorepass' in %HOME%/.cordova/blackberry10.json or use --keystorepass via command-line";
- }
- }
-
- async.waterfall(childTasks, function (error) { allDone(error || err);});
- },
- function build (done) {
- //enable weybinspector in debug mode or if --webinspector was provided
- if (!command.release || command.webInspector) {
- bbwpArgv.push("-d");
- }
-
- copyArgIfExists("params");
- copyArgIfExists("loglevel");
-
- //Overwrite process.argv, before calling packager
- process.argv = bbwpArgv;
-
- //Delete cached commander object. It will conflict with the packagers commander
- delete require.cache[require.resolve("commander")];
- delete require.cache[require.resolve("commander/lib/commander")];
-
- require("./packager").start(done);
- }
- ],
- function (err, results) {
- if (err) {
- if (typeof err === "string") {
- logger.error(err);
- process.exit(1);
- } else if (typeof err === "number") {
- process.exit(err);
- } else {
- process.exit(2);
- }
- } else {
- process.exit(0);
- }
- }
- );
-} catch (e) {
- logger.error(e);
- process.exit(2);
-}
-
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/43ab50f5/blackberry10/bin/templates/project/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/build.js b/blackberry10/bin/templates/project/cordova/lib/build.js
new file mode 100755
index 0000000..bfee5f6
--- /dev/null
+++ b/blackberry10/bin/templates/project/cordova/lib/build.js
@@ -0,0 +1,135 @@
+#!/usr/bin/env node
+
+/*
+ * Copyright 2012 Research In Motion Limited.
+ *
+ * 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"),
+ command = require("commander"),
+ os = require("os"),
+ utils = require("./utils"),
+ bbProperties = utils.getProperties(),
+ bbwpArgv = [
+ process.argv[0],
+ path.resolve(path.join(__dirname, process.argv[1])),
+ path.resolve(path.join(__dirname, "..", "..", "www")),
+ "-o",
+ path.resolve(path.join(__dirname, "..", "..", "build"))
+ ],
+ async = require("async"),
+ childProcess = require("child_process"),
+ pkgrUtils = require("./packager-utils"),
+ session = require("./session"),
+ commandStr;
+
+function copyArgIfExists(arg) {
+ if (command[arg]) {
+ bbwpArgv.push("--" + arg);
+ bbwpArgv.push(command[arg]);
+ }
+}
+
+command
+ .usage('[--debug] [--release] [--query] [-k | --keystorepass] [-b | --buildId <number>] [-p | --params <json>] [-ll | --loglevel <level>]')
+ .option('--debug', 'build in debug mode.')
+ .option('--release', 'build in release mode. This will sign the resulting bar.')
+ .option('--query', 'query on the commandline when a password is needed')
+ .option('-k, --keystorepass <password>', 'signing key password')
+ .option('-b, --buildId <num>', 'specifies the build number for signing (typically incremented from previous signing).')
+ .option('-d, --web-inspector', 'enables webinspector. Enabled by default in debug mode.).')
+ .option('-p, --params <params JSON file>', 'specifies additional parameters to pass to downstream tools.')
+ .option('-ll, --loglevel <loglevel>', 'set the logging level (error, warn, verbose)');
+
+try {
+ command.parse(process.argv);
+
+ if (command.debug && command.release) {
+ console.error("Invalid build command: cannot specify both debug and release parameters.");
+ console.log(command.helpInformation());
+ process.exit(2);
+ }
+
+ async.series(
+ [
+ function clean (done) {
+ var cmd = utils.isWindows() ? "clean" : "./clean",
+ args = [],
+ opts = { "cwd": path.normalize(__dirname + "/..") };
+
+ utils.exec(cmd, args, opts, done);
+ },
+ function releaseBuild (allDone) {
+ var childTasks = [],
+ keystorepass = session.getKeyStorePass(command),
+ err;
+
+ if (command.release) {
+ copyArgIfExists("buildId");
+ //Note: Packager refers to signing password as "password" not "keystorepass"
+ bbwpArgv.push("--password");
+ if (keystorepass) {
+ bbwpArgv.push(keystorepass);
+ } else if (command.query) {
+ childTasks.push(utils.prompt.bind(this, {description: "Please enter your keystore password: ", hidden: true}));
+ childTasks.push(function (password, done) {
+ bbwpArgv.push(password);
+ done();
+ });
+ } else {
+ err = "No signing password provided. Please enter a value for 'keystorepass' in %HOME%/.cordova/blackberry10.json or use --keystorepass via command-line";
+ }
+ }
+
+ async.waterfall(childTasks, function (error) { allDone(error || err);});
+ },
+ function build (done) {
+ //enable weybinspector in debug mode or if --webinspector was provided
+ if (!command.release || command.webInspector) {
+ bbwpArgv.push("-d");
+ }
+
+ copyArgIfExists("params");
+ copyArgIfExists("loglevel");
+
+ //Overwrite process.argv, before calling packager
+ process.argv = bbwpArgv;
+
+ //Delete cached commander object. It will conflict with the packagers commander
+ delete require.cache[require.resolve("commander")];
+ delete require.cache[require.resolve("commander/lib/commander")];
+
+ require("./packager").start(done);
+ }
+ ],
+ function (err, results) {
+ if (err) {
+ if (typeof err === "string") {
+ console.error(os.EOL + err);
+ process.exit(2);
+ } else if (typeof err === "number") {
+ process.exit(err);
+ } else {
+ process.exit(2);
+ }
+ } else {
+ process.exit(0);
+ }
+ }
+ );
+} catch (e) {
+ console.error(os.EOL + e);
+ process.exit(2);
+}
+
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/43ab50f5/blackberry10/bin/templates/project/cordova/lib/clean
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/clean b/blackberry10/bin/templates/project/cordova/lib/clean
deleted file mode 100644
index 46391d3..0000000
--- a/blackberry10/bin/templates/project/cordova/lib/clean
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env node
-
-/*
- * Copyright 2013 Research In Motion Limited.
- *
- * 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 wrench = require('wrench'),
- path = require("path"),
- buildPath = path.normalize(__dirname + "/../../build/");
-
- wrench.rmdirSyncRecursive(buildPath, true);
-
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/43ab50f5/blackberry10/bin/templates/project/cordova/lib/clean.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/clean.js b/blackberry10/bin/templates/project/cordova/lib/clean.js
new file mode 100644
index 0000000..46391d3
--- /dev/null
+++ b/blackberry10/bin/templates/project/cordova/lib/clean.js
@@ -0,0 +1,24 @@
+#!/usr/bin/env node
+
+/*
+ * Copyright 2013 Research In Motion Limited.
+ *
+ * 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 wrench = require('wrench'),
+ path = require("path"),
+ buildPath = path.normalize(__dirname + "/../../build/");
+
+ wrench.rmdirSyncRecursive(buildPath, true);
+
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/43ab50f5/blackberry10/bin/templates/project/cordova/lib/logger.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/logger.js b/blackberry10/bin/templates/project/cordova/lib/logger.js
index 6cab576..52fcde3 100644
--- a/blackberry10/bin/templates/project/cordova/lib/logger.js
+++ b/blackberry10/bin/templates/project/cordova/lib/logger.js
@@ -25,7 +25,7 @@ module.exports = {
}
},
error: function (msg) {
- console.log("[ERROR] " + msg);
+ console.error("[ERROR] " + msg);
},
warn: function (msg) {
if (level !== 'error') {
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/43ab50f5/blackberry10/bin/templates/project/cordova/lib/run
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/run b/blackberry10/bin/templates/project/cordova/lib/run
deleted file mode 100755
index 5da61f1..0000000
--- a/blackberry10/bin/templates/project/cordova/lib/run
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/env node
-
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * 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"),
- utils = require("./utils"),
- options = require('commander'),
- runUtils = require("./run-utils"),
- logger = require("./logger"),
- async = require("async"),
- ERROR_CODE = 2;
-
-function install(deployTarget, done) {
- var buildCmd = utils.isWindows() ? "build" : "./build",
- buildArgs = options.keystorepass ? ["-k", options.keystorepass] : [],
- projectRootDir = path.normalize(path.join(__dirname, "..")),
- installTasks = [];
-
- if (options.build) {
- installTasks.push(utils.exec.bind(this, buildCmd, buildArgs, {"cwd": projectRootDir}));
- }
-
- installTasks.push(runUtils.uninstall.bind(this, options, deployTarget),
- runUtils.deployToTarget.bind(this, options, deployTarget));
-
- async.series(installTasks, done);
-}
-
-options
- .usage('[--device] [--emulator] [--target=<id>] [--query] [-k | --keystorepass] [-devicepass] [--no-launch] [--no-uninstall] [--no-build]')
- .option('-k, --keystorepass <password>', 'the password of signing key; needed for creating debug token')
- .option('--device', 'run on connected device')
- .option('--emulator', 'run on BB10 simulator')
- .option('--devicepass <password>', 'device password')
- .option('--target <id>', 'specifies the target to run the application')
- .option('--query', 'query on the commandline when a password is needed')
- .option('--no-uninstall', 'does not uninstall application from device')
- .option('--no-launch', 'do not launch the application on device')
- .option('--no-build', 'deploy the pre-built bar file and skip building')
- .on('--help', function() {
- console.log(' Examples:');
- console.log('');
- console.log(" Deploying to a predefined target");
- console.log(' $ run --target=Z10');
- console.log(" Deploying to a connected device");
- console.log(' $ run --device --devicepass devicePassword --keystorepass keystorePassword');
- console.log('');
- });
-
-process.argv.forEach(function (argument, index, args) {
- if (argument.match(/^--target=/)) {
- args.splice(index, 1, "--target", argument.substr("--target=".length));
- }
-});
-
-options.parse(process.argv);
-
-async.waterfall(
- [
- runUtils.getValidatedTarget.bind(this, options),
- install
- ],
- function (err) {
- if (err) {
- if (typeof err === "string") {
- logger.error(err);
- } else {
- logger.error("An error has occurred");
- }
- process.exit(ERROR_CODE);
- } else {
- process.exit(0);
- }
- }
-);
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/43ab50f5/blackberry10/bin/templates/project/cordova/lib/run.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/run.js b/blackberry10/bin/templates/project/cordova/lib/run.js
new file mode 100755
index 0000000..0c5313a
--- /dev/null
+++ b/blackberry10/bin/templates/project/cordova/lib/run.js
@@ -0,0 +1,87 @@
+#!/usr/bin/env node
+
+/*
+ * Copyright 2012 Research In Motion Limited.
+ *
+ * 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"),
+ os = require("os"),
+ utils = require("./utils"),
+ options = require('commander'),
+ runUtils = require("./run-utils"),
+ async = require("async"),
+ ERROR_CODE = 2;
+
+function install(deployTarget, done) {
+ var buildCmd = utils.isWindows() ? "build" : "./build",
+ buildArgs = options.keystorepass ? ["-k", options.keystorepass] : [],
+ projectRootDir = path.normalize(path.join(__dirname, "..")),
+ installTasks = [];
+
+ if (options.build) {
+ installTasks.push(utils.exec.bind(this, buildCmd, buildArgs, {"cwd": projectRootDir}));
+ }
+
+ installTasks.push(runUtils.uninstall.bind(this, options, deployTarget),
+ runUtils.deployToTarget.bind(this, options, deployTarget));
+
+ async.series(installTasks, done);
+}
+
+options
+ .usage('[--device] [--emulator] [--target=<id>] [--query] [-k | --keystorepass] [-devicepass] [--no-launch] [--no-uninstall] [--no-build]')
+ .option('-k, --keystorepass <password>', 'the password of signing key; needed for creating debug token')
+ .option('--device', 'run on connected device')
+ .option('--emulator', 'run on BB10 simulator')
+ .option('--devicepass <password>', 'device password')
+ .option('--target <id>', 'specifies the target to run the application')
+ .option('--query', 'query on the commandline when a password is needed')
+ .option('--no-uninstall', 'does not uninstall application from device')
+ .option('--no-launch', 'do not launch the application on device')
+ .option('--no-build', 'deploy the pre-built bar file and skip building')
+ .on('--help', function() {
+ console.log(' Examples:');
+ console.log('');
+ console.log(" Deploying to a predefined target");
+ console.log(' $ run --target=Z10');
+ console.log(" Deploying to a connected device");
+ console.log(' $ run --device --devicepass devicePassword --keystorepass keystorePassword');
+ console.log('');
+ });
+
+process.argv.forEach(function (argument, index, args) {
+ if (argument.match(/^--target=/)) {
+ args.splice(index, 1, "--target", argument.substr("--target=".length));
+ }
+});
+
+options.parse(process.argv);
+
+async.waterfall(
+ [
+ runUtils.getValidatedTarget.bind(this, options),
+ install
+ ],
+ function (err) {
+ if (err) {
+ if (typeof err === "string") {
+ console.error(os.EOL + err);
+ }
+ process.exit(ERROR_CODE);
+ } else {
+ process.exit(0);
+ }
+ }
+);