Repository: cordova-lib Updated Branches: refs/heads/master a3d76a35a -> 41bc8dafa
CB-12645 : removed references to firefoxos This closes #540 Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/41bc8daf Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/41bc8daf Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/41bc8daf Branch: refs/heads/master Commit: 41bc8dafa928855a690c70e0b950dc72f37ac9fc Parents: a3d76a3 Author: Audrey So <[email protected]> Authored: Fri Apr 7 10:04:49 2017 -0700 Committer: Steve Gill <[email protected]> Committed: Wed Apr 19 11:45:24 2017 -0700 ---------------------------------------------------------------------- .../metadata/firefoxos_parser.spec.js | 145 ----------- cordova-lib/spec-cordova/prepare.spec.js | 2 - cordova-lib/spec-cordova/serve.spec.js | 27 -- .../src/cordova/metadata/firefoxos_parser.js | 248 ------------------- cordova-lib/src/platforms/platformsConfig.json | 7 - cordova-lib/src/plugman/platforms/firefoxos.js | 76 ------ 6 files changed, 505 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/41bc8daf/cordova-lib/spec-cordova/metadata/firefoxos_parser.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/metadata/firefoxos_parser.spec.js b/cordova-lib/spec-cordova/metadata/firefoxos_parser.spec.js deleted file mode 100644 index ea09574..0000000 --- a/cordova-lib/spec-cordova/metadata/firefoxos_parser.spec.js +++ /dev/null @@ -1,145 +0,0 @@ -/** - 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. -*/ - -/* jshint boss:true */ - -var firefoxosParser = require('../../src/cordova/metadata/firefoxos_parser'), - util = require('../../src/cordova/util'), - path = require('path'), - shell = require('shelljs'), - fs = require('fs'), - _ = require('underscore'), - config = require('../../src/cordova/config'), - Parser = require('../../src/cordova/metadata/parser'), - ConfigParser = require('cordova-common').ConfigParser, - CordovaError = require('cordova-common').CordovaError; - -var cfg = new ConfigParser(path.join(__dirname, '..', 'test-config.xml')); - -var MANIFEST_JSON = { - 'launch_path': '/index.html', 'installs_allowed_from': [ '*' ], 'version': '0.0.1', 'name': 'HelloCordova', - 'description': 'A sample Apache Cordova application that responds to the deviceready event.', - 'developer': { 'name': 'Apache Cordova Team', 'url': 'http://cordova.io' }, - 'orientation': [ 'portrait' ], 'icons': { '60': '/icon/icon-60.png', '128': '/icon/icon-128.png' } -}; - -describe('firefoxos project parser', function() { - var proj = path.join('some', 'path'); - var exists, exec, custom; - beforeEach(function() { - exists = spyOn(fs, 'existsSync').and.returnValue(true); - exec = spyOn(shell, 'exec').and.callFake(function(cmd, opts, cb) { - cb(0, ''); - }); - custom = spyOn(config, 'has_custom_path').and.returnValue(false); - }); - - describe('constructions', function() { - it('should create an instance with a path', function() { - expect(function() { - var p = new firefoxosParser(proj); - expect(p.path).toEqual(proj); - expect(p.config_path).toEqual(path.join(proj, 'config.xml')); - expect(p.manifest_path).toEqual(path.join(p.www_dir(), 'manifest.webapp')); - }).not.toThrow(); - }); - it('should be an instance of Parser', function() { - expect(new firefoxosParser(proj) instanceof Parser).toBe(true); - }); - it('should call super with the correct arguments', function() { - var call = spyOn(Parser, 'call'); - var p = new firefoxosParser(proj); - expect(call).toHaveBeenCalledWith(p, 'firefoxos', proj); - }); - }); - - describe('instance', function() { - var p, cp, rm, is_cordova, write, read, getOrientation; - var ff_proj = path.join(proj, 'platforms', 'firefoxos'); - var manifestJson = null; - beforeEach(function() { - p = new firefoxosParser(ff_proj); - cp = spyOn(shell, 'cp'); - rm = spyOn(shell, 'rm'); - is_cordova = spyOn(util, 'isCordova').and.returnValue(proj); - write = spyOn(fs, 'writeFileSync'); - read = spyOn(fs, 'readFileSync'); - - spyOn(JSON, 'parse').and.callFake(function (path) { - if (/manifest.webapp$/.exec(path)) { - return manifestJson = _.extend({}, MANIFEST_JSON); - } else { - throw new CordovaError('Unexpected JSON.parse(): ' + path); - } - }); - getOrientation = spyOn(p.helper, 'getOrientation'); - }); - - describe('update_from_config method', function() { - beforeEach(function() { - cfg.name = function() { return 'testname'; }; - cfg.packageName = function() { return 'testpkg'; }; - cfg.version = function() { return '1.0'; }; - read.and.returnValue(p.manifest_path); - }); - it('should write manifest.webapp', function() { - p.update_from_config(cfg); - expect(write.calls.mostRecent().args[0]).toEqual(p.manifest_path); - }); - it('should write out the orientation preference value', function() { - getOrientation.and.callThrough(); - p.update_from_config(cfg); - expect(manifestJson.orientation).toEqual([ 'portrait' ]); - }); - it('should handle no orientation', function () { - getOrientation.and.returnValue(''); - p.update_from_config(cfg); - expect(manifestJson.orientation).toBeUndefined(); - }); - it('should handle default orientation', function () { - getOrientation.and.returnValue(p.helper.ORIENTATION_DEFAULT); - p.update_from_config(cfg); - expect(manifestJson.orientation).toBeUndefined(); - }); - it('should handle portrait orientation', function () { - getOrientation.and.returnValue(p.helper.ORIENTATION_PORTRAIT); - p.update_from_config(cfg); - expect(manifestJson.orientation).toEqual([ 'portrait' ]); - }); - it('should handle landscape orientation', function () { - getOrientation.and.returnValue(p.helper.ORIENTATION_LANDSCAPE); - p.update_from_config(cfg); - expect(manifestJson.orientation).toEqual([ 'landscape' ]); - }); - it('should handle custom orientation', function () { - getOrientation.and.returnValue('some-custom-orientation'); - p.update_from_config(cfg); - expect(manifestJson.orientation).toEqual([ 'some-custom-orientation' ]); - }); - - }); - - describe('www_dir method', function() { - it('should return www assets dir', function() { - expect(p.www_dir()).toEqual(path.join(ff_proj, 'www')); - }); - }); - - }); -}); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/41bc8daf/cordova-lib/spec-cordova/prepare.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/prepare.spec.js b/cordova-lib/spec-cordova/prepare.spec.js index c9b0911..4f75eb1 100644 --- a/cordova-lib/spec-cordova/prepare.spec.js +++ b/cordova-lib/spec-cordova/prepare.spec.js @@ -145,7 +145,6 @@ describe('prepare command', function() { 'ubuntu', 'wp8', 'blackberry10', - 'firefoxos', 'windows', 'webos', 'browser' ], @@ -159,7 +158,6 @@ describe('prepare command', function() { path.join('/','some','path','platforms','ubuntu','www'), path.join('/','some','path','platforms','wp8','www'), path.join('/','some','path','platforms','blackberry10','www'), - path.join('/','some','path','platforms','firefoxos','www'), path.join('/','some','path','platforms','windows','www'), path.join('/','some','path','platforms','webos','www'), path.join('/','some','path','platforms','browser','www') ], http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/41bc8daf/cordova-lib/spec-cordova/serve.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/serve.spec.js b/cordova-lib/spec-cordova/serve.spec.js index 8bbe2b6..0ec5e02 100644 --- a/cordova-lib/spec-cordova/serve.spec.js +++ b/cordova-lib/spec-cordova/serve.spec.js @@ -26,7 +26,6 @@ var cordova = require('../src/cordova/cordova'), shell = require('shelljs'), fs = require('fs'), Q = require('q'), - util = require('../src/cordova/util'), tempDir, http = require('http'); @@ -164,27 +163,6 @@ xdescribe('serve command', function() { }; } - it('Test 002 : should serve from top-level www if the file exists there', function() { - var payload = 'This is test file.'; - payloads.firefoxos = 'This is the firefoxos test file.'; - test_serve('firefoxos', '/basictest.html', payload, { - setup: function (){ - fs.writeFileSync(path.join(util.projectWww(tempDir), 'basictest.html'), payload); - } - })(); - }); - - it('Test 003 : should honour a custom port setting', function() { - var payload = 'This is test file.'; - payloads.firefoxos = 'This is the firefoxos test file.'; - test_serve('firefoxos', '/basictest.html', payload, { - port: 9001, - setup: function (){ - fs.writeFileSync(path.join(util.projectWww(tempDir), 'basictest.html'), payload); - } - })(); - }); - itifapps([ 'android', 'ant', @@ -209,11 +187,6 @@ xdescribe('serve command', function() { payloads.ios = 'This is the iOS test file.'; test_serve('ios', '/test.html', payloads.ios, {timeout: 10000})(); }); - - it('Test 004 : should fall back to www on firefoxos', function() { - payloads.firefoxos = 'This is the firefoxos test file.'; - test_serve('firefoxos', '/test.html', payloads.firefoxos)(); - }); }); }); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/41bc8daf/cordova-lib/src/cordova/metadata/firefoxos_parser.js ---------------------------------------------------------------------- diff --git a/cordova-lib/src/cordova/metadata/firefoxos_parser.js b/cordova-lib/src/cordova/metadata/firefoxos_parser.js deleted file mode 100644 index c71796b..0000000 --- a/cordova-lib/src/cordova/metadata/firefoxos_parser.js +++ /dev/null @@ -1,248 +0,0 @@ -/** - 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. -*/ - -/* jshint sub:true */ - -var fs = require('fs'), - path = require('path'), - shell = require('shelljs'), - events = require('cordova-common').events, - util = require('../util'), - Q = require('q'), - Parser = require('./parser'), - ConfigParser = require('cordova-common').ConfigParser; - -function firefoxos_parser(project) { - - // Call the base class constructor - Parser.call(this, 'firefoxos', project); - - this.path = project; - this.config_path = path.join(project, 'config.xml'); - this.manifest_path = path.join(this.www_dir(), 'manifest.webapp'); -} - -require('util').inherits(firefoxos_parser, Parser); - -module.exports = firefoxos_parser; - -// Returns a promise. -firefoxos_parser.prototype.update_from_config = function(config) { - - if (!(config instanceof ConfigParser)) { - return Q.reject(new Error('update_from_config requires a ConfigParser object')); - } - - var manifest = {}; - - // Load existing manifest - if (fs.existsSync(this.manifest_path)) { - manifest = JSON.parse(fs.readFileSync(this.manifest_path)); - } - - // overwrite properties existing in config.xml - var contentNode = config.doc.find('content'); - var contentSrc = contentNode && contentNode.attrib['src'] || 'index.html'; - manifest.launch_path = '/' + contentSrc; - - 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 && authorNode.attrib['href']; - - if (authorUrl) { - manifest.developer.url = authorUrl; - } - - var fullScreen = config.getPreference('fullscreen'); - - if (fullScreen) { - manifest.fullscreen = fullScreen; - } - - var activitiesNodes = config.doc.findall('activities'); - activitiesNodes.forEach(function(activitiesNode) { - var activityNodes = activitiesNode.findall('activity'); - if (activityNodes.length) { - var activities = {}; - activityNodes.forEach(function (node) { - var name = node.attrib.name; - var href = node.attrib.href; - if (name && href) { - events.emit('verbose', 'activity name='+name+' href='+href); - activities[name] = {}; - activities[name].href = href; - var returnValue = node.attrib.returnValue; - if (returnValue) { - activities[name].returnValue = returnValue; - } - var disposition = node.attrib.disposition; - if (disposition) { - activities[name].disposition = disposition; - } - activities[name].filters = {}; - var filterNodes = node.findall('filter'); - filterNodes.forEach(function(filter) { - var url = filter.attrib.url; - if (url) { - activities[name].filters.url = url; - } - var type = filter.attrib.type; - if (type) { - activities[name].filters.type = type; - } - }); - } else { - events.emit('warn', 'activity without name='+name+'or href='+href); - } - }); - manifest.activities = activities; - } - }); - - // Set orientation preference - var orientation = this.helper.getOrientation(config); - - if (orientation && !this.helper.isDefaultOrientation(orientation)) { - manifest.orientation = [ orientation ]; - } else { - delete manifest.orientation; - } - - 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('firefoxos'); - // 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(this.manifest_path, JSON.stringify(manifest, null, 4)); - - return Q(); -}; - -firefoxos_parser.prototype.www_dir = function() { - return path.join(this.path, 'www'); -}; - -// Used for creating platform_www in projects created by older versions. -firefoxos_parser.prototype.cordovajs_path = function(libDir) { - var jsPath = path.join(libDir, 'cordova-lib', 'cordova.js'); - return path.resolve(jsPath); -}; - -firefoxos_parser.prototype.cordovajs_src_path = function(libDir) { - var jsPath = path.join(libDir, 'cordova-js-src'); - return path.resolve(jsPath); -}; - -// Replace the www dir with contents of platform_www and app www. -firefoxos_parser.prototype.update_www = function() { - var projectRoot = util.isCordova(this.path); - var app_www = util.projectWww(projectRoot); - var platform_www = path.join(this.path, 'platform_www'); - - // Clear the www dir - shell.rm('-rf', this.www_dir()); - shell.mkdir(this.www_dir()); - // Copy over all app www assets - shell.cp('-rf', path.join(app_www, '*'), this.www_dir()); - // Copy over stock platform www assets (cordova.js) - shell.cp('-rf', path.join(platform_www, '*'), this.www_dir()); -}; - -firefoxos_parser.prototype.update_overrides = function() { - var projectRoot = util.isCordova(this.path); - var mergesPath = path.join(util.appDir(projectRoot), 'merges', 'firefoxos'); - if(fs.existsSync(mergesPath)) { - var overrides = path.join(mergesPath, '*'); - shell.cp('-rf', overrides, this.www_dir()); - } -}; - -firefoxos_parser.prototype.config_xml = function(){ - return this.config_path; -}; - -// Returns a promise. -firefoxos_parser.prototype.update_project = function(cfg) { - return this.update_from_config(cfg) - .then(function(){ - this.update_overrides(); - util.deleteSvnFolders(this.www_dir()); - }.bind(this)); -}; http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/41bc8daf/cordova-lib/src/platforms/platformsConfig.json ---------------------------------------------------------------------- diff --git a/cordova-lib/src/platforms/platformsConfig.json b/cordova-lib/src/platforms/platformsConfig.json index a31acf8..18a4159 100644 --- a/cordova-lib/src/platforms/platformsConfig.json +++ b/cordova-lib/src/platforms/platformsConfig.json @@ -56,13 +56,6 @@ "version": "~3.10.0", "deprecated": false }, - "firefoxos": { - "parser_file": "../cordova/metadata/firefoxos_parser", - "handler_file": "../plugman/platforms/firefoxos", - "url": "https://git-wip-us.apache.org/repos/asf?p=cordova-firefoxos.git", - "version": "~3.6.3", - "deprecated": false - }, "windows": { "hostos": ["win32"], "parser_file": "../cordova/metadata/windows_parser", http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/41bc8daf/cordova-lib/src/plugman/platforms/firefoxos.js ---------------------------------------------------------------------- diff --git a/cordova-lib/src/plugman/platforms/firefoxos.js b/cordova-lib/src/plugman/platforms/firefoxos.js deleted file mode 100644 index 1289d13..0000000 --- a/cordova-lib/src/plugman/platforms/firefoxos.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - 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. -*/ - -/* jshint laxcomma:true, sub:true */ - -var path = require('path') - , common = require('./common') - , events = require('cordova-common').events - ; - -module.exports = { - www_dir: function(project_dir) { - return path.join(project_dir, 'www'); - }, - package_name:function(project_dir) { - return common.package_name(project_dir, this.www_dir(project_dir)); - }, - 'source-file':{ - install:function(obj, plugin_dir, project_dir, plugin_id, options) { - var dest = path.join(obj.targetDir, path.basename(obj.src)); - common.copyFile(plugin_dir, obj.src, project_dir, dest); - }, - uninstall:function(obj, project_dir, plugin_id, options) { - var dest = path.join(obj.targetDir, path.basename(obj.src)); - common.removeFile(project_dir, dest); - } - }, - 'header-file': { - install:function(obj, plugin_dir, project_dir, plugin_id, options) { - events.emit('verbose', 'header-fileinstall is not supported for firefoxos'); - }, - uninstall:function(obj, project_dir, plugin_id, options) { - events.emit('verbose', 'header-file.uninstall is not supported for firefoxos'); - } - }, - 'resource-file':{ - install:function(obj, plugin_dir, project_dir, plugin_id, options) { - events.emit('verbose', 'resource-file.install is not supported for firefoxos'); - }, - uninstall:function(obj, project_dir, plugin_id, options) { - events.emit('verbose', 'resource-file.uninstall is not supported for firefoxos'); - } - }, - 'framework': { - install:function(obj, plugin_dir, project_dir, plugin_id, options) { - events.emit('verbose', 'framework.install is not supported for firefoxos'); - }, - uninstall:function(obj, project_dir, plugin_id, options) { - events.emit('verbose', 'framework.uninstall is not supported for firefoxos'); - } - }, - 'lib-file': { - install:function(obj, plugin_dir, project_dir, plugin_id, options) { - events.emit('verbose', 'lib-file.install is not supported for firefoxos'); - }, - uninstall:function(obj, project_dir, plugin_id, options) { - events.emit('verbose', 'lib-file.uninstall is not supported for firefoxos'); - } - } -}; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
