Remove .ruby-version and update Gemfile to support multiple versions of Ruby (#36281)

Summary:
This Change remove the need to have a specific version of Ruby installed. We are now supporting a wider range of Ruby versions, starting from Ruby 2.6.10 (the ruby installed on MacOS by default).
We are still using a Gemfile to control the version of cocoapods that needs to be installed.

## Changelog

[IOS] [CHANGED] - Remove `.ruby-version` and update Gemfile to support a wider range of Ruby versions

Pull Request resolved: https://github.com/facebook/react-native/pull/36281

Test Plan:
- Tested locally on RNTester and an app from template, switch across different versions of Ruby
- CircleCI is green on the commit

Reviewed By: cortinico

Differential Revision: D43567660

Pulled By: cipolleschi

fbshipit-source-id: e7edfe5806a898a83ba39cb58b1318ebde56a57c
This commit is contained in:
Riccardo Cipolleschi
2023-02-26 09:32:28 -08:00
committed by Facebook GitHub Bot
parent febf6b7f33
commit e57b6d11fa
6 changed files with 6 additions and 25 deletions
+2
View File
@@ -105,6 +105,8 @@ package-lock.json
# Ruby Gems (Bundler)
/vendor
/template/vendor
.ruby-version
/**/.ruby-version
# iOS / CocoaPods
/template/ios/build/
-1
View File
@@ -1 +0,0 @@
2.7.6
+1 -1
View File
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby File.read(File.join(__dir__, '.ruby-version')).strip
ruby ">= 2.6.10", "< 3.2.0"
gem 'cocoapods', '~> 1.11', '>= 1.11.3'
gem 'activesupport', '>= 6.1.7.1'
+2 -21
View File
@@ -32,23 +32,6 @@ fi
if [ -z "$VERSION" ]; then
die "Please provide an installed/usable Ruby version"
fi
echo "Setting Ruby version to: $VERSION"
cd "$ROOT" || die "Failed to change to $ROOT"
# do this first, so rbenv/rvm will automatically pick the desired version
echo "$VERSION" > .ruby-version
# make sure we're using it
CURRENT_VERSION=$(ruby --version | cut -d' ' -f2 | cut -dp -f1)
if [ -z "$CURRENT_VERSION" ]; then
# rbenv/rvm uses shims, the commands do exist, but do not return a version if misconfigured
die "Missing usable ruby, check your installation"
elif [ "$VERSION" != "$CURRENT_VERSION" ]; then
die "Plese use the ruby version you are trying to set: $VERSION ('$CURRENT_VERSION' in use)"
fi
echo "$VERSION" > template/_ruby-version
rm -f Gemfile.lock
@@ -61,11 +44,9 @@ bundle lock
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1;
IS_GIT_REPO=$(git rev-parse --is-inside-work-tree 2> /dev/null || true)
export GIT_DISCOVERY_ACROSS_FILESYSTEM=0;
if [ "$IS_GIT_REPO" = "true" ]; then
git add \
.ruby-version \
Gemfile.lock \
template/_ruby-version
git add Gemfile.lock
else
echo "Detected that you're not in Git. If on another SCM, don't forget to commit the edited files."
fi
+1 -1
View File
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby File.read(File.join(__dir__, '.ruby-version')).strip
ruby ">= 2.6.10", "< 3.2.0"
gem 'cocoapods', '~> 1.11', '>= 1.11.3'
-1
View File
@@ -1 +0,0 @@
2.7.6