Skip to content

Commit a7baad6

Browse files
committed
limit disabling ruby gems to MRI > 1.9
1 parent c095911 commit a7baad6

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

travis/script/functions.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# This file was generated on 2015-08-11T23:21:08+01:00 from the rspec-dev repo.
2+
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
3+
14
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
25
source $SCRIPT_DIR/travis_functions.sh
36
source $SCRIPT_DIR/predicate_functions.sh
@@ -8,9 +11,11 @@ export JRUBY_OPTS=${JRUBY_OPTS:-"--server -Xcompile.invokedynamic=false"}
811
SPECS_HAVE_RUN_FILE=specs.out
912
MAINTENANCE_BRANCH=`cat maintenance-branch`
1013

11-
# Don't allow rubygems to pollute what's loaded. Also, things boot
12-
# faster without the extra load time of rubygems.
13-
export RUBYOPT="--disable=gem"
14+
# Don't allow rubygems to pollute what's loaded. Also, things boot faster
15+
# without the extra load time of rubygems. Only works on MRI Ruby 1.9+
16+
if is_mri_192_plus; then
17+
export RUBYOPT="--disable=gem"
18+
fi
1419

1520
function clone_repo {
1621
if [ ! -d $1 ]; then # don't clone if the dir is already there
@@ -47,6 +52,11 @@ function run_cukes {
4752
# the bin/cucumber approach below. That approach is faster
4853
# (as it avoids the bundler tax), so we use it on rubies where we can.
4954
bundle exec cucumber --strict
55+
elif is_jruby; then
56+
# For some reason JRuby doesn't like our improved bundler setup
57+
RUBYOPT="-I${PWD}/../bundle -rbundler/setup" \
58+
PATH="${PWD}/bin:$PATH" \
59+
bin/cucumber --strict
5060
else
5161
# Prepare RUBYOPT for scenarios that are shelling out to ruby,
5262
# and PATH for those that are using `rspec` or `rake`.

travis/script/predicate_functions.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# This file was generated on 2015-08-11T23:21:08+01:00 from the rspec-dev repo.
2+
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
3+
14
function is_mri {
25
if ruby -e "exit(!defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby')"; then
36
# RUBY_ENGINE only returns 'ruby' on MRI.
@@ -8,6 +11,16 @@ function is_mri {
811
fi;
912
}
1013

14+
function is_jruby {
15+
if ruby -e "exit(defined?(RUBY_PLATFORM) && RUBY_PLATFORM == 'java')"; then
16+
# RUBY_ENGINE only returns 'ruby' on MRI.
17+
# MRI 1.8.7 lacks the constant but all other rubies have it (including JRuby in 1.8 mode)
18+
return 0
19+
else
20+
return 1
21+
fi;
22+
}
23+
1124
function is_mri_192 {
1225
if is_mri; then
1326
if ruby -e "exit(RUBY_VERSION == '1.9.2')"; then
@@ -20,6 +33,18 @@ function is_mri_192 {
2033
fi
2134
}
2235

36+
function is_mri_192_plus {
37+
if is_mri; then
38+
if ruby -e "exit(RUBY_VERSION.to_f > 1.8)"; then
39+
return 0
40+
else
41+
return 1
42+
fi
43+
else
44+
return 1
45+
fi
46+
}
47+
2348
function is_mri_2plus {
2449
if is_mri; then
2550
if ruby -e "exit(RUBY_VERSION.to_f > 2.0)"; then

0 commit comments

Comments
 (0)