[GitHub] cordova-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-08-09 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-ios/pull/234#discussion_r74154432
  
--- Diff: tests/spec/unit/podMod.spec.js ---
@@ -0,0 +1,107 @@
+var fs = require('fs'),
+   path = require('path'),
+   cordova = require(path.resolve(__dirname, '..', '..', '..', '..', 
'cordova-lib/cordova-lib/src/cordova/cordova'));
--- End diff --

Ah, thank you! I've refactored the unit tests. 


---
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-coho pull request #130: CB-11646 version arg optional, will grab fro...

2016-07-29 Thread juliascript
GitHub user juliascript opened a pull request:

https://github.com/apache/cordova-coho/pull/130

CB-11646 version arg optional, will grab from repo if not provided

See https://issues.apache.org/jira/browse/CB-11646

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

$ git pull https://github.com/juliascript/cordova-coho CB-11646

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

https://github.com/apache/cordova-coho/pull/130.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 #130


commit 3bbaf2d5efa8fc2de3c324d5de9662bd5ee0e24b
Author: juliascript <juliageis...@gmail.com>
Date:   2016-07-29T00:44:52Z

CB-11642 update CDVAvailability.h

commit 8df4d0f43fee407b41b8069b515a07525637d0bb
Author: juliascript <juliageis...@gmail.com>
Date:   2016-07-29T00:48:21Z

CB-11642 update CDVAvailability.h

commit cdb35ff24fed7c3bdc8026d8059f5fdc315643e0
Author: juliascript <juliageis...@gmail.com>
Date:   2016-07-29T18:16:53Z

update npm test

commit 8d68b284f3eb0917062d2772acda94aaaa6f9a84
Author: juliascript <juliageis...@gmail.com>
Date:   2016-07-29T23:02:29Z

CB-11646 version arg optional, will grab from repo




---
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-coho pull request #129: CB-11642 Update CDVAvailability.h

2016-07-29 Thread juliascript
GitHub user juliascript reopened a pull request:

https://github.com/apache/cordova-coho/pull/129

CB-11642 Update CDVAvailability.h 

See https://issues.apache.org/jira/browse/CB-11642

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

$ git pull https://github.com/juliascript/cordova-coho CB-11642

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

https://github.com/apache/cordova-coho/pull/129.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 #129


commit 3bbaf2d5efa8fc2de3c324d5de9662bd5ee0e24b
Author: juliascript <juliageis...@gmail.com>
Date:   2016-07-29T00:44:52Z

CB-11642 update CDVAvailability.h

commit 8df4d0f43fee407b41b8069b515a07525637d0bb
Author: juliascript <juliageis...@gmail.com>
Date:   2016-07-29T00:48:21Z

CB-11642 update CDVAvailability.h




---
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-coho pull request #129: CB-11642 Update CDVAvailability.h

2016-07-29 Thread juliascript
Github user juliascript closed the pull request at:

https://github.com/apache/cordova-coho/pull/129


---
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 #467: CB-9825: tests for cocoapod integration for p...

2016-07-27 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/467#discussion_r72543969
  
--- Diff: cordova-lib/spec-cordova/platform.spec.js ---
@@ -356,3 +356,123 @@ describe('plugin add and rm end-to-end --fetch', 
function () {
 .fin(done);
 }, 6);
 });
