Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Listing, Managing and Using Ruby versions

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 531
    Comment on it

    Listing, Managing and Using Ruby versions in Rails application

    I am writing this blog to discuss how can we see ruby versions installed in our system. In addition to it this blog

    also contains how can we manage them and use different versions of ruby in out application according to the

    need.

    Follow the underlying steps to check which ruby version you are using currently for your app

    • Go to the root folder of your app
    • After reaching to the root folder type the below code on console
    $ ruby -v

    The output could be something like this according to the version you have currently.

    ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]

    So this tells me that my ruby version currently is 2.1.5.

    Now, Follow the underlying steps to check what all ruby versions you have installed in your system

    But before that lets take a brief look on Ruby Version Manager .

    • RVM which can be abbreviated as ruby version manager is a unix software platform which is designed to manage more than one version of ruby on the same device.
    • The whole ruby has different versions which can be switched from one to another which helps the coder to use different ruby versions for different projects.
    • We can install more than one version of rubies on our device and then we can use them for different projects individually.
    • We use the term "rvm" on console when we have to use the ruby version manager.
    $ rvm list

    The output could be something like this according to the versions you have currently in your system.

    rvm rubies
    
    =* ruby-2.1.5 [ x86_64 ]
       ruby-2.2.1 [ x86_64 ]
    
    # => - current
    # =* - current && default
    #  * - default

    Now suppose you have to use version 2.1.1 specifically for your current app so you need to write this code in your

    console to change your version to 2.1.1 from 2.1.5

    $ rvm use ruby-2.1.1

    and suppose you want to keep the default version of ruby as 2.1.1 for all the apps then you need to write this code

    in your console to set ruby version 2.1.1 as current and default

    $ rvm --default use 2.1.1

    And finally at last you have to run a bundle install to install the required gems as per your ruby version.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: