Skip to content

Commit

Permalink
(iOS) (Bug fix) Use regex to extract cocoapods from stdout when verif…
Browse files Browse the repository at this point in the history
…ying cocoapods version during plugin install. Resolves #462.
  • Loading branch information
Dave Alden committed Jul 16, 2020
1 parent fe1fde0 commit d02692c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/ios/before_plugin_install.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ module.exports = function(context) {
};

function checkCocoapodsVersion(){
var stdout;
var version;
try{
stdout = execSync('pod --version', {encoding: 'utf8'}).trim();
version = execSync('pod --version', {encoding: 'utf8'}).match(/(\d+\.\d+\.\d+)/)[1];
}catch(err){
throw new Error("cocoapods not found - please install cocoapods >="+minCocoapodsVersion);
}

if(!semver.valid(stdout)){
throw new Error("cocoapods version is invalid - please reinstall cocoapods@"+minCocoapodsVersion + ": "+stdout);
}else if(!semver.satisfies(stdout, minCocoapodsVersion)){
throw new Error("cocoapods version is out-of-date - please update to cocoapods@"+minCocoapodsVersion + " - current version: "+stdout);
if(!semver.valid(version)){
throw new Error("cocoapods version is invalid - please reinstall cocoapods@"+minCocoapodsVersion + ": "+version);
}else if(!semver.satisfies(version, minCocoapodsVersion)){
throw new Error("cocoapods version is out-of-date - please update to cocoapods@"+minCocoapodsVersion + " - current version: "+version);
}
}

0 comments on commit d02692c

Please sign in to comment.