cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject ios commit: CB-11970 - Support CocoaPod pod specification other than version
Date Sat, 08 Oct 2016 00:49:34 GMT
Repository: cordova-ios
Updated Branches:
  refs/heads/master a956c93e2 -> a527d1a08


CB-11970 - Support CocoaPod pod specification other than version

 This closes #267


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/a527d1a0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/a527d1a0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/a527d1a0

Branch: refs/heads/master
Commit: a527d1a08ee3e3a35ee0f1087c8e19f0946840c7
Parents: a956c93
Author: Shazron Abdullah <shazron@apache.org>
Authored: Fri Oct 7 17:19:16 2016 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Fri Oct 7 17:48:55 2016 -0700

----------------------------------------------------------------------
 bin/templates/scripts/cordova/lib/Podfile.js | 25 ++++++++++++++++-------
 tests/spec/unit/Podfile.spec.js              |  4 +++-
 2 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a527d1a0/bin/templates/scripts/cordova/lib/Podfile.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/Podfile.js b/bin/templates/scripts/cordova/lib/Podfile.js
index 643ce1d..2cf254c 100644
--- a/bin/templates/scripts/cordova/lib/Podfile.js
+++ b/bin/templates/scripts/cordova/lib/Podfile.js
@@ -63,9 +63,10 @@ Podfile.prototype.__parseForPods = function(text) {
     var arr = text.split('\n');
 
     // aim is to match (space insignificant around the comma, comma optional):
-    //     'pod 'Foobar', '1.2'
-    //     'pod 'Foobar', 'abc 123 1.2'    
-    var podRE = new RegExp('pod \'(\\w+)\'\\s*,?(\\s*\'(\\w+|\\d+(\\.\\d)?)+\')?');
+    //     pod 'Foobar', '1.2'
+    //     pod 'Foobar', 'abc 123 1.2'
+    //     pod 'PonyDebugger', :configurations => ['Debug', 'Beta']
+    var podRE = new RegExp('pod \'(\\w+)\'\\s*,?\\s*(.*)');
 
     // only grab lines that don't have the pod spec'
     return arr.filter(function(line) {
@@ -77,7 +78,9 @@ Podfile.prototype.__parseForPods = function(text) {
         var m = podRE.exec(line);
 
         if (m !== null) {
-            obj[m[1]] = m[3]; // i.e pod 'Foo', '1.2' ==> { 'Foo' : '1.2'}
+            // strip out any single quotes around the value m[2]
+            var podSpec = m[2].replace(/^\'|\'$/g, '');
+            obj[m[1]] = podSpec; // i.e pod 'Foo', '1.2' ==> { 'Foo' : '1.2'}
         }
 
         return obj;
@@ -145,9 +148,17 @@ Podfile.prototype.write = function() {
         var name = key;
         var spec = self.pods[key];
 
-        return spec.length?
-            util.format('\tpod \'%s\', \'%s\'', name, spec):
-            util.format('\tpod \'%s\'', name);
+        if (spec.length) {
+            if (spec.indexOf(':') === 0) {
+                // don't quote it, it's a specification (starts with ':')
+                return util.format('\tpod \'%s\', %s', name, spec);
+            } else {
+                // quote it, it's a version
+                return util.format('\tpod \'%s\', \'%s\'', name, spec);
+            }
+        } else {
+            return util.format('\tpod \'%s\'', name);
+        }
     })
     .join('\n');
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a527d1a0/tests/spec/unit/Podfile.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/Podfile.spec.js b/tests/spec/unit/Podfile.spec.js
index 062c528..545e63e 100644
--- a/tests/spec/unit/Podfile.spec.js
+++ b/tests/spec/unit/Podfile.spec.js
@@ -101,6 +101,7 @@ describe('unit tests for Podfile module', function () {
 			podfile.addSpec('Foo', '1.0');
 			podfile.addSpec('Bar', '2.0');
 			podfile.addSpec('Baz', '3.0');
+			podfile.addSpec('Bla', ':configurations => [\'Debug\', \'Beta\']');
 
 			podfile.write();
 
@@ -109,11 +110,12 @@ describe('unit tests for Podfile module', function () {
 			expect(newPodfile.existsSpec('Foo')).toBe(true);
 			expect(newPodfile.existsSpec('Bar')).toBe(true);
 			expect(newPodfile.existsSpec('Baz')).toBe(true);
+			expect(newPodfile.existsSpec('Bla')).toBe(true);
 
 			expect(newPodfile.getSpec('Foo')).toBe(podfile.getSpec('Foo'));
 			expect(newPodfile.getSpec('Bar')).toBe(podfile.getSpec('Bar'));
 			expect(newPodfile.getSpec('Baz')).toBe(podfile.getSpec('Baz'));
-			
+			expect(newPodfile.getSpec('Bla')).toBe(podfile.getSpec('Bla'));
 		});
 
 		it ('runs before_install to install xcconfig paths', function () {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message