Skip to content

Commit 5f586a0

Browse files
mfikesdrapanjanas
authored andcommitted
Open xcworkspace (CocoaPods support) (#197)
Fixes #196
1 parent ce14d38 commit 5f586a0

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ Packager so try to avoid doing so.
415415
- You can launch your app on the simulator without opening Xcode by running
416416
`react-native run-ios` in your app's root directory (since RN 0.19.0).
417417

418-
- To change advanced settings run `re-natal xcode` to quickly open the Xcode project.
418+
- To change advanced settings run `re-natal xcode` to quickly open the Xcode project. (A workspace
419+
will be opened in preference to a project if present.)
419420

420421
- If you have customized project layout and `re-natal upgrade` does not fit you well,
421422
then these commands might be useful for you:
@@ -450,7 +451,7 @@ $ node ../re-natal/index.js
450451
init [options] <name> create a new ClojureScript React Native project
451452
upgrade upgrades project files to current installed version of re-natal (the upgrade of re-natal itself is done via npm)
452453
add-platform <platform> adds additional app platform: 'windows' - UWP app, 'wpf' - WPF app
453-
xcode open Xcode project
454+
xcode open Xcode project (or workspace if present)
454455
deps install all dependencies for the project
455456
use-figwheel generate index.*.js for development with figwheel
456457
use-android-device <type> sets up the host for android device type: 'real' - localhost, 'avd' - 10.0.2.2, 'genymotion' - 10.0.3.2, IP

re-natal.coffee

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,17 +675,21 @@ addPlatform = (platform) ->
675675
logErr message
676676

677677
openXcode = (name) ->
678+
if fs.existsSync "ios/#{name}.xcworkspace"
679+
openTarget = "#{name}.xcworkspace"
680+
else
681+
openTarget = "#{name}.xcodeproj"
678682
try
679-
exec "open ios/#{name}.xcodeproj"
683+
exec "open ios/#{openTarget}"
680684
catch {message}
681685
logErr \
682686
if message.match /ENOENT/i
683687
"""
684-
Cannot find #{name}.xcodeproj in ios.
688+
Cannot find #{openTarget} in ios.
685689
Run this command from your project's root directory.
686690
"""
687691
else if message.match /EACCES/i
688-
"Invalid permissions for opening #{name}.xcodeproj in ios"
692+
"Invalid permissions for opening #{openTarget} in ios"
689693
else
690694
message
691695

@@ -941,7 +945,7 @@ cli.command 'add-platform <platform>'
941945
addPlatform(platform)
942946

943947
cli.command 'xcode'
944-
.description 'open Xcode project'
948+
.description 'open Xcode project (or workspace if present)'
945949
.action ->
946950
ensureOSX ->
947951
ensureXcode ->

0 commit comments

Comments
 (0)