You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2017/12/14 06:21:07 UTC
[cordova-lib] 01/06: CB-13056 : removed parsers and platformApi
polyfill for webos, blackberry10, and ubuntu
This is an automated email from the ASF dual-hosted git repository.
steven pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git
commit f86b408e2495a68d4c13122d4fe7a426f22ee1e2
Author: Audrey So <au...@apache.org>
AuthorDate: Tue Aug 1 15:59:07 2017 -0700
CB-13056 : removed parsers and platformApi polyfill for webos, blackberry10, and ubuntu
---
spec/cordova/metadata/blackberry_parser.spec.js | 230 ------------------------
spec/cordova/metadata/webos_parser.spec.js | 84 ---------
spec/cordova/platform/addHelper.spec.js | 7 -
spec/plugman/platforms/blackberry10.spec.js | 147 ---------------
src/cordova/metadata/blackberry10_parser.js | 146 ---------------
src/cordova/metadata/ubuntu_parser.js | 151 ----------------
src/cordova/metadata/webos_parser.js | 203 ---------------------
src/cordova/platform/addHelper.js | 4 -
src/platforms/platformsConfig.json | 22 ---
src/plugman/platforms/blackberry10.js | 93 ----------
10 files changed, 1087 deletions(-)
diff --git a/spec/cordova/metadata/blackberry_parser.spec.js b/spec/cordova/metadata/blackberry_parser.spec.js
deleted file mode 100644
index 6bb0bf9..0000000
--- a/spec/cordova/metadata/blackberry_parser.spec.js
+++ /dev/null
@@ -1,230 +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.
-*/
-
-var blackberryParser = require('../../../src/cordova/metadata/blackberry10_parser');
-var util = require('../../../src/cordova/util');
-var path = require('path');
-var shell = require('shelljs');
-var fs = require('fs');
-var et = require('elementtree');
-var xmlHelpers = require('cordova-common').xmlHelpers;
-var config = require('../../../src/cordova/config');
-var Parser = require('../../../src/cordova/metadata/parser');
-var ConfigParser = require('cordova-common').ConfigParser;
-
-var cfg = new ConfigParser(path.join(__dirname, '..', 'test-config.xml'));
-
-var TEST_XML = '<?xml version="1.0" encoding="UTF-8"?>\n' +
- '<widget xmlns = "http://www.w3.org/ns/widgets"\n' +
- ' xmlns:cdv = "http://cordova.apache.org/ns/1.0"\n' +
- ' id = "io.cordova.hellocordova"\n' +
- ' version = "0.0.1">\n' +
- ' <name>Hello Cordova</name>\n' +
- ' <description>\n' +
- ' A sample Apache Cordova application that responds to the deviceready event.\n' +
- ' </description>\n' +
- ' <author href="http://cordova.io" email="dev@cordova.apache.org">\n' +
- ' Apache Cordova Team\n' +
- ' </author>\n' +
- ' <content src="index.html" />\n' +
- ' <access origin="*" />\n' +
- ' <preference name="fullscreen" value="true" />\n' +
- ' <preference name="webviewbounce" value="true" />\n' +
- '</widget>\n';
-
-describe('blackberry10 project parser', function () {
- var proj = '/some/path';
- var exists;
- var custom; // eslint-disable-line no-unused-vars
- beforeEach(function () {
- exists = spyOn(fs, 'existsSync').and.returnValue(true);
- custom = spyOn(config, 'has_custom_path').and.returnValue(false);
- spyOn(ConfigParser.prototype, 'write');
- spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function () {
- return new et.ElementTree(et.XML(TEST_XML));
- });
- });
-
- function wrapper (p, done, post) {
- p.then(post, function (err) {
- expect(err).toBeUndefined();
- }).fin(done);
- }
-
- function errorWrapper (p, done, post) {
- p.then(function () {
- expect('this call').toBe('fail');
- }, post).fin(done);
- }
-
- describe('constructions', function () {
- it('should throw an exception with a path that is not a native blackberry project', function () {
- exists.and.returnValue(false);
- expect(function () {
- new blackberryParser(proj); // eslint-disable-line
- }).toThrow();
- });
- it('should accept a proper native blackberry project path as construction parameter', function () {
- var project;
- expect(function () {
- project = new blackberryParser(proj); // eslint-disable-line
- }).not.toThrow();
- expect(project).toBeDefined();
- });
- it('should be an instance of Parser', function () {
- expect(new blackberryParser(proj) instanceof Parser).toBe(true); // eslint-disable-line
- });
- it('should call super with the correct arguments', function () {
- var call = spyOn(Parser, 'call');
- var p = new blackberryParser(proj); // eslint-disable-line
- expect(call).toHaveBeenCalledWith(p, 'blackberry10', proj);
- });
- });
-
- describe('instance', function () {
- /* eslint-disable no-unused-vars */
- var p;
- var cp;
- var rm;
- var mkdir;
- var is_cordova;
- var write;
- var read;
- var bb_proj = path.join(proj, 'platforms', 'blackberry10');
- /* eslint-enable no-unused-vars */
- beforeEach(function () {
- p = new blackberryParser(bb_proj); // eslint-disable-line
- cp = spyOn(shell, 'cp');
- rm = spyOn(shell, 'rm');
- mkdir = spyOn(shell, 'mkdir');
- is_cordova = spyOn(util, 'isCordova').and.returnValue(proj);
- write = spyOn(fs, 'writeFileSync');
- read = spyOn(fs, 'readFileSync');
- });
-
- describe('update_from_config method', function () {
- var xml_name, xml_pkg, xml_version, xml_access_rm, xml_update,
- xml_append, xml_content, xml_access_add, xml_preference_remove,
- xml_preference_add;
- beforeEach(function () {
- xml_content = jasmine.createSpy('xml content');
- xml_name = jasmine.createSpy('xml name');
- xml_pkg = jasmine.createSpy('xml pkg');
- xml_version = jasmine.createSpy('xml version');
- xml_access_rm = jasmine.createSpy('xml access rm');
- xml_access_add = jasmine.createSpy('xml access add');
- xml_update = jasmine.createSpy('xml update');
- xml_append = jasmine.createSpy('xml append');
- xml_preference_remove = jasmine.createSpy('xml preference rm');
- xml_preference_add = jasmine.createSpy('xml preference add');
- p.xml.name = xml_name;
- p.xml.packageName = xml_pkg;
- p.xml.version = xml_version;
- p.xml.content = xml_content;
- p.xml.access = {
- remove: xml_access_rm,
- add: xml_access_add
- };
- p.xml.update = xml_update;
- p.xml.doc = {
- getroot: function () { return { append: xml_append }; }
- };
- p.xml.preference = {
- add: xml_preference_add,
- remove: xml_preference_remove
- };
- cfg.name = function () { return 'testname'; };
- cfg.packageName = function () { return 'testpkg'; };
- cfg.version = function () { return 'one point oh'; };
- });
- });
- describe('www_dir method', function () {
- it('should return /www', function () {
- expect(p.www_dir()).toEqual(path.join(bb_proj, 'www'));
- });
- });
- describe('config_xml method', function () {
- it('should return the location of the config.xml', function () {
- expect(p.config_xml()).toEqual(path.join(proj, 'platforms', 'blackberry10', 'www', 'config.xml'));
- });
- });
- describe('update_www method', function () {
-
- it('should rm project-level www and cp in platform agnostic www', function () {
- p.update_www();
- expect(rm).toHaveBeenCalled();
- expect(cp).toHaveBeenCalled();
- });
- });
- describe('update_overrides method', function () {
- it('should do nothing if merges directory does not exist', function () {
- exists.and.returnValue(false);
- p.update_overrides();
- expect(cp).not.toHaveBeenCalled();
- });
- it('should copy merges path into www', function () {
- p.update_overrides();
- expect(cp).toHaveBeenCalledWith('-rf', path.join(proj, 'merges', 'blackberry10', '*'), path.join(proj, 'platforms', 'blackberry10', 'www'));
- });
- });
- describe('update_project method', function () {
- /* eslint-disable no-unused-vars */
- var config;
- var www;
- var overrides;
- var svn;
- var parse;
- /* eslint-enable no-unused-vars */
- beforeEach(function () {
- config = spyOn(p, 'update_from_config');
- www = spyOn(p, 'update_www');
- overrides = spyOn(p, 'update_overrides');
- svn = spyOn(util, 'deleteSvnFolders');
- parse = spyOn(JSON, 'parse').and.returnValue({blackberry: {qnx: {}}});
- });
- it('should call update_from_config', function (done) {
- wrapper(p.update_project(), done, function () {
- expect(config).toHaveBeenCalled();
- });
- });
- it('should throw if update_from_config throws', function (done) {
- var err = new Error('uh oh!');
- config.and.callFake(function () { throw err; });
- errorWrapper(p.update_project({}), done, function (e) {
- expect(e).toEqual(err);
- });
- });
- it('should not call update_www', function (done) {
- wrapper(p.update_project(), done, function () {
- expect(www).not.toHaveBeenCalled();
- });
- });
- it('should call update_overrides', function (done) {
- wrapper(p.update_project(), done, function () {
- expect(overrides).toHaveBeenCalled();
- });
- });
- it('should call deleteSvnFolders', function (done) {
- wrapper(p.update_project(), done, function () {
- expect(svn).toHaveBeenCalled();
- });
- });
- });
- });
-});
diff --git a/spec/cordova/metadata/webos_parser.spec.js b/spec/cordova/metadata/webos_parser.spec.js
deleted file mode 100755
index 9367132..0000000
--- a/spec/cordova/metadata/webos_parser.spec.js
+++ /dev/null
@@ -1,84 +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.
-*/
-var webosParser = require('../../../src/cordova/metadata/webos_parser');
-var util = require('../../../src/cordova/util');
-var path = require('path');
-var shell = require('shelljs');
-var fs = require('fs');
-var config = require('../../../src/cordova/config');
-var ConfigParser = require('cordova-common').ConfigParser;
-
-var cfg = new ConfigParser(path.join(__dirname, '..', 'test-config.xml'));
-describe('webos project parser', function () {
- var proj = path.join('some', 'path');
- /* eslint-disable no-unused-vars */
- var exists;
- var exec;
- var custom;
- /* eslint-enable no-unused-vars */
- beforeEach(function () {
- exists = spyOn(fs, 'existsSync').and.returnValue(true);
- exec = spyOn(shell, 'exec').and.callFake(function (cmd, opts, cb) {
- cb(0, ''); // eslint-disable-line standard/no-callback-literal
- });
- 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 webosParser(proj); // eslint-disable-line new-cap
- expect(p.path).toEqual(proj);
- }).not.toThrow();
- });
- });
-
- describe('instance', function () {
- /* eslint-disable no-unused-vars */
- var p;
- var cp;
- var rm;
- var is_cordova;
- var write;
- var read;
- /* eslint-enable no-unused-vars */
- var wos_proj = path.join(proj, 'platforms', 'webos');
- beforeEach(function () {
- p = new webosParser(wos_proj); // eslint-disable-line new-cap
- cp = spyOn(shell, 'cp');
- rm = spyOn(shell, 'rm');
- is_cordova = spyOn(util, 'isCordova').and.returnValue(proj);
- write = spyOn(fs, 'writeFileSync');
- read = spyOn(fs, 'readFileSync').and.returnValue('');
- });
-
- describe('update_from_config method', function () {
- beforeEach(function () {
- cfg.name = function () { return 'testname'; };
- cfg.packageName = function () { return 'testpkg'; };
- cfg.version = function () { return '1.0'; };
- });
-
- /* it('should write appinfo.json', function() {
- //p.update_from_config(cfg);
- //expect(write.mostRecentCall.args[0]).toEqual('appinfo.json');
- }); */
- });
- });
-});
diff --git a/spec/cordova/platform/addHelper.spec.js b/spec/cordova/platform/addHelper.spec.js
index 7a48c95..a2eb6e6 100644
--- a/spec/cordova/platform/addHelper.spec.js
+++ b/spec/cordova/platform/addHelper.spec.js
@@ -138,13 +138,6 @@ describe('cordova/platform/addHelper', function () {
expect(hooks_mock.fire).toHaveBeenCalledWith('before_platform_add', jasmine.any(Object));
});
- it('should warn about using deprecated platforms', function (done) {
- platform_addHelper('add', hooks_mock, projectRoot, ['ubuntu', 'blackberry10']);
- process.nextTick(function () {
- expect(events.emit).toHaveBeenCalledWith(jasmine.stringMatching(/has been deprecated/));
- done();
- });
- });
describe('platform spec inference', function () {
it('should retrieve platform details from directories-specified-as-platforms using getPlatformDetailsFromDir', function (done) {
cordova_util.isDirectory.and.returnValue(true);
diff --git a/spec/plugman/platforms/blackberry10.spec.js b/spec/plugman/platforms/blackberry10.spec.js
deleted file mode 100644
index d819d8e..0000000
--- a/spec/plugman/platforms/blackberry10.spec.js
+++ /dev/null
@@ -1,147 +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.
-*/
-var blackberry10 = require('../../../src/plugman/platforms/blackberry10');
-var common = require('../../../src/plugman/platforms/common');
-var path = require('path');
-var fs = require('fs');
-var shell = require('shelljs');
-var os = require('os');
-var temp = path.join(os.tmpdir(), 'plugman');
-var blackberry10_project = path.join(__dirname, '..', 'projects', 'blackberry10', '*');
-var PluginInfo = require('cordova-common').PluginInfo;
-
-var plugins = {
- dummy: new PluginInfo(path.join(__dirname, '..', 'plugins', 'org.test.plugins.dummyplugin')),
- faulty: new PluginInfo(path.join(__dirname, '..', 'plugins', 'org.test.plugins.faultyplugin')),
- echo: new PluginInfo(path.join(__dirname, '..', 'plugins', 'com.cordova.echo'))
-};
-
-function copyArray (arr) {
- return Array.prototype.slice.call(arr, 0);
-}
-
-describe('blackberry10 project handler', function () {
- describe('www_dir method', function () {
- it('Test 001 : should return cordova-blackberry10 project www location using www_dir', function () {
- expect(blackberry10.www_dir(path.sep)).toEqual(path.sep + 'www');
- });
- });
-
- describe('package_name method', function () {
- it('Test 002 : should return a blackberry10 project\'s proper package name', function () {
- expect(blackberry10.package_name(path.join(blackberry10_project, '..'))).toEqual('cordovaExample');
- });
- });
-
- describe('installation', function () {
- beforeEach(function () {
- shell.mkdir('-p', temp);
- shell.cp('-rf', blackberry10_project, temp);
- });
- afterEach(function () {
- shell.rm('-rf', temp);
- });
- describe('of <lib-file> elements', function () {
- it('Test 003 : should copy so files to native/target/plugins', function () {
- var plugin = plugins.echo;
- var libs = copyArray(plugin.getLibFiles('blackberry10'));
- var s = spyOn(common, 'copyFile');
-
- blackberry10['lib-file'].install(libs[0], plugin.dir, temp);
- expect(s).toHaveBeenCalledWith(plugin.dir, 'src/blackberry10/native/device/echoJnext.so', temp, path.join('native', 'device', 'plugins', 'jnext', 'echoJnext.so'), false);
- });
- });
- describe('of <source-file> elements', function () {
- it('Test 004 : should copy stuff from one location to another by calling common.copyFile', function () {
- var plugin = plugins.echo;
- var source = copyArray(plugin.getSourceFiles('blackberry10'));
- var s = spyOn(common, 'copyFile');
-
- blackberry10['source-file'].install(source[0], plugin.dir, temp, plugin.id);
- expect(s).toHaveBeenCalledWith(plugin.dir, 'src/blackberry10/index.js', temp, path.join('native', 'device', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'), false);
- expect(s).toHaveBeenCalledWith(plugin.dir, 'src/blackberry10/index.js', temp, path.join('native', 'simulator', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'), false);
- });
- it('Test 005 : defaults to plugin id when dest is not present', function () {
- var source = copyArray(plugins.dummy.getSourceFiles('blackberry10'));
- var s = spyOn(common, 'copyFile');
- blackberry10['source-file'].install(source[0], plugins.dummy.dir, temp, plugins.dummy.id);
- expect(s).toHaveBeenCalledWith(plugins.dummy.dir, 'src/blackberry10/index.js', temp, path.join('native', 'device', 'chrome', 'plugin', plugins.dummy.id, 'index.js'), false);
- expect(s).toHaveBeenCalledWith(plugins.dummy.dir, 'src/blackberry10/index.js', temp, path.join('native', 'simulator', 'chrome', 'plugin', plugins.dummy.id, 'index.js'), false);
- });
- it('Test 006 : should throw if source file cannot be found', function () {
- var source = copyArray(plugins.faulty.getSourceFiles('blackberry10'));
- expect(function () {
- blackberry10['source-file'].install(source[0], plugins.faulty.dir, temp, plugins.faulty.id);
- }).toThrow(new Error('"' + path.resolve(plugins.faulty.dir, 'src/blackberry10/index.js') + '" not found!'));
- });
- it('Test 007 : should throw if target file already exists', function () {
- // write out a file
- var target = path.resolve(temp, 'native/device/chrome/plugin/org.test.plugins.dummyplugin');
- shell.mkdir('-p', target);
- target = path.join(target, 'index.js');
- fs.writeFileSync(target, 'some bs', 'utf-8');
-
- var source = copyArray(plugins.dummy.getSourceFiles('blackberry10'));
- expect(function () {
- blackberry10['source-file'].install(source[0], plugins.dummy.dir, temp, plugins.dummy.id);
- }).toThrow(new Error('"' + target + '" already exists!'));
- });
- });
- });
-
- describe('uninstallation', function () {
- beforeEach(function () {
- shell.mkdir('-p', temp);
- shell.cp('-rf', blackberry10_project, temp);
- });
- afterEach(function () {
- shell.rm('-rf', temp);
- });
- describe('of <source-file> elements', function () {
- it('Test 008 : should remove stuff by calling common.removeFile', function () {
- var s = spyOn(common, 'removeFile');
- var plugin = plugins.echo;
- var source = copyArray(plugin.getSourceFiles('blackberry10'));
- blackberry10['source-file'].install(source[0], plugin.dir, temp, plugin.id);
- blackberry10['source-file'].uninstall(source[0], temp, plugin.id);
- expect(s).toHaveBeenCalledWith(temp, path.join('native', 'device', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'));
- expect(s).toHaveBeenCalledWith(temp, path.join('native', 'simulator', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'));
- });
- it('Test 009 : should remove stuff by calling common.removeFile', function () {
- var s = spyOn(common, 'removeFile');
- var plugin = plugins.dummy;
- var source = copyArray(plugin.getSourceFiles('blackberry10'));
- blackberry10['source-file'].install(source[0], plugin.dir, temp, plugin.id);
- blackberry10['source-file'].uninstall(source[0], temp, plugin.id);
- expect(s).toHaveBeenCalledWith(temp, path.join('native', 'device', 'chrome', 'plugin', plugin.id, 'index.js'));
- expect(s).toHaveBeenCalledWith(temp, path.join('native', 'simulator', 'chrome', 'plugin', plugin.id, 'index.js'));
- });
- });
- describe('of <lib-file> elements', function () {
- it('Test 010 : should remove so files from www/plugins', function () {
- var s = spyOn(common, 'removeFile');
- var plugin = plugins.echo;
- var source = copyArray(plugin.getLibFiles('blackberry10'));
- blackberry10['lib-file'].install(source[0], plugin.dir, temp, plugin.id);
- blackberry10['lib-file'].uninstall(source[0], temp, plugin.id);
- expect(s).toHaveBeenCalledWith(temp, path.join('native', 'device', 'plugins', 'jnext', 'echoJnext.so'));
- });
- });
- });
-});
diff --git a/src/cordova/metadata/blackberry10_parser.js b/src/cordova/metadata/blackberry10_parser.js
deleted file mode 100644
index 0cb25b4..0000000
--- a/src/cordova/metadata/blackberry10_parser.js
+++ /dev/null
@@ -1,146 +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.
-*/
-
-var fs = require('fs');
-var path = require('path');
-var shell = require('shelljs');
-var util = require('../util');
-var Q = require('q');
-var Parser = require('./parser');
-var ConfigParser = require('cordova-common').ConfigParser;
-var CordovaError = require('cordova-common').CordovaError;
-var events = require('cordova-common').events;
-
-function blackberry_parser (project) {
- if (!fs.existsSync(path.join(project, 'www'))) {
- throw new CordovaError('The provided path "' + project + '" is not a Cordova BlackBerry10 project.');
- }
-
- // Call the base class constructor
- Parser.call(this, 'blackberry10', project);
-
- this.path = project;
- this.config_path = path.join(this.path, 'www', 'config.xml');
- this.xml = new ConfigParser(this.config_path);
-}
-
-require('util').inherits(blackberry_parser, Parser);
-
-module.exports = blackberry_parser;
-
-blackberry_parser.prototype.update_from_config = function (config) {
- var projectRoot = util.isCordova(this.path);
- var resDir = path.join(this.path, 'platform_www', 'res');
- var platform_www = path.join(this.path, 'platform_www');
- var icons;
- var splashscreens;
-
- var copyResources = function (resList) {
- for (var i = 0; i < resList.length; i++) {
- var src = path.join(projectRoot, resList[i].src);
- var dest = path.join(platform_www, resList[i].src);
- var destFolder = path.dirname(dest);
-
- if (!fs.existsSync(destFolder)) {
- shell.mkdir('-p', destFolder); // make sure target dir exists
- }
- events.emit('verbose', 'Copying resource from ' + src + ' to ' + dest);
- shell.cp('-f', src, dest);
- }
- };
-
- if (!(config instanceof ConfigParser)) {
- throw new Error('update_from_config requires a ConfigParser object');
- }
-
- shell.rm('-rf', resDir);
- shell.mkdir(resDir);
-
- icons = config.getIcons('blackberry10');
- if (icons) {
- copyResources(icons);
- }
- // blackberry10 splash images use custom element rim:splash
- splashscreens = config.getStaticResources('blackberry10', 'rim:splash');
- if (splashscreens) {
- copyResources(splashscreens);
- }
-};
-
-// Returns a promise.
-blackberry_parser.prototype.update_project = function (cfg) {
- var self = this;
-
- try {
- self.update_from_config(cfg);
- } catch (e) {
- return Q.reject(e);
- }
- self.update_overrides();
- util.deleteSvnFolders(this.www_dir());
- return Q();
-};
-
-// Returns the platform-specific www directory.
-blackberry_parser.prototype.www_dir = function () {
- return path.join(this.path, 'www');
-};
-
-blackberry_parser.prototype.config_xml = function () {
- return this.config_path;
-};
-
-// Used for creating platform_www in projects created by older versions.
-blackberry_parser.prototype.cordovajs_path = function (libDir) {
- var jsPath = path.join(libDir, 'javascript', 'cordova.blackberry10.js');
- return path.resolve(jsPath);
-};
-
-blackberry_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.
-blackberry_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');
- var platform_cfg_backup = new ConfigParser(this.config_path);
-
- // 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());
- // Re-Write config.xml
- platform_cfg_backup.write();
-};
-
-// update the overrides folder into the www folder
-blackberry_parser.prototype.update_overrides = function () {
- var projectRoot = util.isCordova(this.path);
- var merges_path = path.join(util.appDir(projectRoot), 'merges', 'blackberry10');
- if (fs.existsSync(merges_path)) {
- var overrides = path.join(merges_path, '*');
- shell.cp('-rf', overrides, this.www_dir());
- }
-};
diff --git a/src/cordova/metadata/ubuntu_parser.js b/src/cordova/metadata/ubuntu_parser.js
deleted file mode 100644
index 1313f87..0000000
--- a/src/cordova/metadata/ubuntu_parser.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- *
- * Copyright 2013 Canonical Ltd.
- *
- * 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 fs = require('fs');
-var path = require('path');
-var util = require('../util');
-var shell = require('shelljs');
-var Q = require('q');
-var Parser = require('./parser');
-var os = require('os');
-var ConfigParser = require('cordova-common').ConfigParser;
-
-function ubuntu_parser (project) {
-
- // Call the base class constructor
- Parser.call(this, 'ubuntu', project);
-
- this.path = project;
- this.config = new ConfigParser(this.config_xml());
- this.update_manifest();
-}
-
-function sanitize (str) {
- return str.replace(/\n/g, ' ').replace(/^\s+|\s+$/g, '');
-}
-
-require('util').inherits(ubuntu_parser, Parser);
-
-module.exports = ubuntu_parser;
-
-ubuntu_parser.prototype.update_from_config = function (config) {
- if (config instanceof ConfigParser) {
- } else {
- return Q.reject(new Error('update_from_config requires a ConfigParser object'));
- }
-
- this.config = new ConfigParser(this.config_xml());
- this.config.setName(config.name());
- this.config.setVersion(config.version());
- this.config.setPackageName(config.packageName());
- this.config.setDescription(config.description());
-
- this.config.write();
-
- return this.update_manifest();
-};
-
-ubuntu_parser.prototype.cordovajs_path = function (libDir) {
- var jsPath = path.join(libDir, 'www', 'cordova.js');
- return path.resolve(jsPath);
-};
-
-ubuntu_parser.prototype.cordovajs_src_path = function (libDir) {
- var jsPath = path.join(libDir, 'cordova-js-src');
- return path.resolve(jsPath);
-};
-
-ubuntu_parser.prototype.update_manifest = function () {
- var nodearch2debarch = { 'arm': 'armhf',
- 'ia32': 'i386',
- 'x64': 'amd64'};
- var arch;
- if (os.arch() in nodearch2debarch) { arch = nodearch2debarch[os.arch()]; } else { return Q.reject(new Error('unknown cpu arch')); }
-
- if (!this.config.author()) { return Q.reject(new Error('config.xml should contain author')); }
-
- var manifest = { name: this.config.packageName(),
- version: this.config.version(),
- title: this.config.name(),
- hooks: { cordova: { desktop: 'cordova.desktop',
- apparmor: 'apparmor.json' } },
- framework: 'ubuntu-sdk-13.10',
- maintainer: sanitize(this.config.author()) + ' <' + this.config.doc.find('author').attrib.email + '>',
- architecture: arch,
- description: sanitize(this.config.description()) };
-
- var name = sanitize(this.config.name()); // FIXME: escaping
- var content = '[Desktop Entry]\nName=' + name + '\nExec=./cordova-ubuntu www/\nTerminal=false\nType=Application\nX-Ubuntu-Touch=true';
-
- if (this.config.doc.find('icon') && this.config.doc.find('icon').attrib.src) {
- var iconPath = path.join(this.path, '../..', this.config.doc.find('icon').attrib.src);
- if (fs.existsSync(iconPath)) { content += '\nIcon=' + this.config.doc.find('icon').attrib.src; } else { return Q.reject(new Error('icon does not exist: ' + iconPath)); }
- } else {
- content += '\nIcon=qmlscene';
- console.warn('missing icon element in config.xml');
- }
- fs.writeFileSync(path.join(this.path, 'manifest.json'), JSON.stringify(manifest));
- fs.writeFileSync(path.join(this.path, 'cordova.desktop'), content);
-
- var policy = { policy_groups: ['networking', 'audio'], policy_version: 1 };
-
- this.config.doc.getroot().findall('./feature/param').forEach(function (element) {
- if (element.attrib.policy_group && policy.policy_groups.indexOf(element.attrib.policy_group) === -1) { policy.policy_groups.push(element.attrib.policy_group); }
- });
-
- fs.writeFileSync(path.join(this.path, 'apparmor.json'), JSON.stringify(policy));
-
- return Q();
-};
-
-ubuntu_parser.prototype.config_xml = function () {
- return path.join(this.path, 'config.xml');
-};
-
-ubuntu_parser.prototype.www_dir = function () {
- return path.join(this.path, 'www');
-};
-
-ubuntu_parser.prototype.update_www = function () {
- var projectRoot = util.isCordova(this.path);
- var www = util.projectWww(projectRoot);
-
- shell.rm('-rf', this.www_dir());
- shell.cp('-rf', www, this.path);
-};
-
-ubuntu_parser.prototype.update_overrides = function () {
- var projectRoot = util.isCordova(this.path);
- var mergesPath = path.join(util.appDir(projectRoot), 'merges', 'ubuntu');
- if (fs.existsSync(mergesPath)) {
- var overrides = path.join(mergesPath, '*');
- shell.cp('-rf', overrides, this.www_dir());
- }
-};
-
-// Returns a promise.
-ubuntu_parser.prototype.update_project = function (cfg) {
- var self = this;
-
- return this.update_from_config(cfg)
- .then(function () {
- self.update_overrides();
- util.deleteSvnFolders(self.www_dir());
- });
-};
diff --git a/src/cordova/metadata/webos_parser.js b/src/cordova/metadata/webos_parser.js
deleted file mode 100755
index a8c48c0..0000000
--- a/src/cordova/metadata/webos_parser.js
+++ /dev/null
@@ -1,203 +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.
-*/
-
-var fs = require('fs');
-var path = require('path');
-var shell = require('shelljs');
-var util = require('../util');
-var Q = require('q');
-var Parser = require('./parser');
-
-function webos_parser (project) {
- // Call the base class constructor
- Parser.call(this, 'webos', project);
- this.path = project;
-}
-
-require('util').inherits(webos_parser, Parser);
-
-module.exports = webos_parser;
-
-// Returns a promise.
-webos_parser.prototype.update_from_config = function (config) {
- var www = this.www_dir();
- var manifestPath = path.join(www, 'appinfo.json');
- var manifest = {type: 'web', uiRevision: 2};
-
- // Load existing manifest
- if (fs.existsSync(manifestPath)) {
- manifest = JSON.parse(fs.readFileSync(manifestPath));
- }
-
- // overwrite properties existing in config.xml
- manifest.id = config.packageName() || 'org.apache.cordova.example';
- var contentNode = config.doc.find('content');
- var contentSrc = (contentNode && contentNode.attrib['src']) || ('index.html');
- manifest.main = contentSrc;
- manifest.version = config.version() || '0.0.1';
- manifest.title = config.name() || 'CordovaExample';
- manifest.appDescription = (config.description()) || ('');
- manifest.vendor = (config.author()) || ('My Company');
-
- var authorNode = config.doc.find('author');
- var authorUrl = authorNode && authorNode.attrib['href'];
- if (authorUrl) {
- manifest.vendorurl = authorUrl;
- }
-
- var projectRoot = util.isCordova(this.path);
- var copyImg = function (src, type) {
- var index = src.indexOf('www');
- if (index === 0 || index === 1) {
- return src.substring(index + 4);
- } else {
- var newSrc = type + '.png';
- shell.cp('-f', path.join(projectRoot, src), path.join(www, newSrc));
- return newSrc;
- }
- };
-
- var icons = config.getIcons('webos');
- // if there are icon elements in config.xml
- if (icons) {
- var setIcon = function (type, size) {
- var item = icons.getBySize(size, size);
- if (item && item.src) {
- manifest[type] = copyImg(item.src, type);
- } else {
- item = icons.getDefault();
- if (item && item.src) {
- manifest[type] = copyImg(item.src, type);
- }
- }
- };
- setIcon('icon', 80, 80);
- setIcon('largeIcon', 130, 130);
- }
-
- var splash = config.getSplashScreens('webos');
- // if there are icon elements in config.xml
- if (splash) {
- var splashImg = splash.getBySize(1920, 1080);
- if (splashImg && splashImg.src) {
- manifest.splashBackground = copyImg(splashImg.src, 'splash');
- }
- }
-
- fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
-
- return Q();
-};
-
-webos_parser.prototype.www_dir = function () {
- return path.join(this.path, 'www');
-};
-
-// Used for creating platform_www in projects created by older versions.
-webos_parser.prototype.cordovajs_path = function (libDir) {
- var jsPath = path.join(libDir, 'cordova-lib', 'cordova.js');
- return path.resolve(jsPath);
-};
-
-webos_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.
-webos_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
- if (fs.lstatSync(app_www).isSymbolicLink()) {
- var real_www = fs.realpathSync(app_www);
- if (fs.existsSync(path.join(real_www, 'build/enyo.js'))) {
- // symlinked Enyo bootplate; resolve to bootplate root for
- // ares-webos-sdk to handle the minification
- if (fs.existsSync(path.join(real_www, '../enyo'))) {
- app_www = path.join(real_www, '..');
- } else if (fs.existsSync(path.join(real_www, '../../enyo'))) {
- app_www = path.join(real_www, '../..');
- }
- // double check existence of deploy
- if (!fs.existsSync(path.join(app_www, 'deploy'))) {
- app_www = real_www; // fallback
- }
- }
- }
- 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());
-
- // prepare and update deploy.json for cordova components
- var deploy = path.join(this.www_dir(), 'deploy.json');
- if (fs.existsSync(deploy)) {
- try {
- // make stub file entries to guarantee the dir/files are there
- shell.mkdir('-p', path.join(this.www_dir(), 'plugins'));
- var pluginFile = path.join(this.www_dir(), 'cordova_plugins.js');
- if (!fs.existsSync(pluginFile)) {
- fs.writeFileSync(pluginFile, '');
- }
- // add to json if not already there, so they don't get minified out during build
- var obj = JSON.parse(fs.readFileSync(deploy, {encoding: 'utf8'}));
- obj.assets = obj.assets || [];
- var assets = ['plugins', 'cordova.js', 'cordova_plugins.js'];
- for (var i = 0; i < assets.length; i++) {
- var index = obj.assets.indexOf(assets[i]);
- if (index < 0) {
- index = obj.assets.indexOf('./' + assets[i]);
- }
- if (index < 0) {
- obj.assets.push('./' + assets[i]);
- }
- fs.writeFileSync(deploy, JSON.stringify(obj, null, 2));
- }
- } catch (e) {
- console.error('Unable to update deploy.json: ' + e);
- }
- }
-};
-
-webos_parser.prototype.update_overrides = function () {
- var projectRoot = util.isCordova(this.path);
- var mergesPath = path.join(util.appDir(projectRoot), 'merges', 'webosos');
- if (fs.existsSync(mergesPath)) {
- var overrides = path.join(mergesPath, '*');
- shell.cp('-rf', overrides, this.www_dir());
- }
-};
-
-webos_parser.prototype.config_xml = function () {
- return path.join(this.path, 'config.xml');
-};
-
-// Returns a promise.
-webos_parser.prototype.update_project = function (cfg) {
- return this.update_from_config(cfg)
- .then(function () {
- this.update_overrides();
- util.deleteSvnFolders(this.www_dir());
- }.bind(this));
-};
diff --git a/src/cordova/platform/addHelper.js b/src/cordova/platform/addHelper.js
index 2b3ce97..f18ad46 100644
--- a/src/cordova/platform/addHelper.js
+++ b/src/cordova/platform/addHelper.js
@@ -95,10 +95,6 @@ function addHelper (cmd, hooksRunner, projectRoot, targets, opts) {
platform = null;
}
- if (platform === 'ubuntu' || platform === 'blackberry10' || platform === 'webos') {
- events.emit(platform + ' has been deprecated and will be removed in the next major release of cordova.');
- }
-
if (fs.existsSync(path.join(projectRoot, 'package.json'))) {
pkgJson = cordova_util.requireNoCache(path.join(projectRoot, 'package.json'));
}
diff --git a/src/platforms/platformsConfig.json b/src/platforms/platformsConfig.json
index d18eb59..a1d57cc 100644
--- a/src/platforms/platformsConfig.json
+++ b/src/platforms/platformsConfig.json
@@ -19,21 +19,6 @@
"apiCompatibleSince": "5.0.0",
"deprecated": false
},
- "ubuntu": {
- "hostos": ["linux"],
- "parser_file": "../cordova/metadata/ubuntu_parser",
- "handler_file": "../plugman/platforms/ubuntu",
- "url": "https://git-wip-us.apache.org/repos/asf?p=cordova-ubuntu.git",
- "version": "~4.3.4",
- "deprecated": true
- },
- "blackberry10": {
- "parser_file": "../cordova/metadata/blackberry10_parser",
- "handler_file": "../plugman/platforms/blackberry10",
- "url": "https://git-wip-us.apache.org/repos/asf?p=cordova-blackberry.git",
- "version": "~3.8.0",
- "deprecated": true
- },
"www": {
"hostos": [],
"url": "https://git-wip-us.apache.org/repos/asf?p=cordova-app-hello-world.git",
@@ -48,13 +33,6 @@
"apiCompatibleSince": "4.3.0",
"deprecated": false
},
- "webos": {
- "parser_file": "../cordova/metadata/webos_parser",
- "handler_file": "../plugman/platforms/webos",
- "url": "https://git-wip-us.apache.org/repos/asf?p=cordova-webos.git",
- "version": "~3.7.0",
- "deprecated": false
- },
"browser": {
"parser_file": "../cordova/metadata/browser_parser",
"handler_file": "../plugman/platforms/browser",
diff --git a/src/plugman/platforms/blackberry10.js b/src/plugman/platforms/blackberry10.js
deleted file mode 100644
index 55853da..0000000
--- a/src/plugman/platforms/blackberry10.js
+++ /dev/null
@@ -1,93 +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.
-*/
-
-var path = require('path');
-var common = require('./common');
-var events = require('cordova-common').events;
-var xml_helpers = require('cordova-common').xmlHelpers;
-
-var TARGETS = ['device', 'simulator'];
-
-module.exports = {
- www_dir: function (project_dir) {
- return path.join(project_dir, 'www');
- },
- package_name: function (project_dir) {
- var config_path = path.join(module.exports.www_dir(project_dir), 'config.xml');
- var widget_doc = xml_helpers.parseElementtreeSync(config_path);
- return widget_doc._root.attrib['id'];
- },
- 'source-file': {
- install: function (obj, plugin_dir, project_dir, plugin_id, options) {
- var src = obj.src;
- var target = obj.targetDir || plugin_id;
- TARGETS.forEach(function (arch) {
- var dest = path.join('native', arch, 'chrome', 'plugin', target, path.basename(src));
-
- common.copyNewFile(plugin_dir, src, project_dir, dest);
- });
- },
- uninstall: function (obj, project_dir, plugin_id, options) {
- var src = obj.src;
- var target = obj.targetDir || plugin_id;
- TARGETS.forEach(function (arch) {
- var dest = path.join('native', arch, 'chrome', 'plugin', target, path.basename(src));
- common.removeFile(project_dir, dest);
- });
- }
- },
- 'header-file': {
- install: function (obj, plugin_dir, project_dir, plugin_id, options) {
- events.emit('verbose', 'header-file.install is not supported for blackberry');
- },
- uninstall: function (obj, project_dir, plugin_id, options) {
- events.emit('verbose', 'header-file.uninstall is not supported for blackberry');
- }
- },
- 'lib-file': {
- install: function (obj, plugin_dir, project_dir, plugin_id, options) {
- var src = obj.src;
- var arch = obj.arch;
- var dest = path.join('native', arch, 'plugins', 'jnext', path.basename(src));
- common.copyFile(plugin_dir, src, project_dir, dest, false);
- },
- uninstall: function (obj, project_dir, plugin_id, options) {
- var src = obj.src;
- var arch = obj.arch;
- var dest = path.join('native', arch, 'plugins', 'jnext', path.basename(src));
- common.removeFile(project_dir, dest);
- }
- },
- 'resource-file': {
- install: function (obj, plugin_dir, project_dir, plugin_id, options) {
- events.emit('verbose', 'resource-file.install is not supported for blackberry');
- },
- uninstall: function (obj, project_dir, plugin_id, options) {
- events.emit('verbose', 'resource-file.uninstall is not supported for blackberry');
- }
- },
- 'framework': {
- install: function (obj, plugin_dir, project_dir, plugin_id, options) {
- events.emit('verbose', 'framework.install is not supported for blackberry');
- },
- uninstall: function (obj, project_dir, plugin_id, options) {
- events.emit('verbose', 'framework.uninstall is not supported for blackberry');
- }
- }
-};
--
To stop receiving notification emails like this one, please contact
"commits@cordova.apache.org" <co...@cordova.apache.org>.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org