Skip to content

Commit

Permalink
Merge pull request #2158 from rspec/fix-build
Browse files Browse the repository at this point in the history
Prevent uninstalling bundler on newer rails
  • Loading branch information
JonRowe authored and alpaca-tc committed Aug 25, 2019
1 parent 8a7317a commit b293259
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 4 additions & 3 deletions script/downgrade_bundler_on_old_rails
Expand Up @@ -5,13 +5,14 @@
set -e
source script/functions.sh

if ruby -e "exit(ENV['RAILS_VERSION'].to_f < 5)"; then
if ruby -e "exit(ENV['RAILS_VERSION'].scan(/\d+\.\d+.\d+/)[0].to_f < 5)"; then
# On Rails versions less than 5, Bundler 2.0 is not supported
echo "Warning dowgrading to older version of Bundler"
gem uninstall -aIx bundler

gem uninstall -aIx bundler || echo "Warning error occured removing bundler via gem"

# this only works on Ruby 2.3 which is luckily the version we need to fix
if is_ruby_23_plus; then
if is_ruby_23; then
rvm @global do gem uninstall -aIx bundler
fi

Expand Down
8 changes: 8 additions & 0 deletions script/predicate_functions.sh
Expand Up @@ -57,6 +57,14 @@ function is_mri_2plus {
fi
}

function is_ruby_23 {
if ruby -e "exit(RUBY_VERSION.to_f == 2.3)"; then
return 0
else
return 1
fi
}

function is_ruby_23_plus {
if ruby -e "exit(RUBY_VERSION.to_f >= 2.3)"; then
return 0
Expand Down

0 comments on commit b293259

Please sign in to comment.