You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2019/11/22 04:27:05 UTC

[cordova-ios] branch master updated: Add check for newer versions of cocoapods to avoid locking adding platforms on non synced pods repo (#719)

This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git


The following commit(s) were added to refs/heads/master by this push:
     new 094779f  Add check for newer versions of cocoapods to avoid locking adding platforms on non synced pods repo (#719)
094779f is described below

commit 094779f6601a71eee489a1bae7a67cf91e8409c9
Author: Renan Castro <re...@gmail.com>
AuthorDate: Fri Nov 22 01:26:54 2019 -0300

    Add check for newer versions of cocoapods to avoid locking adding platforms on non synced pods repo (#719)
    
    * Add check for newer versions of cocoapods, avoid checking synced repo as those use CDN.
    * Fail early on unsupported hosts
    * Use toolOptions.version and versions.compareVersions
---
 bin/templates/scripts/cordova/lib/check_reqs.js | 13 ++++++++++---
 tests/spec/unit/lib/check_reqs.spec.js          |  2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/bin/templates/scripts/cordova/lib/check_reqs.js b/bin/templates/scripts/cordova/lib/check_reqs.js
index 85a0c3e..f786fc4 100644
--- a/bin/templates/scripts/cordova/lib/check_reqs.js
+++ b/bin/templates/scripts/cordova/lib/check_reqs.js
@@ -121,15 +121,22 @@ module.exports.check_cocoapods = function (toolChecker) {
         // check whether the cocoapods repo has been synced through `pod repo` command
         // a value of '0 repos' means it hasn't been synced
         .then(function (toolOptions) {
+            if (toolOptions.ignore) return toolOptions;
+
+            // starting with 1.8.0 cocoapods now use cdn and we dont need to sync first
+            if (versions.compareVersions(toolOptions.version, '1.8.0') >= 0) {
+                return toolOptions;
+            }
+
             let code = shell.exec('pod repo | grep -e "^0 repos"', { silent: true }).code;
             let repoIsSynced = (code !== 0);
 
-            if (toolOptions.ignore || repoIsSynced) {
+            if (repoIsSynced) {
                 // return check_cocoapods_repo_size();
                 // we could check the repo size above, but it takes too long.
-                return Q.resolve(toolOptions);
+                return toolOptions;
             } else {
-                return Q.reject(COCOAPODS_NOT_SYNCED_MESSAGE);
+                return Promise.reject(COCOAPODS_NOT_SYNCED_MESSAGE);
             }
         });
 };
diff --git a/tests/spec/unit/lib/check_reqs.spec.js b/tests/spec/unit/lib/check_reqs.spec.js
index 804b6b1..c93e365 100644
--- a/tests/spec/unit/lib/check_reqs.spec.js
+++ b/tests/spec/unit/lib/check_reqs.spec.js
@@ -71,7 +71,7 @@ describe('check_reqs', function () {
         let toolsChecker;
         beforeEach(() => {
             toolsChecker = jasmine.createSpy('toolsChecker')
-                .and.returnValue(Promise.resolve({}));
+                .and.returnValue(Promise.resolve({ version: '1.2.3' }));
         });
 
         it('should resolve when on an unsupported platform', () => {


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