From 87598f1576cc7b3e1071a83d70778a51009b853b Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 6 Oct 2021 21:12:16 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- scripts/rails-update-bisect | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 scripts/rails-update-bisect (limited to 'scripts') diff --git a/scripts/rails-update-bisect b/scripts/rails-update-bisect new file mode 100755 index 00000000000..77a01e2dadc --- /dev/null +++ b/scripts/rails-update-bisect @@ -0,0 +1,39 @@ +#!/bin/bash +SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" +GITLAB_DIR="$(dirname "$SCRIPT_DIR")" + +# Because this script is intended to be run with `git bisect run`, +# we are returning `-1` status code to alert `git bisect` of failures. +# +# See: https://git-scm.com/docs/git-bisect#_bisect_run +# +abort_bisect () { + exit -1 +} + +if [ $# -eq 0 ]; then + echo "No arguments supplied. Please provide spec file(s) as first argument(s)" + abort_bisect +fi + +[[ -z "${RAILS_FOLDER}" ]] && { echo >&2 "RAILS_FOLDER env variable is not set"; abort_bisect; } + +if ! grep -q -E "gem 'rails'.+RAILS_VERSION.+RAILS_FOLDER" $GITLAB_DIR/Gemfile; then + echo "Gemfile is not modified" + echo "Please alter the gem 'rails' line in Gemfile with:" + echo "gem 'rails', ENV['RAILS_VERSION'], path: ENV['RAILS_FOLDER']" + abort_bisect +fi + +export RAILS_VERSION=$(cat $RAILS_FOLDER/RAILS_VERSION) + +cd $GITLAB_DIR && \ +echo "Updating dependencies... this could take a while." && \ +bundle update rails --quiet + +test $? -eq 0 || { echo >&2 "bundle update has failed"; abort_bisect; } + +# Stop spring if it's installed +command -v spring >/dev/null 2>&1 && spring stop + +bin/rspec $@ -- cgit v1.2.3