Skip to content

Commit c7890d2

Browse files
committed
Merge pull request #2158 from rspec/fix-build
Prevent uninstalling bundler on newer rails
1 parent a094d52 commit c7890d2

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

script/downgrade_bundler_on_old_rails

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
set -e
66
source script/functions.sh
77

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

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

script/predicate_functions.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ function is_mri_2plus {
5757
fi
5858
}
5959

60+
function is_ruby_23 {
61+
if ruby -e "exit(RUBY_VERSION.to_f == 2.3)"; then
62+
return 0
63+
else
64+
return 1
65+
fi
66+
}
67+
6068
function is_ruby_23_plus {
6169
if ruby -e "exit(RUBY_VERSION.to_f >= 2.3)"; then
6270
return 0

0 commit comments

Comments
 (0)