From 8b591b7d21858bd32fbde050e24adcadda2e5674 Mon Sep 17 00:00:00 2001 From: Pauloparakleto Date: Fri, 22 Mar 2024 14:28:49 -0300 Subject: [PATCH 1/7] chore(script/setup): Add support to RVM. Only evaluate to rbenv if rvm path is not found. --- script/setup | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/script/setup b/script/setup index d8f03ae63b..8e4c0aa941 100755 --- a/script/setup +++ b/script/setup @@ -19,11 +19,17 @@ NO_COLOR='\033[0m' # Check ruby version RUBY_VERSION=$(cat .ruby-version) -if command -v rbenv > /dev/null; then +if command -v rbenv > /dev/null && ! command rvm > /dev/null; then ./script/rbenv-install.sh -elif ! ruby --version | grep $RUBY_VERSION > /dev/null; then +fi + +if command rvm > /dev/null; then + ./script/rvm-install.sh +fi + +if ! 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" + printf "Have a look at your ruby version manager: https://github.com/rbenv/rbenv\n or https://rvm.io/" exit 1 fi From 1d6323c5203ecfda113b546c98f2b88dc7d32c64 Mon Sep 17 00:00:00 2001 From: Pauloparakleto Date: Fri, 22 Mar 2024 14:31:05 -0300 Subject: [PATCH 2/7] chore(script/rvm-install): Add support to RVM. Use rvm command to install ruby version in variable. RVM already print the logs. No need to printf message here. RVM already skip installation if already done with logs. --- script/rvm-install.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 script/rvm-install.sh diff --git a/script/rvm-install.sh b/script/rvm-install.sh new file mode 100755 index 0000000000..b905764d4a --- /dev/null +++ b/script/rvm-install.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# +# Install our selected Ruby version defined in the .ruby-version file. +# +# Requires: +# - [rvm](https://rvm.io/) +# + +rvm install $RUBY_VERSION From 0cd4682e365f615faa720edded1ad0943266c157 Mon Sep 17 00:00:00 2001 From: Pauloparakleto Date: Fri, 22 Mar 2024 15:27:21 -0300 Subject: [PATCH 3/7] chore(GETTING_STARTED.md): Add RVM alternative to installation guide. --- GETTING_STARTED.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 461aa86f53..59d65b526a 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -29,7 +29,7 @@ Fetch the latest version of `master` from `upstream` (ie. the main repo): This project needs specific ruby/bundler versions as well as node/yarn specific versions. For a local setup you will need: * Install or change your Ruby version according to the one specified at [.ruby-version](https://github.com/openfoodfoundation/openfoodnetwork/blob/master/.ruby-version) file. - - To manage versions, it's recommended to use [rbenv](https://github.com/rbenv/rbenv). + - To manage versions, it's recommended to use [rbenv](https://github.com/rbenv/rbenv) or [RVM](https://rvm.io/). * Install [nodenv](https://github.com/nodenv/nodenv) to ensure the correct [.node-version](https://github.com/openfoodfoundation/openfoodnetwork/blob/master/.node-version) is used. - [nodevn](https://github.com/nodenv/nodenv) is recommended as a node version manager. * PostgreSQL database From 4a4135f261bce9c62e0d226daca98fd5aeb9d965 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 25 Mar 2024 13:22:40 +1100 Subject: [PATCH 4/7] Simplify condition, in favour of rbenv If rbenv is installed, we'll favour that because that's what is currently supported. --- script/setup | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/script/setup b/script/setup index 8e4c0aa941..eddefb6b8c 100755 --- a/script/setup +++ b/script/setup @@ -19,11 +19,9 @@ NO_COLOR='\033[0m' # Check ruby version RUBY_VERSION=$(cat .ruby-version) -if command -v rbenv > /dev/null && ! command rvm > /dev/null; then +if command -v rbenv > /dev/null; then ./script/rbenv-install.sh -fi - -if command rvm > /dev/null; then +elif command rvm > /dev/null; then ./script/rvm-install.sh fi From 15c93a8e95cafdb3e32776be9e5e2bcfb0644e67 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 25 Mar 2024 13:24:10 +1100 Subject: [PATCH 5/7] Add -v flag to avoid script exit --- script/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/setup b/script/setup index eddefb6b8c..030ee7901d 100755 --- a/script/setup +++ b/script/setup @@ -21,7 +21,7 @@ NO_COLOR='\033[0m' RUBY_VERSION=$(cat .ruby-version) if command -v rbenv > /dev/null; then ./script/rbenv-install.sh -elif command rvm > /dev/null; then +elif command -v rvm > /dev/null; then ./script/rvm-install.sh fi From 3a2cb3e4152aab8a43bdcd5b32c50945d6e595d5 Mon Sep 17 00:00:00 2001 From: Pauloparakleto Date: Wed, 27 Mar 2024 09:49:18 -0300 Subject: [PATCH 6/7] call rvm directly --- script/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/setup b/script/setup index 030ee7901d..b016f5d5b0 100755 --- a/script/setup +++ b/script/setup @@ -22,7 +22,7 @@ RUBY_VERSION=$(cat .ruby-version) if command -v rbenv > /dev/null; then ./script/rbenv-install.sh elif command -v rvm > /dev/null; then - ./script/rvm-install.sh + rvm install $RUBY_VERSION fi if ! ruby --version | grep $RUBY_VERSION > /dev/null; then From 80db511fe5fddc005ae4abdeed7c7615839f23ab Mon Sep 17 00:00:00 2001 From: Pauloparakleto Date: Wed, 27 Mar 2024 09:50:23 -0300 Subject: [PATCH 7/7] remove rvm script. It is called directly in script/setup --- script/rvm-install.sh | 9 --------- 1 file changed, 9 deletions(-) delete mode 100755 script/rvm-install.sh diff --git a/script/rvm-install.sh b/script/rvm-install.sh deleted file mode 100755 index b905764d4a..0000000000 --- a/script/rvm-install.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# -# Install our selected Ruby version defined in the .ruby-version file. -# -# Requires: -# - [rvm](https://rvm.io/) -# - -rvm install $RUBY_VERSION