Skip to content

Commit a35d03e

Browse files
committed
Merge branch 'master' of github.com:drapanjanas/re-natal
2 parents 0fe94c0 + 5f586a0 commit a35d03e

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
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: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -690,17 +690,21 @@ addPlatform = (platform) ->
690690
logErr message
691691

692692
openXcode = (name) ->
693+
if fs.existsSync "ios/#{name}.xcworkspace"
694+
openTarget = "#{name}.xcworkspace"
695+
else
696+
openTarget = "#{name}.xcodeproj"
693697
try
694-
exec "open ios/#{name}.xcodeproj"
698+
exec "open ios/#{openTarget}"
695699
catch {message}
696700
logErr \
697701
if message.match /ENOENT/i
698702
"""
699-
Cannot find #{name}.xcodeproj in ios.
703+
Cannot find #{openTarget} in ios.
700704
Run this command from your project's root directory.
701705
"""
702706
else if message.match /EACCES/i
703-
"Invalid permissions for opening #{name}.xcodeproj in ios"
707+
"Invalid permissions for opening #{openTarget} in ios"
704708
else
705709
message
706710

@@ -733,7 +737,8 @@ extractRequiresFromSourceFile = (file) ->
733737

734738
buildRequireByPlatformMap = () ->
735739
onlyUserCljs = (item) -> fpath.extname(item.path) == '.cljs' and
736-
item.path.indexOf('/target/') < 0 # ignore target dir
740+
item.path.indexOf('/target/') < 0 and # ignore target dir
741+
item.path.indexOf('/re-natal/') < 0 # ignore re-natal internal cljs files (can happen if re-natal is installed as a devDependency)
737742
files = klawSync process.cwd(),
738743
nodir: true
739744
filter: onlyUserCljs
@@ -955,7 +960,7 @@ cli.command 'add-platform <platform>'
955960
addPlatform(platform)
956961

957962
cli.command 'xcode'
958-
.description 'open Xcode project'
963+
.description 'open Xcode project (or workspace if present)'
959964
.action ->
960965
ensureOSX ->
961966
ensureXcode ->

0 commit comments

Comments
 (0)