Skip to content

Create main target scheme before installing pods. #848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 2, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,9 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
// Check availability
try {
this.$childProcess.exec("gem which cocoapods").wait();
this.$childProcess.exec("gem which xcodeproj").wait();
} catch(e) {
this.$errors.failWithoutHelp("CocoaPods are not installed. Run `sudo gem install cocoapods` and try again.");
this.$errors.failWithoutHelp("CocoaPods or ruby gem 'xcodeproj' is not installed. Run `sudo gem install cocoapods` and try again.");
}

let projectPodfileContent = this.$fs.readText(this.projectPodFilePath).wait();
Expand All @@ -347,7 +348,14 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
if(firstPostInstallIndex !== -1 && firstPostInstallIndex !== projectPodfileContent.lastIndexOf(IOSProjectService.PODFILE_POST_INSTALL_SECTION_NAME)) {
this.$logger.warn(`Podfile contains more than one post_install sections. You need to open ${this.projectPodFilePath} file and manually resolve this issue.`);
}


let pbxprojFilePath = path.join(this.platformData.projectRoot, this.$projectData.projectName + IOSProjectService.XCODE_PROJECT_EXT_NAME, "xcuserdata");
if(!this.$fs.exists(pbxprojFilePath).wait()) {
this.$logger.info("Creating project scheme...");
let createSchemeRubyScript = `ruby -e "require 'xcodeproj'; xcproj = Xcodeproj::Project.open('${this.$projectData.projectName}.xcodeproj'); xcproj.recreate_user_schemes; xcproj.save"`;
this.$childProcess.exec(createSchemeRubyScript, { cwd: this.platformData.projectRoot }).wait();
}

this.$logger.info("Installing pods...");
this.$childProcess.exec("pod install", { cwd: this.platformData.projectRoot }).wait();
}
Expand Down