[GitHub] cordova-lib pull request #499: Cb 11960

2017-02-03 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/499


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2017-01-30 Thread shazron
Github user shazron commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r98560154
  
--- Diff: cordova-lib/spec-plugman/fetch.spec.js ---
@@ -214,20 +214,23 @@ describe('fetch', function() {
 it('Test 017 : should fetch from a commit-sha', function(done) {
 
wrapper(fetch('http://github.com/apache/cordova-plugin-device.git#ad5f1e7bfd05ef98c01df549a0fa98036a5625db',
 temp, { expected_id: 'cordova-plugin-device' }), done, function() {
 expect(1).toBe(1);
+done();
 });
-});
+}, 2);
--- End diff --

3 occurrences of 2 as a magic number here should be replaced by a 
constant, like save.spec.js which uses TIMEOUT and BIG_TIMEOUT


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2017-01-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r97895425
  
--- Diff: cordova-lib/spec-cordova/fixtures/basePkgJson4/package.json ---
@@ -5,7 +5,7 @@
 "main": "index.js",
 "dependencies": {
 "cordova-android": "^3.1.0",
-"cordova-ios": "^4.3.0"
+"cordova-browser": "^4.3.0"
--- End diff --

just to confirm all of these should be "^4.1.0" ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2017-01-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r97894467
  
--- Diff: cordova-lib/spec-cordova/pkgJson-restore.spec.js ---
@@ -680,10 +681,10 @@ describe('update config.xml to include platforms in 
pkg.json', function () {
 
 // Expect that config.xml contains only android at this point 
(basePjgJson4)
 expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
-expect(configEngArray.indexOf('ios')).toEqual(-1);
+expect(configEngArray.indexOf('browser')).toEqual(-1);
 expect(configEngArray.length === 1);
-// Pkg.json has cordova-ios in its dependencies.
-expect(pkgJson.dependencies).toEqual({ 'cordova-android' : 
'^3.1.0', 'cordova-ios' : '^4.3.0' });
+// Pkg.json has cordova-browser in its dependencies.
+expect(pkgJson.dependencies).toEqual({ 'cordova-android' : 
'^3.1.0', 'cordova-browser' : '^4.3.0' });
--- End diff --

same, need to update browser version


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2017-01-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r97894300
  
--- Diff: cordova-lib/spec-cordova/fixtures/basePkgJson4/package.json ---
@@ -5,7 +5,7 @@
 "main": "index.js",
 "dependencies": {
 "cordova-android": "^3.1.0",
-"cordova-ios": "^4.3.0"
+"cordova-browser": "^4.3.0"
--- End diff --

looks like cordova-browser only has version 4.1.0 released on npm 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2017-01-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r97894545
  
--- Diff: cordova-lib/spec-cordova/pkgJson-restore.spec.js ---
@@ -697,18 +698,18 @@ describe('update config.xml to include platforms in 
pkg.json', function () {
 return elem.name;
 });
 configEngArray = engNames.slice();
-// Expect 'ios' to be added to config.xml.
-expect(configEngArray.indexOf('ios')).toBeGreaterThan(-1);
+// Expect 'browser' to be added to config.xml.
+expect(configEngArray.indexOf('browser')).toBeGreaterThan(-1);
 // Expect 'android' to still be in config.xml.
 expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
 // Expect config.xml array to have 2 elements (platforms).
 expect(configEngArray.length === 2);
-// Check to make sure that 'ios' spec was added properly.
-expect(engines).toEqual([ { name: 'android', spec: '^3.1.0' 
},{ name: 'ios', spec: '^4.3.0' } ]);
+// Check to make sure that 'browser' spec was added properly.
+expect(engines).toEqual([ { name: 'android', spec: '^3.1.0' 
},{ name: 'browser', spec: '^4.3.0' } ]);
 // No change to pkg.json dependencies.
-expect(pkgJson.dependencies).toEqual({ 'cordova-android' : 
'^3.1.0', 'cordova-ios' : '^4.3.0' });
+expect(pkgJson.dependencies).toEqual({ 'cordova-android' : 
'^3.1.0', 'cordova-browser' : '^4.3.0' });
--- End diff --

again


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2017-01-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r97894565
  
--- Diff: cordova-lib/spec-cordova/pkgJson-restore.spec.js ---
@@ -697,18 +698,18 @@ describe('update config.xml to include platforms in 
pkg.json', function () {
 return elem.name;
 });
 configEngArray = engNames.slice();
-// Expect 'ios' to be added to config.xml.
-expect(configEngArray.indexOf('ios')).toBeGreaterThan(-1);
+// Expect 'browser' to be added to config.xml.
+expect(configEngArray.indexOf('browser')).toBeGreaterThan(-1);
 // Expect 'android' to still be in config.xml.
 expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
 // Expect config.xml array to have 2 elements (platforms).
 expect(configEngArray.length === 2);
-// Check to make sure that 'ios' spec was added properly.
-expect(engines).toEqual([ { name: 'android', spec: '^3.1.0' 
},{ name: 'ios', spec: '^4.3.0' } ]);
+// Check to make sure that 'browser' spec was added properly.
+expect(engines).toEqual([ { name: 'android', spec: '^3.1.0' 
},{ name: 'browser', spec: '^4.3.0' } ]);
 // No change to pkg.json dependencies.
-expect(pkgJson.dependencies).toEqual({ 'cordova-android' : 
'^3.1.0', 'cordova-ios' : '^4.3.0' });
+expect(pkgJson.dependencies).toEqual({ 'cordova-android' : 
'^3.1.0', 'cordova-browser' : '^4.3.0' });
 
expect(pkgJson.dependencies['cordova-android']).toEqual('^3.1.0');
-expect(pkgJson.dependencies['cordova-ios']).toEqual('^4.3.0');
+
expect(pkgJson.dependencies['cordova-browser']).toEqual('^4.3.0');
--- End diff --

again


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2017-01-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r97894506
  
--- Diff: cordova-lib/spec-cordova/pkgJson-restore.spec.js ---
@@ -697,18 +698,18 @@ describe('update config.xml to include platforms in 
pkg.json', function () {
 return elem.name;
 });
 configEngArray = engNames.slice();
