Skip to content

Commit

Permalink
Add check for newer versions of cocoapods, avoid checking synced repo…
Browse files Browse the repository at this point in the history
… as those use CDN.
  • Loading branch information
renanccastro committed Nov 20, 2019
1 parent 9964c74 commit 068ec56
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions bin/templates/scripts/cordova/lib/check_reqs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const Q = require('q');
const shell = require('shelljs');
const util = require('util');
const versions = require('./versions');
const semver = require('semver');

const SUPPORTED_OS_PLATFORMS = [ 'darwin' ];

Expand Down Expand Up @@ -121,15 +122,23 @@ 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) {
let podVersion = shell.exec('pod --version', { silent: true });
if (podVersion && podVersion.output) {
const version = podVersion.output.trim();
// starting with 1.8.0 cocoapods now use cdn and we dont need to sync first
if (semver.gte(version, '1.8.0') || toolOptions.ignore) {
return toolOptions;
}
}
let code = shell.exec('pod repo | grep -e "^0 repos"', { silent: true }).code;
let repoIsSynced = (code !== 0);

if (toolOptions.ignore || 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);
}
});
};
Expand Down

0 comments on commit 068ec56

Please sign in to comment.