diff --git a/script/downgrade_bundler_on_old_rails b/script/downgrade_bundler_on_old_rails index 36e54feea2..c86d3762f1 100755 --- a/script/downgrade_bundler_on_old_rails +++ b/script/downgrade_bundler_on_old_rails @@ -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 diff --git a/script/predicate_functions.sh b/script/predicate_functions.sh index 6edd3f06bc..d5c97b0d55 100644 --- a/script/predicate_functions.sh +++ b/script/predicate_functions.sh @@ -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