From 32150aca67b6ca29de09608a55b9da20b7fc6708 Mon Sep 17 00:00:00 2001 From: Mike Fikes Date: Tue, 2 Oct 2018 14:42:35 -0400 Subject: [PATCH] Open xcworkspace (CocoaPods support) Fixes #42 --- README.md | 5 +++-- re-natal.coffee | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2acead5..4e8424d 100644 --- a/README.md +++ b/README.md @@ -415,7 +415,8 @@ Packager so try to avoid doing so. - You can launch your app on the simulator without opening Xcode by running `react-native run-ios` in your app's root directory (since RN 0.19.0). -- To change advanced settings run `re-natal xcode` to quickly open the Xcode project. +- To change advanced settings run `re-natal xcode` to quickly open the Xcode project. (A workspace +will be opened in preference to a project if present.) - If you have customized project layout and `re-natal upgrade` does not fit you well, then these commands might be useful for you: @@ -450,7 +451,7 @@ $ node ../re-natal/index.js init [options] create a new ClojureScript React Native project upgrade upgrades project files to current installed version of re-natal (the upgrade of re-natal itself is done via npm) add-platform adds additional app platform: 'windows' - UWP app, 'wpf' - WPF app - xcode open Xcode project + xcode open Xcode project (or workspace if present) deps install all dependencies for the project use-figwheel generate index.*.js for development with figwheel use-android-device sets up the host for android device type: 'real' - localhost, 'avd' - 10.0.2.2, 'genymotion' - 10.0.3.2, IP diff --git a/re-natal.coffee b/re-natal.coffee index e67eeb8..4b5019a 100644 --- a/re-natal.coffee +++ b/re-natal.coffee @@ -675,17 +675,21 @@ addPlatform = (platform) -> logErr message openXcode = (name) -> + if fs.existsSync "ios/#{name}.xcworkspace" + openTarget = "#{name}.xcworkspace" + else + openTarget = "#{name}.xcodeproj" try - exec "open ios/#{name}.xcodeproj" + exec "open ios/#{openTarget}" catch {message} logErr \ if message.match /ENOENT/i """ - Cannot find #{name}.xcodeproj in ios. + Cannot find #{openTarget} in ios. Run this command from your project's root directory. """ else if message.match /EACCES/i - "Invalid permissions for opening #{name}.xcodeproj in ios" + "Invalid permissions for opening #{openTarget} in ios" else message @@ -941,7 +945,7 @@ cli.command 'add-platform ' addPlatform(platform) cli.command 'xcode' - .description 'open Xcode project' + .description 'open Xcode project (or workspace if present)' .action -> ensureOSX -> ensureXcode ->