+
+describe('cocoapod plugin add and rm end-to-end', function () {
+
+var tmpDir = helpers.tmpDir('cocoapod_plugin_test');
+var project = path.join(tmpDir, 'hello4');
+
+var samplePlugin = 
path.resolve('./spec-cordova/fixtures/plugins/sample-cordova-plugin-cocoapod-dependent');
+var overlappingDependencyPlugin = 
path.resolve('./spec-cordova/fixtures/plugins/sample-cocoapod-plugin-overlapping-dependency');
+var AFNetworking = 'AFNetworking',
+CWStatusBarNotification = 'CWStatusBarNotification';
+var podfile, podsJSON, workspace;
+
+beforeEach(function() {
+shell.exec('pwd');
+process.chdir(tmpDir);
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+it('installs and uninstalls plugin depending on new pod and existing 
pod', function(done) {
+
+cordova.raw.create('hello4')
+.then(function() {
+process.chdir(project);
+//TODO: change this to cordova-ios on npm 
+return cordova.raw.platform('add', 
'https://github.com/juliascript/cordova-ios.git#CB-9825');
+})
+.then(function() {
+return cordova.raw.plugin('add', samplePlugin);
+})
+.then(function() {
+podfile = path.resolve('./platforms/ios/Podfile');
+podsJSON = path.resolve('./platforms/ios/pods.json');
+workspace = 
path.resolve('./platforms/ios/HelloCordova.xcworkspace');
+
+//podfile should have been created
+fs.exists(podfile, function(podfileExists){
+expect(podfileExists);
+});
+
+//pods.json should have been created
+fs.exists(podsJSON, function(podsJSONExists){
+expect(podsJSONExists);
+});
+
+//workspace should have been created
+fs.exists(workspace, function(workspaceCreated){
+expect(workspaceCreated);
+});
+
+delete require.cache[require.resolve(podfile)];
+var podfileContent = fs.readFileSync(podfile, {'encoding' : 
'utf8'});
+
+expect(podfileContent.includes(AFNetworking));
+
+delete require.cache[require.resolve(podsJSON)];
+var podsJSONContent = require(podsJSON);
+
+expect(podsJSONContent[AFNetworking] !== null);
+return cordova.raw.plugin('add', overlappingDependencyPlugin);
+})
+.then(function() {
+delete require.cache[require.resolve(podfile)];
+var podfileContent = fs.readFileSync(podfile, {'encoding' : 
'utf8'}); 
+var numberOfTimesAFNetworkingIsInPodfile = 
podfileContent.match(/AFNetworking/g || []).length;
+
+expect(podfileContent.includes(CWStatusBarNotification));
+expect(numberOfTimesAFNetworkingIsInPodfile).toEqual(1); 
+
+delete require.cache[require.resolve(podsJSON)];
+var podsJSONContent = require(podsJSON);
+var countPropertyOfAFNetworkingInPodsJSON = 
podsJSONContent[AFNetworking].count;
+var specPropertyOfAFNetworkingInPodsJSON = 
podsJSONContent[AFNetworking].spec;
+
+expect(countPropertyOfAFNetworkingInPodsJSON).toEqual(2);
+//spec property should not be changed because of overlapping 
dependency
+expect(specPropertyOfAFNetworkingInPodsJSON).toEqual('~> 3.0');
+
+return 
cordova.raw.plugin('rm','sample-cocoapod-plugin-overlapping-dependency');
+})
+.then(function() {
+//expect only AFNetworking
+delete require.cache[require.resolve(podfile)];
--- End diff --

Correction: Not needed for Podfile. Thanks!


---
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-m

[GitHub] cordova-lib pull request #467: CB-9825: tests for cocoapod integration for p...

2016-07-27 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/467#discussion_r72543906
  
--- Diff: cordova-lib/spec-cordova/platform.spec.js ---
@@ -356,3 +356,123 @@ describe('plugin add and rm end-to-end --fetch', 
function () {
 .fin(done);
 }, 6);
 });
+
+describe('cocoapod plugin add and rm end-to-end', function () {
+
+var tmpDir = helpers.tmpDir('cocoapod_plugin_test');
+var project = path.join(tmpDir, 'hello4');
+
+var samplePlugin = 
path.resolve('./spec-cordova/fixtures/plugins/sample-cordova-plugin-cocoapod-dependent');
+var overlappingDependencyPlugin = 
path.resolve('./spec-cordova/fixtures/plugins/sample-cocoapod-plugin-overlapping-dependency');
+var AFNetworking = 'AFNetworking',
+CWStatusBarNotification = 'CWStatusBarNotification';
+var podfile, podsJSON, workspace;
+
+beforeEach(function() {
+shell.exec('pwd');
+process.chdir(tmpDir);
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+it('installs and uninstalls plugin depending on new pod and existing 
pod', function(done) {
+
+cordova.raw.create('hello4')
+.then(function() {
+process.chdir(project);
+//TODO: change this to cordova-ios on npm 
+return cordova.raw.platform('add', 
'https://github.com/juliascript/cordova-ios.git#CB-9825');
+})
+.then(function() {
+return cordova.raw.plugin('add', samplePlugin);
+})
+.then(function() {
+podfile = path.resolve('./platforms/ios/Podfile');
+podsJSON = path.resolve('./platforms/ios/pods.json');
+workspace = 
path.resolve('./platforms/ios/HelloCordova.xcworkspace');
+
+//podfile should have been created
+fs.exists(podfile, function(podfileExists){
+expect(podfileExists);
+});
+
+//pods.json should have been created
+fs.exists(podsJSON, function(podsJSONExists){
+expect(podsJSONExists);
+});
+
+//workspace should have been created
+fs.exists(workspace, function(workspaceCreated){
+expect(workspaceCreated);
+});
+
+delete require.cache[require.resolve(podfile)];
+var podfileContent = fs.readFileSync(podfile, {'encoding' : 
'utf8'});
+
+expect(podfileContent.includes(AFNetworking));
+
+delete require.cache[require.resolve(podsJSON)];
+var podsJSONContent = require(podsJSON);
+
+expect(podsJSONContent[AFNetworking] !== null);
+return cordova.raw.plugin('add', overlappingDependencyPlugin);
+})
+.then(function() {
+delete require.cache[require.resolve(podfile)];
+var podfileContent = fs.readFileSync(podfile, {'encoding' : 
'utf8'}); 
+var numberOfTimesAFNetworkingIsInPodfile = 
podfileContent.match(/AFNetworking/g || []).length;
+
+expect(podfileContent.includes(CWStatusBarNotification));
+expect(numberOfTimesAFNetworkingIsInPodfile).toEqual(1); 
+
+delete require.cache[require.resolve(podsJSON)];
+var podsJSONContent = require(podsJSON);
+var countPropertyOfAFNetworkingInPodsJSON = 
podsJSONContent[AFNetworking].count;
+var specPropertyOfAFNetworkingInPodsJSON = 
podsJSONContent[AFNetworking].spec;
+
+expect(countPropertyOfAFNetworkingInPodsJSON).toEqual(2);
+//spec property should not be changed because of overlapping 
dependency
+expect(specPropertyOfAFNetworkingInPodsJSON).toEqual('~> 3.0');
+
+return 
cordova.raw.plugin('rm','sample-cocoapod-plugin-overlapping-dependency');
+})
+.then(function() {
+//expect only AFNetworking
+delete require.cache[require.resolve(podfile)];
+var podfileContent = fs.readFileSync(podfile, {'encoding' : 
'utf8'}); 
+
+
expect(podfileContent.includes(CWStatusBarNotification)).toBe(false);
+expect(podfileContent.includes(AFNetworking));
+  
+delete require.cache[require.resolve(podsJSON)];
+var podsJSONContent = require(podsJSON);
+
+expect(podsJSONContent[AFNetworking]);
+expect(podsJSONContent[CWStatusBarNotification] === undefined);
+
+ret

[GitHub] cordova-lib pull request #467: CB-9825: tests for cocoapod integration for p...

2016-07-27 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/467#discussion_r72541227
  
--- Diff: cordova-lib/spec-cordova/platform.spec.js ---
@@ -356,3 +356,123 @@ describe('plugin add and rm end-to-end --fetch', 
function () {
 .fin(done);
 }, 6);
 });
+
+describe('cocoapod plugin add and rm end-to-end', function () {
+
+var tmpDir = helpers.tmpDir('cocoapod_plugin_test');
+var project = path.join(tmpDir, 'hello4');
+
+var samplePlugin = 
path.resolve('./spec-cordova/fixtures/plugins/sample-cordova-plugin-cocoapod-dependent');
+var overlappingDependencyPlugin = 
path.resolve('./spec-cordova/fixtures/plugins/sample-cocoapod-plugin-overlapping-dependency');
+var AFNetworking = 'AFNetworking',
+CWStatusBarNotification = 'CWStatusBarNotification';
+var podfile, podsJSON, workspace;
+
+beforeEach(function() {
+shell.exec('pwd');
+process.chdir(tmpDir);
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+it('installs and uninstalls plugin depending on new pod and existing 
pod', function(done) {
+
+cordova.raw.create('hello4')
+.then(function() {
+process.chdir(project);
+//TODO: change this to cordova-ios on npm 
+return cordova.raw.platform('add', 
'https://github.com/juliascript/cordova-ios.git#CB-9825');
+})
+.then(function() {
+return cordova.raw.plugin('add', samplePlugin);
+})
+.then(function() {
+podfile = path.resolve('./platforms/ios/Podfile');
+podsJSON = path.resolve('./platforms/ios/pods.json');
+workspace = 
path.resolve('./platforms/ios/HelloCordova.xcworkspace');
+
+//podfile should have been created
+fs.exists(podfile, function(podfileExists){
+expect(podfileExists);
+});
+
+//pods.json should have been created
+fs.exists(podsJSON, function(podsJSONExists){
+expect(podsJSONExists);
+});
+
+//workspace should have been created
+fs.exists(workspace, function(workspaceCreated){
+expect(workspaceCreated);
+});
+
+delete require.cache[require.resolve(podfile)];
+var podfileContent = fs.readFileSync(podfile, {'encoding' : 
'utf8'});
+
+expect(podfileContent.includes(AFNetworking));
+
+delete require.cache[require.resolve(podsJSON)];
+var podsJSONContent = require(podsJSON);
+
+expect(podsJSONContent[AFNetworking] !== null);
+return cordova.raw.plugin('add', overlappingDependencyPlugin);
+})
+.then(function() {
+delete require.cache[require.resolve(podfile)];
+var podfileContent = fs.readFileSync(podfile, {'encoding' : 
'utf8'}); 
+var numberOfTimesAFNetworkingIsInPodfile = 
podfileContent.match(/AFNetworking/g || []).length;
+
+expect(podfileContent.includes(CWStatusBarNotification));
+expect(numberOfTimesAFNetworkingIsInPodfile).toEqual(1); 
+
+delete require.cache[require.resolve(podsJSON)];
+var podsJSONContent = require(podsJSON);
+var countPropertyOfAFNetworkingInPodsJSON = 
podsJSONContent[AFNetworking].count;
+var specPropertyOfAFNetworkingInPodsJSON = 
podsJSONContent[AFNetworking].spec;
+
+expect(countPropertyOfAFNetworkingInPodsJSON).toEqual(2);
+//spec property should not be changed because of overlapping 
dependency
+expect(specPropertyOfAFNetworkingInPodsJSON).toEqual('~> 3.0');
+
+return 
cordova.raw.plugin('rm','sample-cocoapod-plugin-overlapping-dependency');
+})
+.then(function() {
+//expect only AFNetworking
+delete require.cache[require.resolve(podfile)];
+var podfileContent = fs.readFileSync(podfile, {'encoding' : 
'utf8'}); 
+
+
expect(podfileContent.includes(CWStatusBarNotification)).toBe(false);
+expect(podfileContent.includes(AFNetworking));
+  
+delete require.cache[require.resolve(podsJSON)];
+var podsJSONContent = require(podsJSON);
+
+expect(podsJSONContent[AFNetworking]);
+expect(podsJSONContent[CWStatusBarNotification] === undefined);
+
+ret

[GitHub] cordova-lib pull request #467: CB-9825: tests for cocoapod integration for p...

2016-07-27 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/467#discussion_r72541191
  
--- Diff: cordova-lib/spec-cordova/platform.spec.js ---
@@ -356,3 +356,123 @@ describe('plugin add and rm end-to-end --fetch', 
function () {
 .fin(done);
 }, 6);
 });
+
+describe('cocoapod plugin add and rm end-to-end', function () {
+
+var tmpDir = helpers.tmpDir('cocoapod_plugin_test');
+var project = path.join(tmpDir, 'hello4');
+
+var samplePlugin = 
path.resolve('./spec-cordova/fixtures/plugins/sample-cordova-plugin-cocoapod-dependent');
+var overlappingDependencyPlugin = 
path.resolve('./spec-cordova/fixtures/plugins/sample-cocoapod-plugin-overlapping-dependency');
+var AFNetworking = 'AFNetworking',
+CWStatusBarNotification = 'CWStatusBarNotification';
+var podfile, podsJSON, workspace;
+
+beforeEach(function() {
+shell.exec('pwd');
+process.chdir(tmpDir);
+});
+
+afterEach(function() {
+process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+shell.rm('-rf', tmpDir);
+});
+
+it('installs and uninstalls plugin depending on new pod and existing 
pod', function(done) {
+
+cordova.raw.create('hello4')
+.then(function() {
+process.chdir(project);
+//TODO: change this to cordova-ios on npm 
+return cordova.raw.platform('add', 
'https://github.com/juliascript/cordova-ios.git#CB-9825');
+})
+.then(function() {
+return cordova.raw.plugin('add', samplePlugin);
+})
+.then(function() {
+podfile = path.resolve('./platforms/ios/Podfile');
+podsJSON = path.resolve('./platforms/ios/pods.json');
+workspace = 
path.resolve('./platforms/ios/HelloCordova.xcworkspace');
+
+//podfile should have been created
+fs.exists(podfile, function(podfileExists){
+expect(podfileExists);
+});
+
+//pods.json should have been created
+fs.exists(podsJSON, function(podsJSONExists){
+expect(podsJSONExists);
+});
+
+//workspace should have been created
+fs.exists(workspace, function(workspaceCreated){
+expect(workspaceCreated);
+});
+
+delete require.cache[require.resolve(podfile)];
+var podfileContent = fs.readFileSync(podfile, {'encoding' : 
'utf8'});
+
+expect(podfileContent.includes(AFNetworking));
+
+delete require.cache[require.resolve(podsJSON)];
+var podsJSONContent = require(podsJSON);
+
+expect(podsJSONContent[AFNetworking] !== null);
+return cordova.raw.plugin('add', overlappingDependencyPlugin);
+})
+.then(function() {
+delete require.cache[require.resolve(podfile)];
+var podfileContent = fs.readFileSync(podfile, {'encoding' : 
'utf8'}); 
+var numberOfTimesAFNetworkingIsInPodfile = 
podfileContent.match(/AFNetworking/g || []).length;
+
+expect(podfileContent.includes(CWStatusBarNotification));
+expect(numberOfTimesAFNetworkingIsInPodfile).toEqual(1); 
+
+delete require.cache[require.resolve(podsJSON)];
+var podsJSONContent = require(podsJSON);
+var countPropertyOfAFNetworkingInPodsJSON = 
podsJSONContent[AFNetworking].count;
+var specPropertyOfAFNetworkingInPodsJSON = 
podsJSONContent[AFNetworking].spec;
+
+expect(countPropertyOfAFNetworkingInPodsJSON).toEqual(2);
+//spec property should not be changed because of overlapping 
dependency
+expect(specPropertyOfAFNetworkingInPodsJSON).toEqual('~> 3.0');
+
+return 
cordova.raw.plugin('rm','sample-cocoapod-plugin-overlapping-dependency');
+})
+.then(function() {
+//expect only AFNetworking
+delete require.cache[require.resolve(podfile)];
--- End diff --

The Podfile and pods.json should change after the removal and adding of a 
plugin. I believe the deletion of cache is necessary here. 


---
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 IN

[GitHub] cordova-lib pull request #467: CB-9825: tests for cocoapod integration for p...

2016-07-27 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/467#discussion_r72488127
  
--- Diff: 
cordova-lib/spec-cordova/fixtures/plugins/sample-cocoapod-plugin-overlapping-dependency/RELEASENOTES.md
 ---
@@ -0,0 +1,141 @@
+

[GitHub] cordova-lib pull request #467: CB-9825: tests for cocoapod integration for p...

2016-07-27 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/467#discussion_r72487562
  
--- Diff: cordova-lib/spec-cordova/platform.spec.js ---
@@ -33,326 +33,453 @@ var helpers = require('./helpers'),
 var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
 var pluginsDir = path.join(__dirname, 'fixtures', 'plugins');
 
-describe('platform end-to-end', function () {
 
-var tmpDir = helpers.tmpDir('platform_test');
-var project = path.join(tmpDir, 'project');
+// describe('platform end-to-end', function () {
+
+// var tmpDir = helpers.tmpDir('platform_test');
+// var project = path.join(tmpDir, 'project');
+
+// var results;
+
+// beforeEach(function() {
+// shell.rm('-rf', tmpDir);
+
+// // cp then mv because we need to copy everything, but that 
means it'll copy the whole directory.
+// // Using /* doesn't work because of hidden files.
+// shell.cp('-R', path.join(__dirname, 'fixtures', 'base'), 
tmpDir);
+// shell.mv(path.join(tmpDir, 'base'), project);
+// process.chdir(project);
+
+// // Now we load the config.json in the newly created project and 
edit the target platform's lib entry
+// // to point at the fixture version. This is necessary so that 
cordova.prepare can find cordova.js there.
+// var c = config.read(project);
+// c.lib[helpers.testPlatform].url = path.join(__dirname, 
'fixtures', 'platforms', helpers.testPlatform + '-lib');
+// config.write(project, c);
+
+// // The config.json in the fixture project points at fake 
"local" paths.
+// // Since it's not a URL, the lazy-loader will just return the 
junk path.
+// spyOn(superspawn, 'spawn').andCallFake(function(cmd, args) {
+// if (cmd.match(/create\b/)) {
+// // This is a call to the bin/create script, so do the 
copy ourselves.
+// shell.cp('-R', path.join(__dirname, 'fixtures', 
'platforms', 'android'), path.join(project, 'platforms'));
+// } else if(cmd.match(/version\b/)) {
+// return Q('3.3.0');
+// } else if(cmd.match(/update\b/)) {
+// fs.writeFileSync(path.join(project, 'platforms', 
helpers.testPlatform, 'updated'), 'I was updated!', 'utf-8');
+// }
+// return Q();
+// });
+
+// events.on('results', function(res) { results = res; });
+// });
+
+// afterEach(function() {
+// process.chdir(path.join(__dirname, '..'));  // Needed to rm the 
dir on Windows.
+// shell.rm('-rf', tmpDir);
+// });
+
+// // Factoring out some repeated checks.
+// function emptyPlatformList() {
+// return cordova.raw.platform('list').then(function() {
+// var installed = results.match(/Installed platforms:\n  
(.*)/);
+// expect(installed).toBeDefined();
+// expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+// });
+// }
+// function fullPlatformList() {
+// return cordova.raw.platform('list').then(function() {
+// var installed = results.match(/Installed platforms:\n  
(.*)/);
+// expect(installed).toBeDefined();
+// 
expect(installed[1].indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
+// });
+// }
+
+// // The flows we want to test are add, rm, list, and upgrade.
+// // They should run the appropriate hooks.
+// // They should fail when not inside a Cordova project.
+// // These tests deliberately have no beforeEach and afterEach that 
are cleaning things up.
+// it('should successfully run', function(done) {
+
+// // Check there are no platforms yet.
+// emptyPlatformList().then(function() {
+// // Add the testing platform.
+// return cordova.raw.platform('add', [helpers.testPlatform]);
+// }).then(function() {
+// // Check the platform add was successful.
+// expect(path.join(project, 'platforms', 
helpers.testPlatform)).toExist();
+// expect(path.join(project, 'platforms', 
helpers.testPlatform, 'cordova')).toExist();
+// }).then(fullPlatformList) // Check for it in platform ls.
+// .then(function() {
+// // Try to update the platform.
+// return cordova.raw.platform('update', 
[helpers.testPlatform]);
+// }).then(function() {
+// // Our fake update script in the exec mock above creates 
this dummy file.
+// expect

[GitHub] cordova-lib pull request #467: CB-9825: tests for cocoapod integration for p...

2016-07-26 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/467#discussion_r72350543
  
--- Diff: 
cordova-lib/spec-cordova/fixtures/plugins/sample-cocoapod-plugin-overlapping-dependency/NOTICE
 ---
@@ -0,0 +1,5 @@
+Apache Cordova
--- End diff --

New commit does not have this file. Thank you


---
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 #467: CB-9825: tests for cocoapod integration for p...

2016-07-26 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/467#discussion_r72350555
  
--- Diff: 
cordova-lib/spec-cordova/fixtures/plugins/sample-cocoapod-plugin-overlapping-dependency/LICENSE
 ---
@@ -0,0 +1,202 @@
+
--- End diff --

New commit does not have this file. Thank you


---
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 #467: CB-9825: tests for cocoapod integration for p...

2016-07-26 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/467#discussion_r72350533
  
--- Diff: 
cordova-lib/spec-cordova/fixtures/plugins/sample-cocoapod-plugin-overlapping-dependency/README.md
 ---
@@ -0,0 +1,309 @@
+---
--- End diff --

New commit does not have this file. Thank you


---
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 #467: CB-9825: tests for cocoapod integration for p...

2016-07-26 Thread juliascript
GitHub user juliascript opened a pull request:

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

CB-9825: tests for cocoapod integration for plugins



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

$ git pull https://github.com/juliascript/cordova-lib CB-9825

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

https://github.com/apache/cordova-lib/pull/467.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 #467


commit 5a98ca14124107308a29229fb0c6f7939e5c8715
Author: juliascript <juliageis...@gmail.com>
Date:   2016-07-01T18:42:45Z

CB-9825 framework tag spec parsing

commit aedab440bf8876918ee05cf29da6a88cb76379c5
Author: juliascript <juliageis...@gmail.com>
Date:   2016-07-26T20:12:39Z

tests for cocoapod integration for plugins




---
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-ios issue #234: CB-9825 cocoapod integration for plugins

2016-07-13 Thread juliascript
Github user juliascript commented on the issue:

https://github.com/apache/cordova-ios/pull/234
  
Build failing bc incomplete tests. 


---
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-ios issue #234: CB-9825 cocoapod integration for plugins

2016-07-12 Thread juliascript
Github user juliascript commented on the issue:

https://github.com/apache/cordova-ios/pull/234
  
Writing tests currently. Thank you, @shazron! 


---
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-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-07-12 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-ios/pull/234#discussion_r70545166
  
--- Diff: bin/templates/scripts/cordova/lib/podMod.js ---
@@ -0,0 +1,162 @@
+var fs = require('fs');
+var util = require('util');
+var events = require('cordova-common').events;
+var superspawn = require('cordova-common').superspawn;
+var CordovaError = require('cordova-common').CordovaError;
+var opts = {};
+/*
+-- After pods are installed in a .xcworkspace, all existing ios code needs 
to go into the WORKSPACE file -- will need to 
+create a workspace file and then embed the Xcode project  
+
+- Holly might have done some work on this, see the docs: 
+  https://github.com/phonegap/phonegap-webview-ios not sure how 
applicable it can be to our case
+*/
+function removeProjectFromPath (pathToProjectFile) {
+var array = [];
+//remove the project from the path
+array = pathToProjectFile.split('/');
+array.pop();
+var path = array.join('/');
+return path;
+}
+
+function createPodfile (projectName, pathToProjectFile) {
+var path = removeProjectFromPath(pathToProjectFile);
+var pathToPodfile = path + '/Podfile';
+var podfileText = util.format('platform :ios, \'8.0\'\n\ntarget \'%s\' 
do\n\n  project \'%s\'\n\n  \n\nend' , projectName, pathToProjectFile);
+fs.writeFileSync(pathToPodfile, podfileText);
+}
+
+function editPodfileSync (Podfile, pod, isRemoval) {
+var podfileContents = fs.readFileSync(Podfile, 'utf8');
+//split by \n, add in the pod after the project line, shift the rest 
down
+var podfileContentsArray = podfileContents.split('\n');
+var linesInPodfileToKeep = [];
+
+if (isRemoval) {
+podfileContentsArray.forEach (function (lineInPodfile) {
+//if the line in Podfile is the pod to rm, don't save it to 
new array (to be returned)
+if (!lineInPodfile.includes(pod)){
+linesInPodfileToKeep.push(lineInPodfile); 
+}
+});
+podfileContents = linesInPodfileToKeep.join('\n');
+} else {
+podfileContentsArray.splice(5, 0, pod);
+podfileContents = podfileContentsArray.join('\n');
+}
+return podfileContents;
+}
+
+function superspawnPodInstall (path, isPathToProjectFile) {
+// change working directory for all calls of pod install to 
platforms/ios
+if (isPathToProjectFile){
+//if the path passed leads to the project, and not the dir that 
contains the proj
+ //remove the project from the path
+path = removeProjectFromPath(path);
+}
+opts.cwd = path;
+superspawn.spawn('pod', ['install'], opts);
+}
+
+function installPodSync (projectName, pathToProjectFile, nameOfPod, 
podSpec, podsJSON) {
+// called from cordova project directory-- when invoked, args are as 
follows
+//  projectName = cordovaProject (name) and 
+//  pathToProjectFile   = ./path/to/cordovaProject 
+//  nameOfPod   = obj.src   //from framework 
tag
+//  podSpec = obj.spec  //from framework 
tag   
+//  podsJSON= pods.json file in 
cordovaProjectDir/platforms/ios/
+
+// readFileSync will currently truncate the Podfile if it exists
+// if a Podfile doesn't exist, one will be created
+
+// this code will be run during cordova plugin add x -- which has to 
be run in the cordova project dir
+
+//---
+//ERROR
+//
+//if no podName is specified, console err 
+if (nameOfPod === '' || nameOfPod === ' '){
+throw new CordovaError('\nERROR: name of pod is not specified\n');
+}
+//---
+
+podSpec = podSpec || ''; //spec is optional
+
+var stringToWrite; //overwrites Podfile
+var lineToInjectInPodfile; //adds pod
+var path = removeProjectFromPath(pathToProjectFile);
+var podfile = path + '/Podfile';
+var podfileExistsInCurrentDirectory = fs.existsSync(podfile);   
//bool
+var podExistsInPodsJSON = podsJSON[nameOfPod];  
//bool
+var podRequestedForSpecChange;  
//bool
+   
+if (podSpec === '') {
+lineToInjectInPodfile = util.format('pod \'%s\'', nameOfPod);
+podRequestedForSpecChange = false;
+} else {
+if (podExistsInPodsJSON){
+if (podsJSON[nameOfPod].spec == podSpec){
+//---
+//ERROR
+//
+// if pod spec is the one already in the Podfile

[GitHub] cordova-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-07-12 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-ios/pull/234#discussion_r70541974
  
--- Diff: bin/templates/scripts/cordova/lib/podMod.js ---
@@ -0,0 +1,162 @@
+var fs = require('fs');
+var util = require('util');
+var events = require('cordova-common').events;
+var superspawn = require('cordova-common').superspawn;
+var CordovaError = require('cordova-common').CordovaError;
+var opts = {};
+/*
+-- After pods are installed in a .xcworkspace, all existing ios code needs 
to go into the WORKSPACE file -- will need to 
+create a workspace file and then embed the Xcode project  
+
+- Holly might have done some work on this, see the docs: 
+  https://github.com/phonegap/phonegap-webview-ios not sure how 
applicable it can be to our case
+*/
+function removeProjectFromPath (pathToProjectFile) {
+var array = [];
+//remove the project from the path
+array = pathToProjectFile.split('/');
+array.pop();
+var path = array.join('/');
+return path;
+}
+
+function createPodfile (projectName, pathToProjectFile) {
+var path = removeProjectFromPath(pathToProjectFile);
+var pathToPodfile = path + '/Podfile';
+var podfileText = util.format('platform :ios, \'8.0\'\n\ntarget \'%s\' 
do\n\n  project \'%s\'\n\n  \n\nend' , projectName, pathToProjectFile);
+fs.writeFileSync(pathToPodfile, podfileText);
+}
+
+function editPodfileSync (Podfile, pod, isRemoval) {
+var podfileContents = fs.readFileSync(Podfile, 'utf8');
+//split by \n, add in the pod after the project line, shift the rest 
down
+var podfileContentsArray = podfileContents.split('\n');
+var linesInPodfileToKeep = [];
+
+if (isRemoval) {
+podfileContentsArray.forEach (function (lineInPodfile) {
+//if the line in Podfile is the pod to rm, don't save it to 
new array (to be returned)
+if (!lineInPodfile.includes(pod)){
+linesInPodfileToKeep.push(lineInPodfile); 
+}
+});
+podfileContents = linesInPodfileToKeep.join('\n');
+} else {
+podfileContentsArray.splice(5, 0, pod);
--- End diff --

5 is the line in the Podfile that I am injecting the new pod. Added a var 
to improve readability. 


---
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-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-07-12 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-ios/pull/234#discussion_r70541767
  
--- Diff: bin/templates/scripts/cordova/lib/podMod.js ---
@@ -0,0 +1,162 @@
+var fs = require('fs');
+var util = require('util');
+var events = require('cordova-common').events;
+var superspawn = require('cordova-common').superspawn;
+var CordovaError = require('cordova-common').CordovaError;
+var opts = {};
+/*
+-- After pods are installed in a .xcworkspace, all existing ios code needs 
to go into the WORKSPACE file -- will need to 
+create a workspace file and then embed the Xcode project  
+
+- Holly might have done some work on this, see the docs: 
+  https://github.com/phonegap/phonegap-webview-ios not sure how 
applicable it can be to our case
+*/
+function removeProjectFromPath (pathToProjectFile) {
+var array = [];
+//remove the project from the path
+array = pathToProjectFile.split('/');
+array.pop();
+var path = array.join('/');
+return path;
+}
+
+function createPodfile (projectName, pathToProjectFile) {
+var path = removeProjectFromPath(pathToProjectFile);
+var pathToPodfile = path + '/Podfile';
+var podfileText = util.format('platform :ios, \'8.0\'\n\ntarget \'%s\' 
do\n\n  project \'%s\'\n\n  \n\nend' , projectName, pathToProjectFile);
+fs.writeFileSync(pathToPodfile, podfileText);
+}
+
+function editPodfileSync (Podfile, pod, isRemoval) {
+var podfileContents = fs.readFileSync(Podfile, 'utf8');
+//split by \n, add in the pod after the project line, shift the rest 
down
+var podfileContentsArray = podfileContents.split('\n');
+var linesInPodfileToKeep = [];
+
+if (isRemoval) {
+podfileContentsArray.forEach (function (lineInPodfile) {
--- End diff --

👍 


---
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-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-07-12 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-ios/pull/234#discussion_r70534998
  
--- Diff: bin/templates/scripts/cordova/lib/plugman/pluginHandlers.js ---
@@ -66,17 +66,19 @@ var handlers = {
 install:function(obj, plugin, project, options) {
 var src = obj.src,
 custom = obj.custom;
-
 if (!custom) {
 var keepFrameworks = keep_these_frameworks;
 
-if (keepFrameworks.indexOf(src) < 0) {
-project.xcode.addFramework(src, {weak: obj.weak});
-project.frameworks[src] = (project.frameworks[src] || 
0) + 1;
+if (keepFrameworks.indexOf(src) < 0) { 
+if (obj.type === 'podspec') {
+//podspec handled in Api.js
+} else {
+project.frameworks[src] = (project.frameworks[src] 
|| 0) + 1;
--- End diff --

Changed to

project.frameworks[src] = project.frameworks[src] || 0;
project.frameworks[src]++;

for now, should definitely be refactored in the future.


---
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-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-07-12 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-ios/pull/234#discussion_r70534885
  
--- Diff: bin/templates/scripts/cordova/lib/plugman/pluginHandlers.js ---
@@ -91,18 +93,29 @@ var handlers = {
 }
 },
 uninstall:function(obj, plugin, project, options) {
+var podsJSON = require(path.join(project.projectDir, 
'pods.json'));
 var src = obj.src;
 
 if (!obj.custom) {
 var keepFrameworks = keep_these_frameworks;
-
 if (keepFrameworks.indexOf(src) < 0) {
-project.frameworks[src] -= (project.frameworks[src] || 
1) - 1;
-if (project.frameworks[src] < 1) {
-// Only remove non-custom framework from xcode 
project
-// if there is no references remains
-project.xcode.removeFramework(src);
-delete project.frameworks[src];
+if (obj.type === 'podspec') {
+if(podsJSON[src]) {
+if((podsJSON[src].count - 1) > 0) {
+podsJSON[src].count = podsJSON[src].count 
- 1;
+} else {
+delete podsJSON[src];
+}
+}
+} else {
+project.frameworks[src] -= 
(project.frameworks[src] || 1) - 1;
--- End diff --

Changed to 

`project.frameworks[src] = project.frameworks[src] || 1;
project.frameworks[src]--;`

for now, should definitely be refactored in the future. 


---
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-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-07-12 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-ios/pull/234#discussion_r70526583
  
--- Diff: bin/templates/scripts/cordova/lib/podMod.js ---
@@ -0,0 +1,162 @@
+var fs = require('fs');
+var util = require('util');
+var events = require('cordova-common').events;
+var superspawn = require('cordova-common').superspawn;
+var CordovaError = require('cordova-common').CordovaError;
+var opts = {};
+/*
+-- After pods are installed in a .xcworkspace, all existing ios code needs 
to go into the WORKSPACE file -- will need to 
+create a workspace file and then embed the Xcode project  
+
+- Holly might have done some work on this, see the docs: 
+  https://github.com/phonegap/phonegap-webview-ios not sure how 
applicable it can be to our case
+*/
+function removeProjectFromPath (pathToProjectFile) {
+var array = [];
+//remove the project from the path
+array = pathToProjectFile.split('/');
+array.pop();
+var path = array.join('/');
+return path;
+}
+
+function createPodfile (projectName, pathToProjectFile) {
+var path = removeProjectFromPath(pathToProjectFile);
+var pathToPodfile = path + '/Podfile';
--- End diff --

👍 


---
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-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-07-12 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-ios/pull/234#discussion_r70507754
  
--- Diff: bin/templates/scripts/cordova/Api.js ---
@@ -217,6 +214,90 @@ Api.prototype.addPlugin = function (plugin, 
installOptions) {
 
 return PluginManager.get(this.platform, this.locations, xcodeproj)
 .addPlugin(plugin, installOptions)
+.then(function() {
+var project_dir = this.locations.root;
+var project_path = this.locations.xcodeProjDir;
+var project_name = 
this.locations.xcodeCordovaProj.split('/').pop();
+var array_of_pod_objects = [];
+
+if (plugin.getFrameworks(this.platform).length === 0) return;
+events.emit('verbose', 'Looking into adding pods since the 
plugin contained ');
+
+var pods_file = path.join(project_dir, 'pods.json');
+var pods = {};
+
+try {
+delete require.cache[require.resolve(pods_file)];
+pods = require(pods_file);
+} catch (e) { 
+/* no pods.json exists */ 
+// create an empty pods.json file 
+fs.writeFileSync(pods_file, JSON.stringify({}));
+delete require.cache[require.resolve(pods_file)];
+pods = require(pods_file);
+}  
+
+var podMod = require('./lib/podMod');
+var frameworkTags = plugin.getFrameworks(this.platform);
+
+// check if any of the framework tags are of type "podspec" 
+frameworkTags.forEach(function (obj) { 
+if (obj.type == 'podspec') {
+array_of_pod_objects.push(obj);
+}
+});
+
+var podIsAlreadyInPodfile;
+
+array_of_pod_objects.forEach(function (obj) {
+//check if pod already exists, if so if spec has changed 
+//if pods.json does not exist yet, create it
+// if it does not exist, only overwrite the type and spec, 
NOT the count
+var nameOfPod = obj.src;
+
+if(!pods[nameOfPod]) {
+pods[nameOfPod] = {'type': obj.type, 'spec': obj.spec};
+podIsAlreadyInPodfile = false;
+} else {
+pods[nameOfPod].type = obj.type;
+pods[nameOfPod].spec = obj.spec;
+podIsAlreadyInPodfile = true;
+}
+
+// add a count incase multiple plugins depend on it.
+if (pods[nameOfPod].count) {
+pods[nameOfPod].count = pods[nameOfPod].count + 1;
+} else {
+pods[nameOfPod].count = 1;
+} 
+
+function addToPodfile (callback) {
--- End diff --

👍 


---
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-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-07-12 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-ios/pull/234#discussion_r70507813
  
--- Diff: bin/templates/scripts/cordova/Api.js ---
@@ -236,10 +317,50 @@ Api.prototype.addPlugin = function (plugin, 
installOptions) {
  *   CordovaError instance.
  */
 Api.prototype.removePlugin = function (plugin, uninstallOptions) {
-
 var xcodeproj = projectFile.parse(this.locations);
 return PluginManager.get(this.platform, this.locations, xcodeproj)
 .removePlugin(plugin, uninstallOptions)
+.then(function() {
+if (plugin.getFrameworks(this.platform).length === 0) return;
+console.log('Looking into removing pods since the plugin 
contained ');
+//require script to run pod remove
+//pods.json might not exist (if not pods were removed). 
+//the pod will already be removed from pods.json at this 
stage
+//need to check podfile and see if a pod exists in podfile 
that doesn't exist in pods.json. If so, remove it.
+
+// which pods are in the plugin? 
+var frameworkTags = plugin.getFrameworks(this.platform);
+var project_dir = this.locations.root;
+var pods_file = path.join(project_dir, 'pods.json');
+var array_of_pod_objects = [];
+
+delete require.cache[require.resolve(pods_file)];
+var pods = require(pods_file);
+
+// check if any of the framework tags are of type 
"podspec" 
+frameworkTags.forEach(function (obj) { 
--- End diff --

👍 


---
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-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-07-12 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-ios/pull/234#discussion_r70496395
  
--- Diff: bin/templates/scripts/cordova/Api.js ---
@@ -217,6 +214,90 @@ Api.prototype.addPlugin = function (plugin, 
installOptions) {
 
 return PluginManager.get(this.platform, this.locations, xcodeproj)
 .addPlugin(plugin, installOptions)
+.then(function() {
+var project_dir = this.locations.root;
+var project_path = this.locations.xcodeProjDir;
+var project_name = 
this.locations.xcodeCordovaProj.split('/').pop();
+var array_of_pod_objects = [];
+
+if (plugin.getFrameworks(this.platform).length === 0) return;
+events.emit('verbose', 'Looking into adding pods since the 
plugin contained ');
+
+var pods_file = path.join(project_dir, 'pods.json');
+var pods = {};
+
+try {
+delete require.cache[require.resolve(pods_file)];
+pods = require(pods_file);
+} catch (e) { 
+/* no pods.json exists */ 
+// create an empty pods.json file 
+fs.writeFileSync(pods_file, JSON.stringify({}));
+delete require.cache[require.resolve(pods_file)];
+pods = require(pods_file);
+}  
+
+var podMod = require('./lib/podMod');
+var frameworkTags = plugin.getFrameworks(this.platform);
+
+// check if any of the framework tags are of type "podspec" 
+frameworkTags.forEach(function (obj) { 
+if (obj.type == 'podspec') {
+array_of_pod_objects.push(obj);
+}
+});
+
+var podIsAlreadyInPodfile;
+
+array_of_pod_objects.forEach(function (obj) {
+//check if pod already exists, if so if spec has changed 
+//if pods.json does not exist yet, create it
+// if it does not exist, only overwrite the type and spec, 
NOT the count
+var nameOfPod = obj.src;
+
+if(!pods[nameOfPod]) {
+pods[nameOfPod] = {'type': obj.type, 'spec': obj.spec};
+podIsAlreadyInPodfile = false;
+} else {
+pods[nameOfPod].type = obj.type;
+pods[nameOfPod].spec = obj.spec;
+podIsAlreadyInPodfile = true;
+}
+
+// add a count incase multiple plugins depend on it.
+if (pods[nameOfPod].count) {
+pods[nameOfPod].count = pods[nameOfPod].count + 1;
+} else {
+pods[nameOfPod].count = 1;
+} 
+
+function addToPodfile (callback) {
+podMod.installPodSync(project_name, project_path, 
nameOfPod, obj.spec, pods_file); 
+events.emit('verbose', 'About to add ' + nameOfPod + ' 
to pods json');
+callback();
+}
+
+//write out updated pods.json, 
+// keep track of the order of the pods
+function addToPodsJSON () {
+try { 
+fs.writeFileSync(pods_file, JSON.stringify(pods, 
null, 4));
+} catch (e) {
+throw new CordovaError('\nPod was not able to be 
added to pods.json in Api.js\n\n' + e);
+}
+}
+
+if (podIsAlreadyInPodfile) {
+addToPodsJSON();
+} else if (!podIsAlreadyInPodfile) {
+//add the pods to the Podfile, then add to pods.json
+addToPodfile(addToPodsJSON);
--- End diff --

👍 Thanks!


---
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-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-07-12 Thread juliascript
Github user juliascript commented on a diff in the pull request:

https://github.com/apache/cordova-ios/pull/234#discussion_r70491773
  
--- Diff: bin/templates/scripts/cordova/Api.js ---
@@ -217,6 +214,90 @@ Api.prototype.addPlugin = function (plugin, 
installOptions) {
 
 return PluginManager.get(this.platform, this.locations, xcodeproj)
 .addPlugin(plugin, installOptions)
+.then(function() {
+var project_dir = this.locations.root;
+var project_path = this.locations.xcodeProjDir;
+var project_name = 
this.locations.xcodeCordovaProj.split('/').pop();
+var array_of_pod_objects = [];
+
+if (plugin.getFrameworks(this.platform).length === 0) return;
+events.emit('verbose', 'Looking into adding pods since the 
plugin contained ');
+
+var pods_file = path.join(project_dir, 'pods.json');
+var pods = {};
+
+try {
+delete require.cache[require.resolve(pods_file)];
+pods = require(pods_file);
+} catch (e) { 
+/* no pods.json exists */ 
+// create an empty pods.json file 
+fs.writeFileSync(pods_file, JSON.stringify({}));
+delete require.cache[require.resolve(pods_file)];
+pods = require(pods_file);
+}  
+
+var podMod = require('./lib/podMod');
+var frameworkTags = plugin.getFrameworks(this.platform);
+
+// check if any of the framework tags are of type "podspec" 
+frameworkTags.forEach(function (obj) { 
--- End diff --

Will do, thank you! 


---
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-ios pull request #234: CB-9825 cocoapod integration for plugins

2016-07-01 Thread juliascript
GitHub user juliascript opened a pull request:

https://github.com/apache/cordova-ios/pull/234

CB-9825 cocoapod integration for plugins



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

$ git pull https://github.com/juliascript/cordova-ios CB-9825

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

https://github.com/apache/cordova-ios/pull/234.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 #234


commit 16e64a6eabe2ce17ec2f29a7406fade062651c7a
Author: juliascript <juliageis...@gmail.com>
Date:   2016-07-01T18:51:36Z

CB-9825 cocoapod integration for plugins




---
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 #461: CB-9825 framework tag spec parsing

2016-07-01 Thread juliascript
GitHub user juliascript opened a pull request:

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

CB-9825 framework tag spec parsing



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

$ git pull https://github.com/juliascript/cordova-lib CB-9825

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

https://github.com/apache/cordova-lib/pull/461.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 #461


commit 544a6aefdf4dbbb18e3ef7d890001c49bd1bd20d
Author: juliascript <juliageis...@gmail.com>
Date:   2016-07-01T18:42:45Z

CB-9825 framework tag spec parsing




---
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-ios pull request #226: Add one cocoapod to Cordova project

2016-06-02 Thread juliascript
Github user juliascript closed the pull request at:

https://github.com/apache/cordova-ios/pull/226


---
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-ios pull request #226: Add one cocoapod to Cordova project

2016-06-02 Thread juliascript
GitHub user juliascript opened a pull request:

https://github.com/apache/cordova-ios/pull/226

Add one cocoapod to Cordova project

To use: 

var podMod = require('./installPods.js');

podMod.installPodsSync ('HelloCordova', './HelloCordova', 
'GoogleAnalytics'); 
//or
podMod.installPodsSync ('HelloCordova', './HelloCordova', 'AFNetworking', 
'~> 2.0');  

*** Works only for one pod at the moment -- calling it more than once will 
overwrite any previous pods *** 

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

$ git pull https://github.com/juliascript/cordova-ios 
CB-9825-cocoapod-install

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

https://github.com/apache/cordova-ios/pull/226.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 #226


commit 04d1f87cad4c47c3f470c5a6fc69582ab06a1394
Author: juliascript <juliageis...@gmail.com>
Date:   2016-06-02T23:32:55Z

Add one cocoapod to Cordova project




---
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