Skip to content

Commit b81e8a3

Browse files
committed
Update setup script and use nvm
1 parent d132648 commit b81e8a3

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.14.0

script/setup

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ function log() {
1010
echo "======================================="
1111
}
1212

13-
14-
15-
EXPECTED_RUBY_VERSION=$(cat ${SOURCE_ROOT_DIR}/.ruby-version)
16-
ruby_version="2.4.4"
17-
rbenv_version="2.5.7"
18-
1913
log "🏎️ Running React native setup script 🏎️"
2014

2115
log "📱 Installing xcode tools 📱"
@@ -28,8 +22,8 @@ fi
2822
echo "Xcode CommandLineTools installed 👍"
2923

3024
if ! [ -x "$(command -v xcode-select)" ]; then
31-
echo "⚠️ You need Xcode to setuo this project. Please install and rerun this script ⚠️"
32-
exit 1s
25+
echo "⚠️ You need Xcode to setup this project. Please install and rerun this script ⚠️"
26+
exit 1
3327
fi
3428

3529
log "👀 Looking for Homebrew 👀"
@@ -43,19 +37,31 @@ else
4337
fi
4438

4539
log "👀 Looking for rbenv 👀"
46-
4740
if ! [ -x "$(command -v rbenv)" ]; then
4841
echo "🍺 Installing rbenv with brew 🍺"
49-
brew install rbenv
42+
brew install rbenv ruby-build
5043
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
5144
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
5245
eval "$(rbenv init -)"
53-
rbenv install "2.7.5"
5446
else
55-
rbenv install "2.7.5"
5647
echo "rbenv already installed 👍"
5748
fi
58-
rbenv local "2.7.5"
49+
50+
rbenv install --skip-existing
51+
echo "Ruby setup complete 👍"
52+
53+
log "👀 Looking for nvm 👀"
54+
if ! [ -x "$(command -v nvm)" ]; then
55+
echo "🍺 Installing nvm with brew 🍺"
56+
brew install nvm
57+
fi
58+
59+
# Source nvm
60+
export NVM_DIR="$HOME/.nvm"
61+
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
62+
63+
nvm install
64+
echo "Node.js setup complete 👍"
5965

6066
log "👀 Looking for yarn 👀"
6167
if ! [ -x "$(command -v yarn)" ]; then
@@ -65,16 +71,6 @@ else
6571
echo "yarn already installed 👍"
6672
fi
6773

68-
log "👀 Looking for ruby 👀"
69-
ruby-build --definitions | grep ^${EXPECTED_RUBY_VERSION} > /dev/null
70-
RUBYBUILD_DEFS_EXIT_CODE=$?
71-
if [ "$RUBYBUILD_DEFS_EXIT_CODE" -ne 0 ]; then
72-
echo "🍺 Ruby Build: Cannot find Ruby version required, updating via brew 🍺"
73-
brew update && brew upgrade ruby-build
74-
fi
75-
rbenv install --skip-existing
76-
echo "Ruby installed 👍"
77-
7874
log "📟 installing dependencies 📟"
7975
yarn
8076

0 commit comments

Comments
 (0)