Skip to content

Commit

Permalink
Remove predicates that apply to unsupported Rubies
Browse files Browse the repository at this point in the history
  • Loading branch information
pirj committed Sep 2, 2020
1 parent 7aa9d79 commit fa57bf5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 72 deletions.
73 changes: 3 additions & 70 deletions script/predicate_functions.sh
Original file line number Diff line number Diff line change
@@ -1,62 +1,19 @@
# This file was generated on 2019-12-18T14:01:39+00:00 from the rspec-dev repo.
# DO NOT modify it by hand as your changes will get lost the next time it is generated.

function is_mri {
if ruby -e "exit(!defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby')"; then
# RUBY_ENGINE only returns 'ruby' on MRI.
# MRI 1.8.7 lacks the constant but all other rubies have it (including JRuby in 1.8 mode)
if ruby -e "exit(RUBY_ENGINE == 'ruby')"; then
return 0
else
return 1
fi;
}

function is_jruby {
if ruby -e "exit(defined?(RUBY_PLATFORM) && RUBY_PLATFORM == 'java')"; then
# RUBY_ENGINE only returns 'ruby' on MRI.
# MRI 1.8.7 lacks the constant but all other rubies have it (including JRuby in 1.8 mode)
if ruby -e "exit(RUBY_PLATFORM == 'java')"; then
return 0
else
return 1
fi;
}

function is_mri_192 {
if is_mri; then
if ruby -e "exit(RUBY_VERSION == '1.9.2')"; then
return 0
else
return 1
fi
else
return 1
fi
}

function is_mri_192_plus {
if is_mri; then
if ruby -e "exit(RUBY_VERSION.to_f > 1.8)"; then
return 0
else
return 1
fi
else
return 1
fi
}

function is_mri_2plus {
if is_mri; then
if ruby -e "exit(RUBY_VERSION.to_f > 2.0)"; then
return 0
else
return 1
fi
else
return 1
fi
}

function is_ruby_23_plus {
if ruby -e "exit(RUBY_VERSION.to_f >= 2.3)"; then
return 0
Expand All @@ -65,37 +22,13 @@ function is_ruby_23_plus {
fi
}

function rspec_rails_compatible {
if is_ruby_23_plus; then
return 0
else
return 1
fi
}

function rspec_support_compatible {
if [ "$MAINTENANCE_BRANCH" != "2-99-maintenance" ] && [ "$MAINTENANCE_BRANCH" != "2-14-maintenance" ]; then
return 0
else
return 1
fi
}

function additional_specs_available {
type run_additional_specs > /dev/null 2>&1
return $?
}

function documentation_enforced {
if [ -x ./bin/yard ]; then
if is_mri_2plus; then
return 0
else
return 1
fi
else
return 1
fi
[ -x ./bin/yard ]
}

function style_and_lint_enforced {
Expand Down
1 change: 1 addition & 0 deletions script/run_build
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fi

fold "cukes" run_cukes

# Yard on JRuby fails with a strange message, skip
if documentation_enforced; then
fold "doc check" check_documentation_coverage
fi
Expand Down
2 changes: 0 additions & 2 deletions script/update_rubygems_and_install_bundler
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash
# This file was generated on 2019-12-18T14:01:39+00:00 from the rspec-dev repo.
# DO NOT modify it by hand as your changes will get lost the next time it is generated.

set -e
source script/functions.sh
Expand Down

0 comments on commit fa57bf5

Please sign in to comment.