Skip to content

Commit 0e25b32

Browse files
committed
Merge pull request #150 from rspec/disable_rubygems
Only enable rubygems for bundle install
2 parents f6dc24b + 06705ef commit 0e25b32

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

travis/script/functions.sh

Lines changed: 11 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"
@@ -74,7 +80,11 @@ function run_spec_suite_for {
7480
pushd ../$1
7581
unset BUNDLE_GEMFILE
7682
bundle_install_flags=`cat .travis.yml | grep bundler_args | tr -d '"' | grep -o " .*"`
77-
travis_retry eval "bundle install $bundle_install_flags"
83+
if is_mri_192_plus; then
84+
travis_retry eval "RUBYOPT=$RUBYOPT:'--enable rubygems' bundle install $bundle_install_flags"
85+
else
86+
travis_retry eval "bundle install $bundle_install_flags"
87+
fi
7888
run_specs_and_record_done
7989
popd
8090
else

travis/script/predicate_functions.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ function is_mri_192 {
3030
fi
3131
}
3232

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+
3345
function is_mri_2plus {
3446
if is_mri; then
3547
if ruby -e "exit(RUBY_VERSION.to_f > 2.0)"; then

0 commit comments

Comments
 (0)