Skip to content

Commit 79de95d

Browse files
committed
Merge pull request #116 from rspec/disable-rubygems
Disable rubygems on travis.
2 parents fddc61c + 9906f07 commit 79de95d

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

travis/script/functions.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ export JRUBY_OPTS=${JRUBY_OPTS:-"--server -Xcompile.invokedynamic=false"}
88
SPECS_HAVE_RUN_FILE=specs.out
99
MAINTENANCE_BRANCH=`cat maintenance-branch`
1010

11+
# Don't allow rubygems to pollute what's loaded. Also, things boot faster
12+
# without the extra load time of rubygems. Only works on MRI Ruby 1.9+
13+
if is_mri_192_plus; then
14+
export RUBYOPT="--disable=gem"
15+
fi
16+
1117
function clone_repo {
1218
if [ ! -d $1 ]; then # don't clone if the dir is already there
1319
travis_retry eval "git clone git://github.com/rspec/$1 --depth 1 --branch $MAINTENANCE_BRANCH"
@@ -43,10 +49,15 @@ function run_cukes {
4349
# the bin/cucumber approach below. That approach is faster
4450
# (as it avoids the bundler tax), so we use it on rubies where we can.
4551
bundle exec cucumber --strict
52+
elif is_jruby; then
53+
# For some reason JRuby doesn't like our improved bundler setup
54+
RUBYOPT="-I${PWD}/../bundle -rbundler/setup" \
55+
PATH="${PWD}/bin:$PATH" \
56+
bin/cucumber --strict
4657
else
4758
# Prepare RUBYOPT for scenarios that are shelling out to ruby,
4859
# and PATH for those that are using `rspec` or `rake`.
49-
RUBYOPT="-I${PWD}/../bundle -rbundler/setup" \
60+
RUBYOPT="${RUBYOPT} -I${PWD}/../bundle -rbundler/setup" \
5061
PATH="${PWD}/bin:$PATH" \
5162
bin/cucumber --strict
5263
fi

travis/script/predicate_functions.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ function is_mri {
88
fi;
99
}
1010

11+
function is_jruby {
12+
if ruby -e "exit(defined?(RUBY_PLATFORM) && RUBY_PLATFORM == 'java')"; then
13+
# RUBY_ENGINE only returns 'ruby' on MRI.
14+
# MRI 1.8.7 lacks the constant but all other rubies have it (including JRuby in 1.8 mode)
15+
return 0
16+
else
17+
return 1
18+
fi;
19+
}
20+
1121
function is_mri_192 {
1222
if is_mri; then
1323
if ruby -e "exit(RUBY_VERSION == '1.9.2')"; then
@@ -20,6 +30,18 @@ function is_mri_192 {
2030
fi
2131
}
2232

33+
function is_mri_192_plus {
34+
if is_mri; then
35+
if ruby -e "exit(RUBY_VERSION.to_f > 1.8)"; then
36+
return 0
37+
else
38+
return 1
39+
fi
40+
else
41+
return 1
42+
fi
43+
}
44+
2345
function is_mri_2plus {
2446
if is_mri; then
2547
if ruby -e "exit(RUBY_VERSION.to_f > 2.0)"; then

0 commit comments

Comments
 (0)