Skip to content

Commit d5d3c99

Browse files
FatmeFatme
Fatme
authored and
Fatme
committed
Merge pull request #1104 from NativeScript/fatme/pod-availability
Check cocoapods availability before executing pod install
2 parents 6dd1b57 + 0c22afb commit d5d3c99

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
@@ -418,14 +418,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
418418
public afterPrepareAllPlugins(): IFuture<void> {
419419
return (() => {
420420
if(this.$fs.exists(this.projectPodFilePath).wait()) {
421-
// Check availability
422-
try {
423-
this.$childProcess.exec("gem which cocoapods").wait();
424-
this.$childProcess.exec("gem which xcodeproj").wait();
425-
} catch(e) {
426-
this.$errors.failWithoutHelp("CocoaPods or ruby gem 'xcodeproj' is not installed. Run `sudo gem install cocoapods` and try again.");
427-
}
428-
429421
let projectPodfileContent = this.$fs.readText(this.projectPodFilePath).wait();
430422
this.$logger.trace("Project Podfile content");
431423
this.$logger.trace(projectPodfileContent);
@@ -507,9 +499,19 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
507499
}
508500

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

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

0 commit comments

Comments
 (0)