I blog, therefore I am?

"Reading, after a certain age, diverts the mind too much from its creative pursuits. Any man who reads too much and uses his own brain too little falls into lazy habits of thinking."
- Albert Einstein

Install Ruby on Rails on Windows 10 (64 bit) – Detailed steps and instructions

 

We recently had to install a ruby on rails project on several Windows 10 Pro machines. Well, don’t ask why Windows, it just had to be.

Here are the actual steps to make the magic happen. We are using Heroku for hosting.

If you are still having issues, please ask us.

 

1. Install a database. In our case Postgres.

http://www.postgresql.org/download/

2. Install ruby

Download the RubyInstaller for Windows. Watch for 64/32 bit versions. We used 64 bit and despite of some warnings from RoR community, all worked out fine.

http://rubyinstaller.org/downloads/

3. Update gems

> gem update --system

4. Install NodeJS

http://nodejs.org

5. Install devkit (64 bit if using win64bit)

Extract the DevKit zip (self-extracting exe) file into “C:\DevKit” directory.

Go to cmd window:
> cd "C:\DevKit"
> ruby dk.rb init
> ruby dk.rb install

6. Install Rails

> gem install rails

If any error occurred in this command, update gems:
> gem update --system (to install the latest version of gems)
> bundle install (to bundle updated gems)
> gem install rails

7. Install git and github

After installing git, get code from github repository:
> cd c\work\ruby (for example)
> git clone https://github.com/xxxxx/xxxxx.git

8. Import database

Configure values for dev env in config/database.yml (e.g. postgres/admin)

Note: If your database is on e.g. Heroku, get the latest database from heroku and rename it to e.g. latest.dump and then run this:

> rake db:drop
> rake db:create
> pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgres -d [dbname] latest.dump
> rake db:migrate

9. Set Env Path

user vars:
C:\Ruby22-x64\bin

System vars:
C:\Program Files\nodejs\
C:\Program Files\PostgreSQL\9.5\bin
C:\DevKit\bin
C:\DevKit\mingw\bin

set env var for Amazon AWS (if needed)
AWS_REGION=us-west-2

10. Fix bcrypt

> gem install bcrypt

Note: if you get an error, run the code below:

> cd C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x64-mingw32\ext\
> cd mri
> make
> make install

11. Bundle install

> bundle install

12. Start the application

> rails s
Then open a browser and go to:

htpp://localhost:3000
htpp://localhost:3000/admin (if ActiveAdmin is used)

13. If needed, create another admin user (optional)

Use the console to make an admin user:

> rails c
> AdminUser.create(email: 'your@email.com', password: 'temp5454', password_confirmation: 'temp5454')

14. Get Atom (IDE)

Install package for slim framework
Uncheck ‘remove whitespace’ option in that package

15. Get Heroku toolbelt and install it using your Heroku credentials