Skip to content

Commit 0c22afb

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

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

lib/services/ios-project-service.ts

+13-11
Original file line numberDiff line numberDiff line change
@@ -410,14 +410,6 @@ 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-
}
420-
421413
let projectPodfileContent = this.$fs.readText(this.projectPodFilePath).wait();
422414
this.$logger.trace("Project Podfile content");
423415
this.$logger.trace(projectPodfileContent);
@@ -499,9 +491,19 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
499491
}
500492

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

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

0 commit comments

Comments
 (0)