Skip to content

Commit 5f64acd

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Check cocoapods availability before executing pod install
1 parent 0b42cc9 commit 5f64acd

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lib/services/ios-project-service.ts

+14-10
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
410410
public afterPrepareAllPlugins(): IFuture<void> {
411411
return (() => {
412412
if(this.$fs.exists(this.projectPodFilePath).wait()) {
413-
// Check availability
414-
try {
415-
this.$childProcess.exec("gem which cocoapods").wait();
416-
this.$childProcess.exec("gem which xcodeproj").wait();
417-
} catch(e) {
418-
this.$errors.failWithoutHelp("CocoaPods or ruby gem 'xcodeproj' is not installed. Run `sudo gem install cocoapods` and try again.");
419-
}
413+
420414

421415
let projectPodfileContent = this.$fs.readText(this.projectPodFilePath).wait();
422416
this.$logger.trace("Project Podfile content");
@@ -499,9 +493,19 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
499493
}
500494

501495
private executePodInstall(): IFuture<any> {
502-
this.$logger.info("Installing pods...");
503-
let podTool = this.$config.USE_POD_SANDBOX ? "sandbox-pod" : "pod";
504-
return this.$childProcess.spawnFromEvent(podTool, ["install"], "close", { cwd: this.platformData.projectRoot, stdio: 'inherit' });
496+
return (() => {
497+
// Check availability
498+
try {
499+
this.$childProcess.exec("gem which cocoapods").wait();
500+
this.$childProcess.exec("gem which xcodeproj").wait();
501+
} catch(e) {
502+
this.$errors.failWithoutHelp("CocoaPods or ruby gem 'xcodeproj' is not installed. Run `sudo gem install cocoapods` and try again.");
503+
}
504+
505+
this.$logger.info("Installing pods...");
506+
let podTool = this.$config.USE_POD_SANDBOX ? "sandbox-pod" : "pod";
507+
this.$childProcess.spawnFromEvent(podTool, ["install"], "close", { cwd: this.platformData.projectRoot, stdio: 'inherit' }).wait();
508+
});
505509
}
506510

507511
private prepareFrameworks(pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> {

0 commit comments

Comments
 (0)