Removed unnecessary manifest creation from browser_parser
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/37f8ef3e Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/37f8ef3e Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/37f8ef3e Branch: refs/heads/cb-7219 Commit: 37f8ef3e7f411908b15ea2acbc8ebd024b14cb66 Parents: 3aef160 Author: Suraj Pindoria <[email protected]> Authored: Thu Sep 11 15:18:34 2014 -0700 Committer: Suraj Pindoria <[email protected]> Committed: Thu Sep 11 15:18:34 2014 -0700 ---------------------------------------------------------------------- .../src/cordova/metadata/browser_parser.js | 112 +------------------ 1 file changed, 1 insertion(+), 111 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/37f8ef3e/cordova-lib/src/cordova/metadata/browser_parser.js ---------------------------------------------------------------------- diff --git a/cordova-lib/src/cordova/metadata/browser_parser.js b/cordova-lib/src/cordova/metadata/browser_parser.js index 25fc644..bb89b91 100644 --- a/cordova-lib/src/cordova/metadata/browser_parser.js +++ b/cordova-lib/src/cordova/metadata/browser_parser.js @@ -25,10 +25,8 @@ var fs = require('fs'), path = require('path'), shell = require('shelljs'), - events = require('../../events'), util = require('../util'), - Q = require('q'), - ConfigParser = require('../../configparser/ConfigParser'); + Q = require('q'); module.exports = function browser_parser(project) { this.path = project; @@ -38,114 +36,6 @@ module.exports = function browser_parser(project) { module.exports.prototype = { // Returns a promise. update_from_config: function() { - var config = new ConfigParser(this.config_xml()); - var manifestPath = path.join(this.www_dir(), 'manifest.webapp'); - var manifest = {}; - - // Load existing manifest - if (fs.existsSync(manifestPath)) { - manifest = JSON.parse(fs.readFileSync(manifestPath)); - } - - // overwrite properties existing in config.xml - var contentNode = config.doc.find('content'); - var contentSrc = contentNode.attrib['src']; - manifest.launch_path = path.join('/', contentSrc) || '/index.html'; - - manifest.installs_allowed_from = manifest.installs_allowed_from || ['*']; - manifest.version = config.version(); - manifest.name = config.name(); - 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 fullScreen = config.getPreference('fullscreen'); - - if (fullScreen) { - manifest.fullscreen = fullScreen; - } - - var orientations = []; - var preferenceNodes = config.doc.findall('preference'); - preferenceNodes.forEach(function (preference) { - if (preference.attrib.name.toLowerCase() === 'orientation') { - orientations.push(preference.attrib.value); - } - }); - - if (orientations && orientations.length) { - manifest.orientation = orientations; - } - - var permissionNodes = config.doc.findall('permission'); - var privileged = false; - - if (permissionNodes.length) { - manifest.permissions = {}; - - permissionNodes.forEach(function(node) { - var permissionName = node.attrib['name']; - - manifest.permissions[permissionName] = { - description: node.attrib['description'] - }; - - if (node.attrib['access']) { - manifest.permissions[permissionName].access = node.attrib['access']; - } - - if (node.attrib['privileged'] === 'true') { - privileged = true; - } - }); - } - - if (privileged) { - manifest.type = 'privileged'; - } else { - delete manifest.type; - } - - var icons = config.getIcons('browser'); - // if there are icon elements in config.xml - if (icons) { - manifest.icons = {}; - for (var i = 0; i < icons.length; i++) { - var icon = icons[i]; - var size = icon.width; - var sizeInt = parseInt(size); - - events.emit('verbose', 'icon[' + i + ']:' + JSON.stringify(icon)); - - if (size && !isNaN(sizeInt)) { - if (icon.src) { - var destfilepath = path.join(this.www_dir(), 'icon', 'icon-' + size + '.png'); - - manifest.icons[sizeInt] = '/icon/icon-' + size + '.png'; - - if (!fs.existsSync(icon.src)) { - events.emit('verbose', 'ignoring icon[' + i + '] icon. File ' + icon.src + ' not found.'); - } else { - events.emit('verbose', 'Copying icon from ' + icon.src + ' to ' + destfilepath); - shell.cp('-f', icon.src, destfilepath); - } - } else { - events.emit('warn', 'ignoring icon[' + i + '] no src attribute:' + JSON.stringify(icon)); - } - } - } - } - - fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 4)); - return Q(); },
