Files
puppet-openstack_spec_helper/functions
Tobias Urdin 7dede6f8a1 Replace gem --no-ri and --no-rdoc with --no-document
The --no-ri and --no-rdoc option is removed in later versions.

Change-Id: Id093c5a2a74cb229c55f5629a3113fe27782bf4b
2020-09-02 14:16:08 +02:00

37 lines
1.2 KiB
Bash

#!/bin/bash
#
# functions - puppet-openstack_spec_helper specific functions
#
install_gems() {
mkdir .bundled_gems
export GEM_HOME=`pwd`/.bundled_gems
export GEM_BIN_DIR=$GEM_HOME/bin
# use puppet-nova to test the gem
if [ -d /home/zuul/src/opendev.org/openstack/puppet-nova ]; then
[ ! -d openstack ] && mkdir openstack
cp -R /home/zuul/src/opendev.org/openstack/puppet-nova openstack/puppet-nova
else
git clone https://opendev.org/openstack/puppet-nova 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|branch)[[:space:]]*=> 'stable\/.*/d" Gemfile
# Install dependencies
ruby <<EOF
cmd = 'gem install bundler --no-document --verbose --bindir=${GEM_BIN_DIR}'
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
}