PAP — Como instalar Ruby on Rails en W10

1. Habilitar Bash de linux en Windows 10

2. Instalar ruby (instalación recomendada RVM)

Pre-requirimientos

Primero preparar dependecias minimas:

sudo apt-get update

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

Luego instalar RVM

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

curl -sSL https://get.rvm.io | bash -s stable

source ~/.rvm/scripts/rvm

rvm install 2.4.2

rvm use 2.4.2 --default

ruby -v

Luego Bundler y despues de este paso configurar ssh keypars (ejemplo Github)

gem install bundler

Después va Rails, Node.js:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

sudo apt-get install -y nodejs

gem install rails -v 5.1.4

Finalmente, probar versión de Ruby y Rails:

ruby -v

rails -v
# Rails 5.1.4

Pasos finales. Bases de datos y montar dirctorio en Windows

Para Postgres lo mas sencillo es bajar y instalar versión adecuada para Windows (link)

Idealmente, realizar cualquier desarrollo de RoR en Windows Subsystem for Linux en el directorio “/mnt/c”. Es el disco C: en Windows.

Posibles problemas

Al crear una app nueva en Rails, puede ocurrir error de lectura de directorios. Solución:

chmod +t -R ~/.bundle

Ejemplo de una aplicación nueva en RoR:

# Navigate to the C: drive on Windows. Do this every time you open the Linux console.
cd /mnt/c

# Create a code directory at C:\code for your Rails apps to live (You only need to do this once)
mkdir -p code

#### If you want to use Postgres
# Note that this will expect a postgres user with the same username
# as your app, you may need to edit config/database.yml to match the
# user you created earlier
rails new myapp -d postgresql

#### or if you want to use SQLite (not recommended)
# rails new myapp

#### Or if you want to use MySQL
# rails new myapp -d mysql

# Then, move into the application directory
cd myapp

# If you setup MySQL or Postgres with a username/password, modify the
# config/database.yml file to contain the username/password that you specified

# Create the database
rake db:create

rails server

Mas recursos: Articulo original

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.