Last active
May 8, 2020 17:06
-
-
Save elenipapanik/f01324272ac9b14dc4ae4d29c67ce0e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def withRvm(version, cl) { | |
withRvm(version, "executor-${env.EXECUTOR_NUMBER}") { | |
cl() | |
} | |
} | |
def withRvm(version, gemset, cl) { | |
RVM_HOME="$env.HOME/.rvm" | |
paths = [ | |
"$RVM_HOME/gems/$version@$gemset/bin", | |
"$RVM_HOME/gems/$version@global/bin", | |
"$RVM_HOME/rubies/$version/bin", | |
"$RVM_HOME/bin", | |
"${env.PATH}" | |
] | |
def path = paths.join(':') | |
withEnv(["RVM_HOME=${RVM_HOME}", "PATH=${env.PATH}:${RVM_HOME}"]) { | |
sh """#!/bin/bash -l | |
set +x; source $RVM_HOME/scripts/rvm; rvm use --create --install --binary $version@$gemset | |
""" | |
} | |
withEnv([ | |
"PATH=$path", | |
"GEM_HOME=$RVM_HOME/gems/$version@$gemset", | |
"GEM_PATH=$RVM_HOME/gems/$version@$gemset:$RVM_HOME/gems/$version@global", | |
"MY_RUBY_HOME=$RVM_HOME/rubies/$version", | |
"IRBRC=$RVM_HOME/rubies/$version/.irbrc", | |
"RUBY_VERSION=$version" | |
]) { | |
sh 'gem install bundler' | |
cl() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment