Files
puppet-openstack_spec_helper/functions
Tobias Urdin c44a4bbc4b Workaround for installing correct version of ruby bundler
See https://github.com/bundler/bundler/issues/6870

Bundler 2.x dropped support for Ruby < 2.3 so now we detect ruby
version and install last known to work version. This means that
newer OS will get newer versions of bundler.

Change-Id: I521affb16d8d2312be3ff507a014adddacd6cb8b
Closes-Bug: #1810401
(cherry picked from commit 6185377713)
(cherry picked from commit 9b6f1e1453)
2019-01-12 16:24:17 +00:00

36 lines
1.1 KiB
Bash

#!/bin/bash
#
# functions - puppet-openstack_spec_helper specific functions
#
install_gems() {
mkdir .bundled_gems
export GEM_HOME=`pwd`/.bundled_gems
# use puppet-nova to test the gem
if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then
/usr/zuul-env/bin/zuul-cloner --cache-dir /opt/git \
git://git.openstack.org openstack/puppet-nova
else
git clone git://git.openstack.org/openstack/puppet-nova -b stable/queens openstack/puppet-nova
fi
cd openstack/puppet-nova
# Modify Gemfile to use local library and not the one on git
# so we can actually test the current state of the gem.
sed -i -e "s|\('puppet-openstack_spec_helper',.*\) \(:git\).*|\1 :path => '../..'|g" Gemfile
# NOTE(aschultz): in order for this to work we need to nuke the branch line
# since we're replacing the repository with a path
sed -i "/.*ref[[:space:]]*=> 'stable\/.*/d" Gemfile
# Install dependencies
ruby <<EOF
cmd = 'gem install bundler --no-rdoc --no-ri --verbose'
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0') then
cmd += ' -v 1.17.3'
end
system(cmd)
EOF
$GEM_HOME/bin/bundle install
}