Skip to content

Commit 174185a

Browse files
committed
Fix coding style. Use ruby one-liners syntax. Add check for xcodeproj gem.
1 parent ae3d5c0 commit 174185a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/services/ios-project-service.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,9 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
335335
// Check availability
336336
try {
337337
this.$childProcess.exec("gem which cocoapods").wait();
338+
this.$childProcess.exec("gem which xcodeproj").wait();
338339
} catch(e) {
339-
this.$errors.failWithoutHelp("CocoaPods are not installed. Run `sudo gem install cocoapods` and try again.");
340+
this.$errors.failWithoutHelp("CocoaPods or ruby gem 'xcodeproj' is not installed. Run `sudo gem install cocoapods` and try again.");
340341
}
341342

342343
let projectPodfileContent = this.$fs.readText(this.projectPodFilePath).wait();
@@ -351,8 +352,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
351352
let pbxprojFilePath = path.join(this.platformData.projectRoot, this.$projectData.projectName + IOSProjectService.XCODE_PROJECT_EXT_NAME, "xcuserdata");
352353
if(!this.$fs.exists(pbxprojFilePath).wait()) {
353354
this.$logger.info("Creating project scheme...");
354-
let createScheme_rb = `echo \"require 'xcodeproj'; xcproj = Xcodeproj::Project.open('${this.$projectData.projectName}.xcodeproj'); xcproj.recreate_user_schemes; xcproj.save\" | ruby`;
355-
this.$childProcess.exec(createScheme_rb, { cwd: this.platformData.projectRoot }).wait();
355+
let createSchemeRubyScript = `ruby -e require 'xcodeproj'; xcproj = Xcodeproj::Project.open('${this.$projectData.projectName}.xcodeproj'); xcproj.recreate_user_schemes; xcproj.save`;
356+
this.$childProcess.exec(createSchemeRubyScript, { cwd: this.platformData.projectRoot }).wait();
356357
}
357358

358359
this.$logger.info("Installing pods...");

0 commit comments

Comments
 (0)