-// Expect 'ios' to be added to config.xml.
-expect(configEngArray.indexOf('ios')).toBeGreaterThan(-1);
+// Expect 'browser' to be added to config.xml.
+expect(configEngArray.indexOf('browser')).toBeGreaterThan(-1);
 // Expect 'android' to still be in config.xml.
 expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
 // Expect config.xml array to have 2 elements (platforms).
 expect(configEngArray.length === 2);
-// Check to make sure that 'ios' spec was added properly.
-expect(engines).toEqual([ { name: 'android', spec: '^3.1.0' 
},{ name: 'ios', spec: '^4.3.0' } ]);
+// Check to make sure that 'browser' spec was added properly.
+expect(engines).toEqual([ { name: 'android', spec: '^3.1.0' 
},{ name: 'browser', spec: '^4.3.0' } ]);
--- End diff --

same


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2016-11-18 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r88704297
  
--- Diff: cordova-lib/spec-cordova/pkgJson-restore.spec.js ---
@@ -414,6 +414,80 @@ describe('tests platform/spec restore with --save', 
function () {
 }).fin(done);
 // Cordova prepare needs extra wait time to complete.
 },3);
+
+/** Test#018
+*   When plugin is added with url and fetch and restored with fetch, 
+*   pkg.json and config.xml would add it to their files properly.
+*   When prepare is run with fetch, plugin should be installed.
+*/
+it('Test#018 : test to make sure that plugin url is added and restored 
properly', function(done) {
+var cwd = process.cwd();
+var pkgJsonPath = path.join(cwd,'package.json');
+var pkgJson;
+var pluginsFolderPath = path.join(cwd,'plugins');
+var configXmlPath = path.join(cwd, 'config.xml');
+var configPlugins;
+var configPlugin;
+
+emptyPlatformList().then(function() {
+// Add plugin with save and fetch.
+return cordova.raw.plugin('add', 
['https://github.com/apache/cordova-plugin-splashscreen'], {'save':true, 
'fetch':true});
+}).then(function() {
+// Plugin id and spec were added to config.xml successfully.
+var cfg = new ConfigParser(configXmlPath);
+configPlugins = cfg.getPluginIdList();
+configPlugin = cfg.getPlugin(configPlugins);
+
expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
+
expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
+// Plugin was added to pkg.json successfully in plugin list 
and dependencies.
+delete require.cache[require.resolve(pkgJsonPath)];
+pkgJson = require(pkgJsonPath);
+expect(pkgJson.dependencies).toEqual({ 
'cordova-plugin-splashscreen': 
'git+https://github.com/apache/cordova-plugin-splashscreen.git' });
+
expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
+// Plugin was added to installed plugin list successfully.
+expect(path.join(pluginsFolderPath, 
'cordova-plugin-splashscreen')).toExist();
+}).then(function() {
+// Remove plugin without --save.
+return cordova.raw.plugin('rm', 'cordova-plugin-splashscreen', 
{'fetch':true});
+}).then(function() {
+// Plugin id and spec are still in config.xml.
+var cfg2 = new ConfigParser(configXmlPath);
+configPlugins = cfg2.getPluginIdList();
+configPlugin = cfg2.getPlugin(configPlugins);
+
expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
+
expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
+// // Plugin still in pkg.json plugin list and dependencies.
--- End diff --

I will fix this typo


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85018233
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84999160
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85015269
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85012246
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85014503
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85012170
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85010504
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
--- End diff --

done!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85013772
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85018072
  
--- Diff: cordova-lib/spec-cordova/pkgJson.spec.js ---
@@ -0,0 +1,348 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// This group of tests checks if plugins are added and removed as expected 
from package.json.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('plugin_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+it('Test#001 : should successfully add and remove a plugin with save', 
function(done) {
+var pkgJsonPath = path.join(process.cwd(),'package.json');
+var pkgJson;
+
+expect(pkgJsonPath).toExist();
+
+// Add the plugin with --save
+return cordova.raw.plugin('add', pluginId, {'save':true})
+.then(function() {
+// Check that the plugin add was successful.
+delete require.cache[require.resolve(pkgJsonPath)];
+pkgJson = require(pkgJsonPath);
+expect(pkgJson).not.toBeUndefined();
+expect(pkgJson.cordova.plugins).not.toBeUndefined();
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85011439
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r8503
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85011190
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85010911
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85015289
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85012879
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85010828
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85012532
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85011010
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84999093
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85015369
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85011274
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85010510
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
--- End diff --

done!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85010529
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
--- End diff --

done!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85001497
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85010730
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
--- End diff --

Done.. not needed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and 

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85011104
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84996266
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84996343
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
--- End diff --

reference package.json


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84994538
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
--- End diff --

rename this to `plugin_test_pkgjson`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84994925
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
--- End diff --

for plugin tests, this probably isn't needed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not 

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85001631
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85000290
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84999753
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84995508
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85002184
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84999589
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
--- End diff --

Delete emptyPluginList and fullPluginList since you aren't using them


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85002357
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85001447
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84997203
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84999210
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84995973
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r85002140
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84995444
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84998011
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84997761
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84997132
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-25 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r84997032
  
--- Diff: cordova-lib/spec-cordova/package.json.spec.js ---
@@ -0,0 +1,389 @@
+/**
+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 helpers = require('./helpers'),
+path = require('path'),
+fs = require('fs'),
+shell = require('shelljs'),
+superspawn = require('cordova-common').superspawn,
+Q = require('q'),
+events = require('cordova-common').events,
+cordova = require('../src/cordova/cordova'),
+rewire = require('rewire'),
+prepare = require('../src/cordova/prepare'),
+platforms = require('../src/platforms/platforms'),
+platform = rewire('../src/cordova/platform.js');
+
+var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
+
+function addPlugin(target, id, options) {
+// Checks that there are no plugins yet.
+return cordova.raw.plugin('list').then(function() {
+expect(results).toMatch(/No plugins added/gi);
+}).then(function() {
+// Adds a fake plugin from fixtures.
+return cordova.raw.plugin('add', target, options);
+}).then(function() {
+expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toContain(id);
+});
+}
+// Runs: remove, list.
+function removePlugin(id, options) {
+return cordova.raw.plugin('rm', id)
+.then(function() {
+// The whole dir should be gone.
+expect(path.join(project, 'plugins', id)).not.toExist();
+}).then(function() {
+return cordova.raw.plugin('ls');
+}).then(function() {
+expect(results).toMatch(/No plugins added/gi);
+});
+}
+// Checks if plugin list is empty.
+function emptyPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBe(-1);
+});
+}
+// Checks if plugin list exists.
+function fullPluginList() {
+return cordova.raw.plugin('list').then(function() {
+var installed = results.match(/Installed plugins:\n  (.*)/);
+expect(installed).toBeDefined();
+expect(installed[1].indexOf('fake-plugin')).toBeGreaterThan(-1);
+});
+}
+
+// This group of tests checks if plugins are added and removed as expected.
+describe('plugin end-to-end', function() {
+var pluginId = 'cordova-plugin-device';
+var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+var project = path.join(tmpDir, 'project');
+var results;
+
+events.on('results', function(res) { results = res; });
+
+beforeEach(function() {
+shell.rm('-rf', project);
+
+// Copy then move because we need to copy everything, but that 
means it will copy the whole directory.
+// Using /* doesn't work because of hidden files.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'basePkgJson'), 
tmpDir);
+shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+// Copy some platform to avoid working on a project with no 
platforms.
+shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 
helpers.testPlatform), path.join(project, 'platforms'));
+process.chdir(project);
+
+delete process.env.PWD;
+
+spyOn(prepare, 'preparePlatforms').andCallThrough();
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+

[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-11 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/499#discussion_r82916012
  
--- Diff: cordova-lib/src/cordova/plugin.js ---
@@ -298,8 +326,24 @@ module.exports = function plugin(command, targets, 
opts) {
 configXml.write();
 }
 }
-})
-.then(function(){
--- End diff --

Not sure why this was deleted? Is that okay? I retested everything and it 
worked


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #499: Cb 11960

2016-10-10 Thread audreyso
GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/499

Cb 11960



### Platforms affected
Will work when adding all platforms.

### What does this PR do?
When adding or removing a platform (with --save), the specified platform 
will be added or removed from the package.json file.

### What testing has been done on this change?
Added and removed platforms to see if package.json updates properly.

### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X ] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [ ] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-11960

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/499.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #499


commit 16576d90145be4de6dd628227f3e65b9a4f4545c
Author: audreyso 
Date:   2016-10-04T00:50:51Z

CB-8995 renamed start to plugman install/uninstall start to make CordovaLib 
tests more descriptive

commit 7fc9f3c2f74353033e1c64178ec86b71d16b1bc9
Author: audreyso 
Date:   2016-10-07T21:19:06Z

CB-11960 specified platform is now added to both a config.xml and 
package.json file when saved




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org