mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Install ruby automatically if rbenv is available
People may use other ways to provide the right Ruby version but if they use rbenv then we can use it automatically.
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
#
|
||||
# Install our selected Ruby version defined in the .ruby-version file.
|
||||
#
|
||||
# Requires:
|
||||
# - [rbenv](https://github.com/rbenv/rbenv#readme)
|
||||
# - [ruby-build](https://github.com/rbenv/ruby-build#readme)
|
||||
#
|
||||
# If our ruby-build version is outdated and it can't build the version we want
|
||||
# then we try upgrading ruby-build and installing again.
|
||||
|
||||
|
||||
10
script/setup
10
script/setup
@@ -17,11 +17,13 @@ YELLOW='\033[0;33m'
|
||||
RED='\033[0;31m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
RUBY_VERSION=$(cat .ruby-version)
|
||||
|
||||
# Check ruby version
|
||||
if ! ruby --version | grep $RUBY_VERSION > /dev/null; then
|
||||
printf "${RED}Open Food Network requires ruby ${RUBY_VERSION}${NO_COLOR}. Have a look at: https://github.com/rbenv/rbenv\n"
|
||||
RUBY_VERSION=$(cat .ruby-version)
|
||||
if command -v rbenv > /dev/null; then
|
||||
./script/rbenv-install.sh
|
||||
elif ! ruby --version | grep $RUBY_VERSION > /dev/null; then
|
||||
printf "${RED}Open Food Network requires ruby ${RUBY_VERSION}${NO_COLOR}. "
|
||||
printf "Have a look at: https://github.com/rbenv/rbenv\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user