mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
1e6add1a43
Summary: Fix the `scripts/update-ruby.sh` so it always use the correct [bundle config](https://bundler.io/man/bundle-config.1.html#DESCRIPTION). In the current version it wasn't using the correct configuration inside the `template/` directory, resulting in incorrect platform for `template/Gemfile.lock`. While at that, update the gems to their latest version: - ethon 0.14.0 -> 0.15.0 - json 0.5.1 -> 0.6.0 - zeitwerk 2.4.2 -> 2.5.1 - bundler 2.2.28 -> 2.2.29 ## Changelog No changelog Pull Request resolved: https://github.com/facebook/react-native/pull/32456 Test Plan: Run `bump-oss-version.js` and see `template/Gemfile.lock` lists `ruby` as the `PLATFORM` (no diff in that line). ## References - https://github.com/facebook/react-native/commit/e18cf90d71d0bef2e2a0caf30a89e53129152965#r58230816 Reviewed By: yungsters Differential Revision: D31841524 Pulled By: charlesbdudley fbshipit-source-id: 695c245fcb344c866afed45f747e04233e5c91e4
70 lines
1.7 KiB
Bash
Executable File
70 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Copyright (c) Facebook, Inc. and its 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
|
|
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
|
|
|
|
sed_i -e "s/^\(ruby '\)[^']*\('.*\)$/\1$VERSION\2/" Gemfile
|
|
sed_i -e "s/^\(ruby '\)[^']*\('.*\)$/\1$VERSION\2/" template/Gemfile
|
|
|
|
rm -f Gemfile.lock template/Gemfile.lock
|
|
|
|
export BUNDLE_APP_CONFIG="$ROOT/.bundle"
|
|
cp "$BUNDLE_APP_CONFIG/"* template/_bundle # sync!
|
|
|
|
bundle lock
|
|
(cd template && bundle lock)
|
|
|
|
git add \
|
|
.ruby-version \
|
|
Gemfile \
|
|
template/_ruby-version \
|
|
template/Gemfile \
|
|
template/Gemfile.lock
|