From 127ada280fec1e137921d3467c8d136602422bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 18 Apr 2020 15:59:20 +0200 Subject: [PATCH] Install Ruby based on CONSUL's .ruby-version --- docs/README.md | 2 +- docs/en/README.md | 2 +- docs/en/installation/debian.md | 18 ++--------- docs/en/installation/deploying-on-heroku.md | 4 +-- docs/en/installation/local_installation.md | 35 ++++++++++++++++----- docs/en/installation/macos.md | 14 ++------- docs/en/installation/ubuntu.md | 24 +------------- docs/es/README.md | 2 +- docs/es/installation/debian.md | 18 ++--------- docs/es/installation/deploying-on-heroku.md | 4 +-- docs/es/installation/local_installation.md | 35 ++++++++++++++++----- docs/es/installation/macos.md | 6 ++-- docs/es/installation/ubuntu.md | 26 ++------------- 13 files changed, 75 insertions(+), 115 deletions(-) diff --git a/docs/README.md b/docs/README.md index b79bcde25..64699d05e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -27,7 +27,7 @@ Development started on [2015 July 15th](https://github.com/consul/consul/commit/ **NOTE**: For more detailed instructions check the [docs](https://consul_docs.gitbooks.io/docs/content/en/getting_started/prerequisites/) -Prerequisites: install git, Ruby 2.3.2, bundler gem, Node.js and PostgreSQL (>=9.4). +Prerequisites: install git, Ruby (the version defined in the `.ruby-version` file in the CONSUL repository), the bundler gem, Node.js and PostgreSQL (>=9.4). ```bash git clone https://github.com/consul/consul.git diff --git a/docs/en/README.md b/docs/en/README.md index 2bda277c7..759f78f86 100644 --- a/docs/en/README.md +++ b/docs/en/README.md @@ -27,7 +27,7 @@ Development started on [2015 July 15th](https://github.com/consul/consul/commit/ **NOTE**: For more detailed instructions check the [docs](https://consul_docs.gitbooks.io/docs/content/en/getting_started/prerequisites/) -Prerequisites: install git, Ruby 2.4.9, bundler gem, Node.js and PostgreSQL (>=9.4). +Prerequisites: install git, Ruby (the version defined in the `.ruby-version` file in the CONSUL repository), the bundler gem, Node.js and PostgreSQL (>=9.4). ```bash git clone https://github.com/consul/consul.git diff --git a/docs/en/installation/debian.md b/docs/en/installation/debian.md index d1b9e0197..fbfc03dc5 100644 --- a/docs/en/installation/debian.md +++ b/docs/en/installation/debian.md @@ -38,11 +38,11 @@ Curl is officially maintained in Debian: apt-get install curl ``` -## Ruby +## Ruby version manager Ruby versions packaged in official repositories are not suitable to work with consul, so we'll have to install it manually. -The preferred method is via rvm: +One possible tool is rvm: ### As a local user @@ -64,20 +64,6 @@ and finally, reload .bashrc to be able to run RVM source ~/.bashrc ``` -with all this, you are suppose to be able to install a ruby version from rvm, as for example version 2.4.9: - -``` -rvm install 2.4.9 -``` - -## Bundler - -Install it with - -``` -gem install rubygems-bundler -``` - ## Node.js To compile the assets, you'll need a JavaScript runtime. Node.js is the preferred option. As with Ruby, we don't recommend installing Node from your distro's repositories. diff --git a/docs/en/installation/deploying-on-heroku.md b/docs/en/installation/deploying-on-heroku.md index c001ab0cd..b5052ce33 100644 --- a/docs/en/installation/deploying-on-heroku.md +++ b/docs/en/installation/deploying-on-heroku.md @@ -119,10 +119,10 @@ As recommended by Heroku, you can add the gem rails\_12factor and specify the ve ``` gem 'rails_12factor' -ruby '2.4.9' +ruby 'x.y.z' ``` -in the file _Gemfile\_custom_. Don't forget to run +in the file _Gemfile\_custom_, where `x.y.z` is the version defined in the `.ruby-version` file in the CONSUL repository. Don't forget to run ``` bundle install diff --git a/docs/en/installation/local_installation.md b/docs/en/installation/local_installation.md index b7fefaeee..4ff72dde5 100644 --- a/docs/en/installation/local_installation.md +++ b/docs/en/installation/local_installation.md @@ -2,20 +2,41 @@ Before installing Consul and having it up and running make sure you all [prerequisites](prerequisites.md) installed. -1. First, clone the [Consul Github repository](https://github.com/consul/consul/): +1. First, clone the [Consul Github repository](https://github.com/consul/consul/) and enter the project folder: ```bash git clone https://github.com/consul/consul.git +cd consul ``` -2. Go to the project folder and install the gems stack using [Bundler](http://bundler.io/): +2. Install the Ruby version we need with your Ruby version manager. Here are some examples: + +```bash +rvm install `cat .ruby-version` # If you're using RVM +rbenv install `cat .ruby-version` # If you're using rbenv +asdf install ruby `cat .ruby-version` # If you're using asdf +``` + +3. Check we're using the Ruby version we've just installed: + +```bash +ruby -v +=> # (it should be the same as the version in the .ruby-version file) +``` + +4. Install [Bundler](http://bundler.io/): + +```bash +gem install bundler +``` + +5. Install the required gems using Bundler: ```bash -cd consul bundle ``` -3. Copy the environment example configuration files inside new readable ones: +6. Copy the environment example configuration files inside new readable ones: ```bash cp config/database.yml.example config/database.yml @@ -24,7 +45,7 @@ cp config/secrets.yml.example config/secrets.yml And setup database credentials with your `consul` user in your new `database.yml` file. -4. Run the following [Rake tasks](https://github.com/ruby/rake) to create and fill your local database with the minimum data to run the application: +7. Run the following [Rake tasks](https://github.com/ruby/rake) to create and fill your local database with the minimum data to run the application: ```bash rake db:create @@ -33,13 +54,13 @@ rake db:dev_seed rake db:test:prepare ``` -5. Check everything is fine by running the test suite (beware it might take more than an hour): +8. Check everything is fine by running the test suite (beware it might take more than an hour): ```bash bin/rspec ``` -6. Now you have all set, run the application: +9. Now you have all set, run the application: ```bash bin/rails s diff --git a/docs/en/installation/macos.md b/docs/en/installation/macos.md index 81d0508f5..a5ad3baab 100644 --- a/docs/en/installation/macos.md +++ b/docs/en/installation/macos.md @@ -14,20 +14,12 @@ To install *git* you'll first need to install *Xcode* (download it from the Mac You can download git from: [git-scm.com/download/mac](https://git-scm.com/download/mac) -## Ruby and rbenv +## Ruby version manager -OS X already comes with a preinstalled Ruby version, but it's quite old and we need a newer one (2.4.9). One of the multiple ways of installing Ruby in OS X is through *rbenv*. The installation instructions are in its GitHub repository and are pretty straight-forward: +OS X already comes with a preinstalled Ruby version, but it's quite old and we need a newer one. One of the multiple ways of installing Ruby in OS X is through *rbenv*. The installation instructions are in its GitHub repository and are pretty straight-forward: [github.com/rbenv/rbenv](https://github.com/rbenv/rbenv) -Then install Ruby version 2.4.9 - -## Bundler - -``` -gem install bundler -``` - ## Node.js To compile the assets, you'll need a JavaScript runtime. OS X comes with an integrated runtime called `Apple JavaScriptCore` but Node.js is the preferred option. @@ -108,4 +100,4 @@ brew install chromedriver brew install imagemagick ``` -Now that we have all the dependencies installed we can download the project: [installed](local_installation.md) +Now that we have all the dependencies installed we can go ahead and [install Consul](local_installation.md). diff --git a/docs/en/installation/ubuntu.md b/docs/en/installation/ubuntu.md index cf43c9a71..526a7955e 100644 --- a/docs/en/installation/ubuntu.md +++ b/docs/en/installation/ubuntu.md @@ -16,7 +16,7 @@ Git is officially maintained in Ubuntu: sudo apt install git ``` -## Ruby +## Ruby version manager Ruby versions packaged in official repositories are not suitable to work with CONSUL, so we'll have to install it manually. @@ -35,28 +35,6 @@ echo 'eval "$(rbenv init -)"' >> ~/.bashrc source ~/.bashrc ``` -Finally, install Ruby 2.4.9, which will take a few minutes: - -```bash -rbenv install 2.4.9 -``` - -## Bundler - -Check we're using the Ruby version we've just installed: - -```bash -rbenv global 2.4.9 -ruby -v -=> ruby 2.4.9p354 -``` - -And install Bundler with: - -```bash -gem install bundler -``` - ## Node.js To compile the assets, you'll need a JavaScript runtime. Node.js is the preferred option. diff --git a/docs/es/README.md b/docs/es/README.md index 053a5ff8d..952a89461 100644 --- a/docs/es/README.md +++ b/docs/es/README.md @@ -27,7 +27,7 @@ El desarrollo de esta aplicación comenzó el [15 de Julio de 2015](https://gith **NOTA**: para unas instrucciones más detalladas consulta la [documentación](https://consul_docs.gitbooks.io/docs/content/es/getting_started/prerequisites/) -Prerequisitos: tener instalado git, Ruby 2.4.9, la gema `bundler`, Node.js y PostgreSQL (9.4 o superior). +Prerequisitos: tener instalado git, Ruby (versión definida en el fichero `.ruby-version` del repositorio de CONSUL), la gema `bundler`, Node.js y PostgreSQL (9.4 o superior). ``` diff --git a/docs/es/installation/debian.md b/docs/es/installation/debian.md index b8339a895..7f6464ba5 100644 --- a/docs/es/installation/debian.md +++ b/docs/es/installation/debian.md @@ -37,11 +37,11 @@ Curl es mantenido oficialmente en Debian: apt-get install curl ``` -## Ruby +## Gestor de versiones de Ruby Las versiones de Ruby empaquetadas en repositorios oficiales no son aptas para trabajar con consul, así que debemos instalar manualmente. -El método recomendado es via rvm: +Una opción es utilizar rvm: ### Como usuario local @@ -63,20 +63,6 @@ por úlitmo, volvemos a cargar el .bashrc para poder ejecutar RVM source ~/.bashrc ``` -con todo esto, deberías poder instalar la versión de ruby con rvm, por ejemplo la 2.4.9: - -``` -rvm install 2.4.9 -``` - -## Bundler - -lo instalamos usando - -``` -gem install rubygems-bundler -``` - ## Node.js Para compilar los archivos estáticos (JS, CSS, imágenes, etc.), es necesario un _runtime_ de JavaScript. Node.js es la opción recomendada. Al igual que como ocurre con Ruby, no es recomendable instalar Node directamente de los repositorios de tu distribución Linux. diff --git a/docs/es/installation/deploying-on-heroku.md b/docs/es/installation/deploying-on-heroku.md index b0056da6d..ec8f030cc 100644 --- a/docs/es/installation/deploying-on-heroku.md +++ b/docs/es/installation/deploying-on-heroku.md @@ -119,10 +119,10 @@ As recommended by Heroku, you can add the gem rails\_12factor and specify the ve ``` gem 'rails_12factor' -ruby '2.4.9' +ruby 'x.y.z' ``` -in the file _Gemfile\_custom_. Don't forget to run +in the file _Gemfile\_custom_, where `x.y.z` is the version defined in the `.ruby-version` file in the CONSUL repository. Don't forget to run ``` bundle install diff --git a/docs/es/installation/local_installation.md b/docs/es/installation/local_installation.md index 99a2ae1f5..decc831ea 100644 --- a/docs/es/installation/local_installation.md +++ b/docs/es/installation/local_installation.md @@ -2,20 +2,41 @@ Antes de comenzar a instalar Consul, comprueba que tengas todos los [prerrequisitos](prerequisites.md) correctamente instalados. -1. Primero, clona el [repositorio de Consul en Github](https://github.com/consul/consul/): +1. Primero, clona el [repositorio de Consul en Github](https://github.com/consul/consul/) y ve a la carpeta del proyecto: ```bash git clone https://github.com/consul/consul.git +cd consul/ ``` -2. Ve a la carpeta del proyecto e instala las gemas requeridas usando [Bundler](http://bundler.io/): +2. Instala la versión de Ruby necesaria con el gestor de versiones de tu elección. Algunos ejemplos: + +```bash +rvm install `cat .ruby-version` # Si usas RVM +rbenv install `cat .ruby-version` # Si usas rbenv +asdf install ruby `cat .ruby-version` # Si usas asdf +``` + +3. Comprueba que estemos usando la versión de Ruby que acabamos de instalar: + +```bash +ruby -v +=> # (debería aparecer la versión mencionada en el fichero .ruby-version) +``` + +4. Instala [Bundler](http://bundler.io/) + +```bash +gem install bundler +``` + +5. Instala las gemas requeridas usando Bundler: ```bash -cd consul bundle ``` -3. Copia los archivos de configuración de ejemplo del entorno dentro de unos nuevos válidos: +6. Copia los archivos de configuración de ejemplo del entorno dentro de unos nuevos válidos: ```bash cp config/database.yml.example config/database.yml @@ -24,7 +45,7 @@ cp config/secrets.yml.example config/secrets.yml Y configura los de tu usuario de base de datos `consul` en `database.yml` -4. Ejecuta las siguientes [tareas Rake](https://github.com/ruby/rake) para crear y rellenar tu base de datos local con el mínimo de información necesaria para que la aplicación funcione correctamente: +7. Ejecuta las siguientes [tareas Rake](https://github.com/ruby/rake) para crear y rellenar tu base de datos local con el mínimo de información necesaria para que la aplicación funcione correctamente: ```bash rake db:create @@ -33,13 +54,13 @@ rake db:dev_seed rake db:test:prepare ``` -5. Comprueba que todo funciona correctamente lanzando la suite de tests (ten en cuenta que podría tardar más de una hora): +8. Comprueba que todo funciona correctamente lanzando la suite de tests (ten en cuenta que podría tardar más de una hora): ```bash bin/rspec ``` -6. Ahora que ya está todo listo puedes ejecutar la aplicación: +9. Ahora que ya está todo listo puedes ejecutar la aplicación: ```bash bin/rails s diff --git a/docs/es/installation/macos.md b/docs/es/installation/macos.md index be924ad59..c20abe8c7 100644 --- a/docs/es/installation/macos.md +++ b/docs/es/installation/macos.md @@ -14,14 +14,12 @@ Para utilizar git necesitarás instalar *Xcode* (está en la Mac App Store) y la Puedes descargar git desde: [git-scm.com/download/mac](https://git-scm.com/download/mac) -## Ruby y rbenv +## Gestor de versiones de Ruby OS X ya viene con una versión preinstalada de ruby, pero es bastante vieja y en nuestro caso no nos sirve. Una de las formas de instalar Ruby es a través de rbenv. Las instrucciones de instalación están en su GitHub y son bastante claras: [github.com/rbenv/rbenv](https://github.com/rbenv/rbenv) -Después instala la versión de Ruby 2.4.9 - ## Bundler ``` @@ -108,4 +106,4 @@ brew install chromedriver brew install imagemagick ``` -Ahora que ya tenemos todas las dependencias instalado podemos bajarnos el proyecto: [instalar Consul](local_installation.md) +Ahora que ya tenemos todas las dependencias instalado podemos proceder con la [instalación de Consul](local_installation.md) diff --git a/docs/es/installation/ubuntu.md b/docs/es/installation/ubuntu.md index ba5285a40..3e72cca6c 100644 --- a/docs/es/installation/ubuntu.md +++ b/docs/es/installation/ubuntu.md @@ -16,7 +16,7 @@ Git es mantenido oficialmente en Ubuntu: sudo apt install git ``` -## Ruby +## Gestor de versiones de Ruby Las versiones de Ruby empaquetadas en repositorios oficiales no son aptas para trabajar con CONSUL, así que debemos instalarlo manualmente. @@ -26,7 +26,7 @@ En primer lugar, necesitamos los siguiente paquetes para poder instalar Ruby: sudo apt install libssl-dev autoconf bison build-essential libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev ``` -El siguiente paso es instalar un gestor de versiones de Ruby, como rbenv: +A continuación instalaremos un gestor de versiones de Ruby, como rbenv: ```bash wget -q https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer -O- | bash @@ -35,28 +35,6 @@ echo 'eval "$(rbenv init -)"' >> ~/.bashrc source ~/.bashrc ``` -Por último, para instalar Ruby 2.4.9 (proceso que llevará unos minutos): - -```bash -rbenv install 2.4.9 -``` - -## Bundler - -Comprueba que estemos usando la versión de Ruby que acabamos de instalar: - -```bash -rbenv global 2.4.9 -ruby -v -=> ruby 2.4.9p362 -``` - -E instala Bundle con: - -```bash -gem install bundler -``` - ## Node.js Para compilar los archivos estáticos (JS, CSS, imágenes, etc.), es necesario un _runtime_ de JavaScript. Node.js es la opción recomendada.