Skip to content

Commit

Permalink
Merge pull request #920 from shankari/upgrade_2023
Browse files Browse the repository at this point in the history
Lock down the version of ruby used instead of "the default"
  • Loading branch information
shankari authored Feb 11, 2023
2 parents 41d9f06 + 2126a73 commit dc3b274
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ios-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
- name: Print the xcode setup
run: xcodebuild -version -sdk

- name: Print the brew and ruby versions
run: |
echo "brew version is "`brew --version`
echo "ruby version is" `ruby --version`
- name: Print applications through dmg
run: ls /Applications

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ Pre-requisites
```

</details>
- if you are not on the most recent version of OSX, `homebrew`
- this allows us to install the current version of cocoapods without
running into ruby incompatibilities - e.g.
https://github.com/CocoaPods/CocoaPods/issues/11763

Important
---
Expand Down
1 change: 0 additions & 1 deletion setup/activate_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ echo "Verifying $ANDROID_HOME or $ANDROID_SDK_ROOT is set"
if [ -z $ANDROID_HOME ] && [ -z $ANDROID_SDK_ROOT ];
then
echo "ANDROID_HOME and ANDROID_SDK_ROOT not set, android SDK not found"
exit 1
fi

echo "Activating sdkman, and by default, gradle"
Expand Down
9 changes: 7 additions & 2 deletions setup/export_shared_dep_versions.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
export NVM_VERSION=0.39.0
export NODE_VERSION=14.18.1
export NPM_VERSION=6.14.15
export RUBY_VERSION=2.6.0
# make sure that this is a stable version from
# so that https://github.com/postmodern/ruby-versions
# ideally, this would be the same version as the CI
# Looks like brew supports only major and minor, not patch version
export RUBY_VERSION=2.7
export COCOAPODS_VERSION=1.11.2
export GRADLE_VERSION=7.1.1
export OSX_EXP_VERSION=12

export NVM_DIR="$HOME/.nvm"
export RUBY_PATH=$HOME/.gem/ruby/$RUBY_VERSION/bin
export RUBY_PATH=$HOME/.gem/ruby/$RUBY_VERSION.0/bin
30 changes: 28 additions & 2 deletions setup/setup_ios_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,34 @@ set -e
# Setup the development environment
source setup/setup_shared.sh

echo "Installing cocoapods"
OSX_MAJOR_VERSION=`sw_vers | grep ProductVersion | cut -d ':' -f 2 | cut -d '.' -f 1`
echo "Found OSX major version" $OSX_MAJOR_VERSION

CURR_RUBY_VERSION=`ruby --version | cut -d ' ' -f 2 | cut -d '.' -f 1-2`
echo "Found ruby version "$CURR_RUBY_VERSION

if [ $CURR_RUBY_VERSION == $RUBY_VERSION ]; then
echo "Found ruby version "$CURR_RUBY_VERSION" expected "$RUBY_VERSION" no need to upgrade"
else
if [ -x /usr/local/bin/brew ]; then
echo "Found brew installation with version" `/usr/local/bin/brew --version`
echo "Installing ruby version to brew" $RUBY_VERSION
brew install ruby@$RUBY_VERSION
else
if [ $OSX_MAJOR_VERSION -ge $OSX_EXP_VERSION ]; then
echo "No brew installation found, but OSX major version "$OSX_MAJOR_VERSION" and expected version "$OSX_EXP_VERSION" so CocoaPods should work"
else
echo "No brew installation found, but OSX major version "$OSX_MAJOR_VERSION" != expected version "$OSX_EXP_VERSION" CocoaPods install will likely fail"
echo "Found ruby version "`ruby --version`
exit 1
fi
fi
fi

echo "Adding $RUBY_PATH to the path before the install"
export PATH=$RUBY_PATH:$PATH
gem install --no-document --user-install cocoapods -v $COCOAPODS_VERSION

echo "Installing cocoapods"
/usr/local/opt/ruby@$RUBY_VERSION/bin/gem install --no-document --user-install cocoapods -v $COCOAPODS_VERSION

source setup/setup_shared_native.sh

0 comments on commit dc3b274

Please sign in to comment.