You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by he...@apache.org on 2014/04/25 22:45:36 UTC

[1/3] git commit: Adding support for privileged

Repository: cordova-cli
Updated Branches:
  refs/heads/master 7012448cd -> 5835a02e8


Adding support for privileged


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

Branch: refs/heads/master
Commit: b454946c26454e74b047d5352c2d490ae3232d54
Parents: b4febd7
Author: Rodrigo Silveira <ro...@outlook.com>
Authored: Tue Apr 22 12:27:34 2014 -0400
Committer: hermwong <he...@gmail.com>
Committed: Fri Apr 25 13:45:10 2014 -0700

----------------------------------------------------------------------
 src/metadata/firefoxos_parser.js | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b454946c/src/metadata/firefoxos_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/firefoxos_parser.js b/src/metadata/firefoxos_parser.js
index 1d41916..b9c1d51 100644
--- a/src/metadata/firefoxos_parser.js
+++ b/src/metadata/firefoxos_parser.js
@@ -66,6 +66,7 @@ module.exports.prototype = {
         }
 
         var permissionNodes = config.doc.findall('permission');
+        var privileged = false;
 
         if (permissionNodes.length) {
             manifest.permissions = manifest.permissions || {};
@@ -82,10 +83,20 @@ module.exports.prototype = {
                     if (node.attrib['access']) {
                         manifest.permissions[permissionName].access = node.attrib['access'];
                     }
+
+                    if (node.attrib['privileged']) {
+                        privileged = true;
+                    }
                 }
             });
         }
 
+        if (privileged) {
+            manifest.type = 'privileged';
+        } else {
+            delete manifest.type;
+        }
+
         fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 4));
 
         return Q();


[3/3] git commit: Check if privileged attribute is 'true'

Posted by he...@apache.org.
Check if privileged attribute is 'true'


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

Branch: refs/heads/master
Commit: 5835a02e877b0b78a30fd0edc989c4b7d93afdd5
Parents: b454946
Author: Rodrigo Silveira <ro...@outlook.com>
Authored: Tue Apr 22 14:08:06 2014 -0400
Committer: hermwong <he...@gmail.com>
Committed: Fri Apr 25 13:45:11 2014 -0700

----------------------------------------------------------------------
 src/metadata/firefoxos_parser.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/5835a02e/src/metadata/firefoxos_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/firefoxos_parser.js b/src/metadata/firefoxos_parser.js
index b9c1d51..351a409 100644
--- a/src/metadata/firefoxos_parser.js
+++ b/src/metadata/firefoxos_parser.js
@@ -84,7 +84,7 @@ module.exports.prototype = {
                         manifest.permissions[permissionName].access = node.attrib['access'];
                     }
 
-                    if (node.attrib['privileged']) {
+                    if (node.attrib['privileged'] === "true") {
                         privileged = true;
                     }
                 }


[2/3] git commit: Merge pull request #4 from rodms10/autoPermission

Posted by he...@apache.org.
Merge pull request #4 from rodms10/autoPermission

CB-5416 - Need to auto generate manifest.webapp with appropriate plugin permissions


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

Branch: refs/heads/master
Commit: b4febd7c102fcfcb30774d894bab824de9e0bfd3
Parents: 7012448
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Thu Apr 17 20:19:37 2014 +0200
Committer: hermwong <he...@gmail.com>
Committed: Fri Apr 25 13:45:10 2014 -0700

----------------------------------------------------------------------
 src/metadata/firefoxos_parser.js | 85 ++++++++++++++++++-----------------
 1 file changed, 45 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b4febd7c/src/metadata/firefoxos_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/firefoxos_parser.js b/src/metadata/firefoxos_parser.js
index 8ba44a3..1d41916 100644
--- a/src/metadata/firefoxos_parser.js
+++ b/src/metadata/firefoxos_parser.js
@@ -22,8 +22,7 @@ var fs = require('fs'),
     util = require('../util'),
     events = require('../events'),
     Q = require('q'),
-    ConfigParser = require('../ConfigParser'),
-    config = require('../config');
+    ConfigParser = require('../ConfigParser');
 
 module.exports = function firefoxos_parser(project) {
     this.path = project;
@@ -36,15 +35,8 @@ module.exports.check_requirements = function(project_root) {
 
 module.exports.prototype = {
     // Returns a promise.
-    update_from_config: function(config) {
-        if (!(config instanceof ConfigParser)) {
-            return Q.reject(new Error('update_from_config requires a ConfigParser object'));
-        }
-
-        var name = config.name();
-        var pkg = config.packageName();
-        var version = config.version();
-
+    update_from_config: function() {
+        var config = new ConfigParser(this.config_xml());
         var manifestPath = path.join(this.www_dir(), 'manifest.webapp');
         var manifest;
 
@@ -58,30 +50,43 @@ module.exports.prototype = {
             };
         }
 
-        // Update icons
-        var icons = config.getIcons('firefoxos');
-        var platformRoot = this.path;
-        var appRoot = util.isCordova(platformRoot);
-
-        // http://www.mozilla.org/en-US/styleguide/products/firefox-os/icons/
-        var platformIcons = [
-            {dest: "www/img/logo.png", width: 60, height: 60}
-        ];
-
-        platformIcons.forEach(function (item) {
-            icon = icons.getIconBySize(item.width, item.height) || icons.getDefault();
-            if (icon){
-                var src = path.join(appRoot, icon.src),
-                    dest = path.join(platformRoot, item.dest);
-                events.emit('verbose', 'Copying icon from ' + src + ' to ' + dest);
-                shell.cp('-f', src, dest);
-            }
-        });
-
-        manifest.version = version;
-        manifest.name = name;
-        manifest.pkgName = pkg;
-        fs.writeFileSync(manifestPath, JSON.stringify(manifest));
+        manifest.version = config.version();
+        manifest.name = config.name();
+        manifest.pkgName = config.packageName();
+        manifest.description = config.description();
+        manifest.developer = {
+            name: config.author()
+        };
+
+        var authorNode = config.doc.find('author');
+        var authorUrl = authorNode.attrib['href'];
+
+        if (authorUrl) {
+            manifest.developer.url = authorUrl;
+        }
+
+        var permissionNodes = config.doc.findall('permission');
+
+        if (permissionNodes.length) {
+            manifest.permissions = manifest.permissions || {};
+
+            permissionNodes.forEach(function(node) {
+                var permissionName = node.attrib['name'];
+
+                // Don't change if it was already created
+                if (!manifest.permissions[permissionName]) {
+                    manifest.permissions[permissionName] = {
+                        description: node.attrib['description']
+                    };
+
+                    if (node.attrib['access']) {
+                        manifest.permissions[permissionName].access = node.attrib['access'];
+                    }
+                }
+            });
+        }
+
+        fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 4));
 
         return Q();
     },
@@ -126,10 +131,10 @@ module.exports.prototype = {
 
     // Returns a promise.
     update_project: function(cfg) {
-        return this.update_from_config(cfg)
-        .then(function(){
-            this.update_overrides();
-            util.deleteSvnFolders(this.www_dir());
-        }.bind(this));
+        return this.update_from_config()
+            .then(function(){
+                this.update_overrides();
+                util.deleteSvnFolders(this.www_dir());
+            }.bind(this));
     }
 };