Files
react-native/scripts/update-ruby.sh
T
Riccardo Cipolleschi e57b6d11fa 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
2023-02-26 09:32:28 -08:00

53 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
set -e
if [ "$VERBOSE" = 1 ]; then
set -x
fi
case $(sed --help 2>&1) in
*GNU*) sed_i () { sed -i "$@"; };;
*) sed_i () { sed -i '' "$@"; };;
esac
SCRIPTS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$(dirname "$SCRIPTS")"
die() {
echo "ERROR: $*" >&2
exit 1
}
if [ $# -eq 1 ]; then
VERSION=$1
else
VERSION=$(ruby --version | cut -d' ' -f2 | cut -dp -f1)
fi
if [ -z "$VERSION" ]; then
die "Please provide an installed/usable Ruby version"
fi
rm -f Gemfile.lock
export BUNDLE_APP_CONFIG="$ROOT/.bundle"
cp "$BUNDLE_APP_CONFIG/"* template/_bundle # sync!
bundle lock
# Disabling getting a potential fatal exit with for crossing filesystem boundary
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 Gemfile.lock
else
echo "Detected that you're not in Git. If on another SCM, don't forget to commit the edited files."
fi