Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit f380a5d

Browse files
Merge pull request #528 from telerik/vladimirov/fix-cocoapod-version-check
Fix getting of cocoapod version
2 parents fbebba6 + 5dd17ba commit f380a5d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

sys-info-base.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class SysInfoBase implements ISysInfo {
5555
res.xcodeVer = this.$hostInfo.isDarwin ? this.exec("xcodebuild -version") : null;
5656
res.itunesInstalled = this.$iTunesValidator.getError().wait() === null;
5757

58-
res.cocoapodVer = this.$hostInfo.isDarwin ? this.exec("pod --version") : null;
58+
res.cocoapodVer = this.getCocoapodVersion();
5959
let pathToAdb = androidToolsInfo ? androidToolsInfo.pathToAdb : "adb";
6060
let pathToAndroid = androidToolsInfo ? androidToolsInfo.pathToAndroid : "android";
6161

@@ -152,5 +152,20 @@ export class SysInfoBase implements ISysInfo {
152152
return output ? /javac (.*)/i.exec(output.stderr)[1]: null;
153153
}).future<string>()();
154154
}
155+
156+
private getCocoapodVersion(): string {
157+
if(this.$hostInfo.isDarwin) {
158+
let cocoapodVersion = this.exec("pod --version");
159+
// Output of pod --version could contain some warnings. Find the version in it.
160+
let cocoapodVersionMatch = cocoapodVersion.match(/^((?:\d+\.){2}\d+.*?)$/gm);
161+
if(cocoapodVersionMatch && cocoapodVersionMatch[0]) {
162+
cocoapodVersion = cocoapodVersionMatch[0].trim();
163+
}
164+
165+
return cocoapodVersion;
166+
}
167+
168+
return null;
169+
}
155170
}
156171
$injector.register("sysInfoBase", SysInfoBase);

0 commit comments

Comments
 (0)