Classic Docs
Docs Navigation

Switching Ruby version on a specific branch

Add a new build command that will set the Ruby version:

if [ "$BRANCH_NAME" = "ruby-2" ]; then rbenv local 2.0.0-p247 ; fi

Another option is to add a build command that reads and sets the ruby version from the first line of the Gemfile:

if [[ $(head -n 1 Gemfile) =~ ([[:digit:]].[[:digit:]].[[:digit:]](-p[[:digit:]]+)?) ]]; then echo "Setting rbenv to version ${BASH_REMATCH[1]}" && rbenv local ${BASH_REMATCH[1]}; else echo "Unable to parse ruby version from Gemfile"; fi

Current package versions are listed on the Supported application stack page.

Semaphore Docs are open source — Edit on GitHub


Occasional lightweight product and blog updates. Unsubscribe at any time.

2009-2020 © Rendered Text. All rights reserved. Terms of Service, Privacy policy, Security.