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/06/07 23:58:05 UTC

[1/2] webworks commit: [CB-3604] target script changed from project level to repo level script

Updated Branches:
  refs/heads/CB-3604 [created] be2970ef6


[CB-3604] target script changed from project level to repo level script


Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/13891d62
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/13891d62
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/13891d62

Branch: refs/heads/CB-3604
Commit: 13891d6203ec2bff78321019bd3ea9bd1a058520
Parents: ee54174
Author: lorinbeer <lo...@adobe.com>
Authored: Fri Jun 7 14:29:37 2013 -0700
Committer: lorinbeer <lo...@adobe.com>
Committed: Fri Jun 7 14:29:37 2013 -0700

----------------------------------------------------------------------
 blackberry10/bin/lib/target.js    |  209 ++++++++++++++++++++++++++++++++
 blackberry10/bin/lib/targets.json |    5 +
 blackberry10/bin/target           |    3 +
 blackberry10/bin/target.bat       |   21 +++
 4 files changed, 238 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/13891d62/blackberry10/bin/lib/target.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/lib/target.js b/blackberry10/bin/lib/target.js
new file mode 100644
index 0000000..d66d5ec
--- /dev/null
+++ b/blackberry10/bin/lib/target.js
@@ -0,0 +1,209 @@
+#!/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 path = require('path'),
+    propertiesFile = './targets.json',
+    properties = require(propertiesFile),
+    fs = require('fs'),
+    commander = require('commander'),
+    command,
+    name,
+    ip,
+    type,
+    password,
+    pin,
+    pinRegex = new RegExp("[0-9A-Fa-f]{8}");
+
+function writeProjectFile(contents, file) {
+    fs.writeFile(file, contents, 'utf-8', function (err) {
+        if (err) console.log("Error updating project.json :(\n" + err);
+        process.exit();
+    });
+}
+
+function isValidIp(ip) {
+    var num,
+        result = true,
+        ipArray;
+
+    if (typeof ip !== 'string') {
+        console.log("IP is required");
+        console.log(commander.helpInformation());
+        process.exit(2); 
+    } else {
+        ipArray = ip.split('.');
+        if (ipArray.length !== 4) {
+            result = false;
+        }
+        ipArray.forEach(function (quadrant) {
+            num = Number(quadrant);
+            if (isNaN(num) || (num < 0) || (num > 255)) {
+                result = false;
+            }
+        });
+    }
+    return result;
+}
+
+function isValidType(type) {
+    var result = true;
+
+    if (typeof type !== 'string') {
+        console.log("target type is required");
+        console.log(commander.helpInformation());
+        process.exit(2); 
+    }
+    else if (!(type === 'device' || type === 'simulator')) {
+        result = false;
+    }
+    return result;
+}
+
+function isValidPin(pin) {
+    var result = true;
+    if (typeof pin !== 'undefined' && !pinRegex.test(pin)) {
+        result = false;
+    }
+    return result;
+}
+
+commander
+    .usage('[command] [params]')
+    .option('-p, --password <password>', 'Specifies password for this target')
+    .option('--pin <devicepin>', 'Specifies PIN for this device')
+    .option('-t, --type <device | simulator>', 'Specifies the target type');
+
+commander
+    .on('--help', function () {
+        console.log('   Synopsis:');
+        console.log('   $ target');
+        console.log('   $ target add <name> <ip> [-t | --type <device | simulator>] [-p | --password <password>] [--pin <devicepin>]');
+        console.log('   $ target remove <name>');
+        console.log('   $ target default [name]');
+        console.log(' ');
+    });
+
+commander
+    .command('add')
+    .description("Add specified target")
+    .action(function () {
+        if (commander.args.length === 1) {
+            console.log("Target details not specified");
+            console.log(commander.helpInformation());
+            process.exit(2); 
+        }
+        name = commander.args[0];
+        ip = commander.args[1];
+        type = commander.type ? commander.type : "device";
+        if (commander.password && typeof commander.password === 'string') {
+            password = commander.password;
+        }
+        if (commander.pin && typeof commander.pin === 'string') {
+            pin = commander.pin;
+        }
+        if (!isValidIp(ip)) {
+            console.log("Invalid IP: " + ip);
+            console.log(commander.helpInformation());
+            process.exit(2); 
+        }
+        if (!isValidType(type)) {
+            console.log("Invalid target type: " + type);
+            console.log(commander.helpInformation());
+            process.exit(2); 
+        }
+        if (!isValidPin(pin)) {
+            console.log("Invalid PIN: " + pin);
+            console.log(commander.helpInformation());
+            process.exit(2); 
+        }
+        if (properties.targets.hasOwnProperty(name)) {
+            console.log("Overwriting target: " + name);
+        }
+        properties.targets[name] = {"ip": ip, "type": type, "password": password, "pin": pin};
+    });
+
+commander
+    .command('remove')
+    .description("Remove specified target")
+    .action(function () {
+        if (commander.args.length === 1) {
+            console.log('No target specified');
+            console.log(commander.helpInformation());
+            process.exit(2); 
+        }
+        name = commander.args[0];
+        if (!properties.targets.hasOwnProperty(name)) {
+            console.log("Target: '" + name + "' not found");
+            console.log(commander.helpInformation());
+            process.exit(2); 
+        }
+        if (name === properties.defaultTarget) {
+            console.log("Deleting default target, please set a new default target");
+            properties.defaultTarget = "";
+        }
+        delete properties.targets[name];
+    });
+
+commander
+    .command('default')
+    .description("Get or set default target")
+    .action(function () {
+        if (commander.args.length === 1) {
+            console.log(properties.defaultTarget);
+            process.exit();
+        }
+        name = commander.args[0];
+        if (properties.targets.hasOwnProperty(name)) {
+            properties.defaultTarget = name;
+        } else {
+            console.log("Target '" + name + "' not found");
+            console.log(commander.helpInformation());
+            process.exit(2); 
+        }
+    });
+
+commander
+    .command('*')
+    .action(function () {
+        console.log('Unrecognized command');
+        console.log(commander.helpInformation());
+        process.exit(2);
+    });
+
+
+try {
+    commander.parse(process.argv);
+
+    if (commander.args.length === 0) {
+        Object.keys(properties.targets).forEach(function (target) {
+            if (target === properties.defaultTarget) {
+                console.log('* ' + target);
+            } else {
+                console.log('  ' + target);
+            }
+        });
+        process.exit();
+    }
+    if (Object.keys(properties.targets).length === 1) {
+        properties.defaultTarget = Object.keys(properties.targets)[0];
+    }
+
+    writeProjectFile(JSON.stringify(properties, null, 4) + "\n", propertiesFile);
+} catch (e) {
+    console.log(e);
+    process.exit();
+}

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/13891d62/blackberry10/bin/lib/targets.json
----------------------------------------------------------------------
diff --git a/blackberry10/bin/lib/targets.json b/blackberry10/bin/lib/targets.json
new file mode 100644
index 0000000..85d0113
--- /dev/null
+++ b/blackberry10/bin/lib/targets.json
@@ -0,0 +1,5 @@
+{
+    "defaultTarget": "bb10",
+    "targets": {
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/13891d62/blackberry10/bin/target
----------------------------------------------------------------------
diff --git a/blackberry10/bin/target b/blackberry10/bin/target
new file mode 100755
index 0000000..4e676d2
--- /dev/null
+++ b/blackberry10/bin/target
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+node "$( dirname "$0")/lib/target" "$@"

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/13891d62/blackberry10/bin/target.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/target.bat b/blackberry10/bin/target.bat
new file mode 100755
index 0000000..3c05c97
--- /dev/null
+++ b/blackberry10/bin/target.bat
@@ -0,0 +1,21 @@
+@ECHO OFF
+goto comment
+       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.
+:comment
+
+@node.exe %~dps0\lib\target %*


[2/2] webworks commit: [CB-3604] removed project level target scripts

Posted by lo...@apache.org.
[CB-3604] removed project level target scripts


Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/be2970ef
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/be2970ef
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/be2970ef

Branch: refs/heads/CB-3604
Commit: be2970ef6acd3742ff7f99536c2a40f766afc5ac
Parents: 13891d6
Author: lorinbeer <lo...@adobe.com>
Authored: Fri Jun 7 14:44:52 2013 -0700
Committer: lorinbeer <lo...@adobe.com>
Committed: Fri Jun 7 14:44:52 2013 -0700

----------------------------------------------------------------------
 .../bin/templates/project/cordova/lib/target       |  209 ---------------
 blackberry10/bin/templates/project/cordova/target  |    3 -
 .../bin/templates/project/cordova/target.bat       |   21 --
 3 files changed, 0 insertions(+), 233 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/be2970ef/blackberry10/bin/templates/project/cordova/lib/target
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/target b/blackberry10/bin/templates/project/cordova/lib/target
deleted file mode 100644
index 0a5746b..0000000
--- a/blackberry10/bin/templates/project/cordova/lib/target
+++ /dev/null
@@ -1,209 +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 path = require('path'),
-    propertiesFile = path.resolve(path.join(__dirname, '..', '..', 'project.json')),
-    properties = require(propertiesFile),
-    fs = require('fs'),
-    commander = require('commander'),
-    command,
-    name,
-    ip,
-    type,
-    password,
-    pin,
-    pinRegex = new RegExp("[0-9A-Fa-f]{8}");
-
-function writeProjectFile(contents, file) {
-    fs.writeFile(file, contents, 'utf-8', function (err) {
-        if (err) console.log("Error updating project.json :(\n" + err);
-        process.exit();
-    });
-}
-
-function isValidIp(ip) {
-    var num,
-        result = true,
-        ipArray;
-
-    if (typeof ip !== 'string') {
-        console.log("IP is required");
-        console.log(commander.helpInformation());
-        process.exit(2); 
-    } else {
-        ipArray = ip.split('.');
-        if (ipArray.length !== 4) {
-            result = false;
-        }
-        ipArray.forEach(function (quadrant) {
-            num = Number(quadrant);
-            if (isNaN(num) || (num < 0) || (num > 255)) {
-                result = false;
-            }
-        });
-    }
-    return result;
-}
-
-function isValidType(type) {
-    var result = true;
-
-    if (typeof type !== 'string') {
-        console.log("target type is required");
-        console.log(commander.helpInformation());
-        process.exit(2); 
-    }
-    else if (!(type === 'device' || type === 'simulator')) {
-        result = false;
-    }
-    return result;
-}
-
-function isValidPin(pin) {
-    var result = true;
-    if (typeof pin !== 'undefined' && !pinRegex.test(pin)) {
-        result = false;
-    }
-    return result;
-}
-
-commander
-    .usage('[command] [params]')
-    .option('-p, --password <password>', 'Specifies password for this target')
-    .option('--pin <devicepin>', 'Specifies PIN for this device')
-    .option('-t, --type <device | simulator>', 'Specifies the target type');
-
-commander
-    .on('--help', function () {
-        console.log('   Synopsis:');
-        console.log('   $ target');
-        console.log('   $ target add <name> <ip> [-t | --type <device | simulator>] [-p | --password <password>] [--pin <devicepin>]');
-        console.log('   $ target remove <name>');
-        console.log('   $ target default [name]');
-        console.log(' ');
-    });
-
-commander
-    .command('add')
-    .description("Add specified target")
-    .action(function () {
-        if (commander.args.length === 1) {
-            console.log("Target details not specified");
-            console.log(commander.helpInformation());
-            process.exit(2); 
-        }
-        name = commander.args[0];
-        ip = commander.args[1];
-        type = commander.type ? commander.type : "device";
-        if (commander.password && typeof commander.password === 'string') {
-            password = commander.password;
-        }
-        if (commander.pin && typeof commander.pin === 'string') {
-            pin = commander.pin;
-        }
-        if (!isValidIp(ip)) {
-            console.log("Invalid IP: " + ip);
-            console.log(commander.helpInformation());
-            process.exit(2); 
-        }
-        if (!isValidType(type)) {
-            console.log("Invalid target type: " + type);
-            console.log(commander.helpInformation());
-            process.exit(2); 
-        }
-        if (!isValidPin(pin)) {
-            console.log("Invalid PIN: " + pin);
-            console.log(commander.helpInformation());
-            process.exit(2); 
-        }
-        if (properties.targets.hasOwnProperty(name)) {
-            console.log("Overwriting target: " + name);
-        }
-        properties.targets[name] = {"ip": ip, "type": type, "password": password, "pin": pin};
-    });
-
-commander
-    .command('remove')
-    .description("Remove specified target")
-    .action(function () {
-        if (commander.args.length === 1) {
-            console.log('No target specified');
-            console.log(commander.helpInformation());
-            process.exit(2); 
-        }
-        name = commander.args[0];
-        if (!properties.targets.hasOwnProperty(name)) {
-            console.log("Target: '" + name + "' not found");
-            console.log(commander.helpInformation());
-            process.exit(2); 
-        }
-        if (name === properties.defaultTarget) {
-            console.log("Deleting default target, please set a new default target");
-            properties.defaultTarget = "";
-        }
-        delete properties.targets[name];
-    });
-
-commander
-    .command('default')
-    .description("Get or set default target")
-    .action(function () {
-        if (commander.args.length === 1) {
-            console.log(properties.defaultTarget);
-            process.exit();
-        }
-        name = commander.args[0];
-        if (properties.targets.hasOwnProperty(name)) {
-            properties.defaultTarget = name;
-        } else {
-            console.log("Target '" + name + "' not found");
-            console.log(commander.helpInformation());
-            process.exit(2); 
-        }
-    });
-
-commander
-    .command('*')
-    .action(function () {
-        console.log('Unrecognized command');
-        console.log(commander.helpInformation());
-        process.exit(2);
-    });
-
-
-try {
-    commander.parse(process.argv);
-
-    if (commander.args.length === 0) {
-        Object.keys(properties.targets).forEach(function (target) {
-            if (target === properties.defaultTarget) {
-                console.log('* ' + target);
-            } else {
-                console.log('  ' + target);
-            }
-        });
-        process.exit();
-    }
-    if (Object.keys(properties.targets).length === 1) {
-        properties.defaultTarget = Object.keys(properties.targets)[0];
-    }
-
-    writeProjectFile(JSON.stringify(properties, null, 4) + "\n", propertiesFile);
-} catch (e) {
-    console.log(e);
-    process.exit();
-}

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/be2970ef/blackberry10/bin/templates/project/cordova/target
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/target b/blackberry10/bin/templates/project/cordova/target
deleted file mode 100755
index 4e676d2..0000000
--- a/blackberry10/bin/templates/project/cordova/target
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-node "$( dirname "$0")/lib/target" "$@"

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/be2970ef/blackberry10/bin/templates/project/cordova/target.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/target.bat b/blackberry10/bin/templates/project/cordova/target.bat
deleted file mode 100755
index 3c05c97..0000000
--- a/blackberry10/bin/templates/project/cordova/target.bat
+++ /dev/null
@@ -1,21 +0,0 @@
-@ECHO OFF
-goto comment
-       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.
-:comment
-
-@node.exe %~dps0\lib\target %*