Thursday, December 15, 2016

How to Install Ruby on Rails in Windows

             
Step 1: First check if ruby already installed.
Type:                ruby –v    [If Installed ruby version must come. ]
Similarly, check for rails,
Type:               rails -v





Step 2: Go to http://railsinstaller.org/
Scroll to the 'Downloads' section, and download the RailsInstaller for Windows/Ruby 2.2.




Step 3.  Once installer is downloaded , run executable file railsinstaller-3.2.0.exe.


Step 4. Check Agreement and click Next


Step 5: Ensure checkbox is selected and make a note of installation drive. And press Install,


Step 6. Finish Installation.


Note-:  We can skip git configuration as we are dealing with installation of ruby and rails in this document.


Step 7.Check Ruby Installed or not. Go to command prompt.
Firstly, check ruby installation
  Type:                ruby –v  

Similarly, check for rails,
Type:               rails -v


Note-:If on checking  version,  error message comes like “The system cannot find the path specified.”



Then we need to make following changes in batch files-:
a. Go to  “C:\RailsInstaller\Ruby2.2.0\bin”
b. Open  rails.bat file in text editor.
Instead of the string @"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" the files should contain something like @"%~dp0ruby.exe".(this replacement should be made everywhere there is aforementioned line)
For eg:
rails.bat
@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" "C:/Users/emachnic/GitRepos/railsinstaller-windows/stage/Ruby2.2.0/bin/rails" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" "%~dpn0" %*
Snapshot-:







Now check rails version in command prompt, it should work fine now.



Note-: Similarly we need to make changes in all batch file in bin folder.  This is the problem with setup of rubyinstaller . Else we need not to make these changes.

Step 8: Update RubyGems
Follow these steps to upgrade it.

Step 8.1: Check to see if you need to update
Type:  gem -v

If version lower than 2.6.0 then you can update gem.

Step 8.2: Download the update
a. Visit https://rubygems.org/downloads/rubygems-update-2.6.8.gem
b. Right click -> Save target as... the file rubygems-update-2.6.8.gem to your C:\Sites directory

Step 8.3: Install the update
a. Back at the command prompt, run the following commands:



b. Run update command to reflect changes.

Step 8.4 check gem version again.

Note -: RailsInstaller includes Rails, Ruby, Git and SQLite.

2 comments:

  1. Brilliant blog I visit this blog it's incredibly awesome. Curiously, in this blog content formed doubtlessly and sensible. The substance of information is helpful.
    Workday Online Training

    ReplyDelete

Interview Prep: Java full stack

 SOLID principle :  https://www.educative.io/answers/what-are-the-solid-principles-in-java Design Pattern:  Creational:  https://medium.com...