Skip to content

Commit

Permalink
Merge pull request consuldemocracy#96 from consul/ruby_version
Browse files Browse the repository at this point in the history
Install Ruby based on CONSUL's .ruby-version
  • Loading branch information
javierm committed Jul 8, 2020
2 parents 2b1a423 + b5eff7b commit 06fe16d
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 115 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 2 additions & 16 deletions docs/en/installation/debian.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions docs/en/installation/deploying-on-heroku.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 28 additions & 7 deletions docs/en/installation/local_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 --version 1.17.1
```

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
Expand All @@ -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 needed to run the application:

```bash
rake db:create
Expand All @@ -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
Expand Down
14 changes: 3 additions & 11 deletions docs/en/installation/macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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).
24 changes: 1 addition & 23 deletions docs/en/installation/ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/es/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

```
Expand Down
18 changes: 2 additions & 16 deletions docs/es/installation/debian.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions docs/es/installation/deploying-on-heroku.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 28 additions & 7 deletions docs/es/installation/local_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 --version 1.17.1
```

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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 2 additions & 4 deletions docs/es/installation/macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
Expand Down Expand Up @@ -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)
Loading

0 comments on commit 06fe16d

Please sign in to comment.