Skip to content

Instantly share code, notes, and snippets.

@rplaurindo
Last active March 25, 2018 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rplaurindo/296a4841e7c5a9d1dfc66f9e9a81f819 to your computer and use it in GitHub Desktop.
Save rplaurindo/296a4841e7c5a9d1dfc66f9e9a81f819 to your computer and use it in GitHub Desktop.

RVM (Ruby Version Manager)

Required packages

  • sed
  • tar
  • curl
  • gnupg

Import the mpapis Public Key through GPG (GNU Privacy Guard)

$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Obs.: maybe you’ll can use gpg2.

See more about the security here.

Integrating with Gnome-terminal

  • Open the menu Edit > Profile Preferences
  • Click on tab Command and mark the checkbox Run command as a login shell.

See more about integration here.

Downloading

$ \curl -sSL https://get.rvm.io | bash -s -- --ignore-dotfiles

Installing

$ echo "source ~/.rvm/scripts/rvm" >> ~/.profile

Obs.: .profile should contain

if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
fi

Load RMV for first time

$ source ~/.profile

Installing a Ruby specific version

$ rvm install <version>

Obs.: For another user will be necessary to reinstall an already installed version.

Choise a Ruby ersion

Default

$ rvm use <version> --default

Permanently for a local

In a especific root folder project

$ rvm --ruby-version use <version>

For see the available list for choose, run:

$ rvm list

Updating The RVM

$ rvm get stable
$ rvm reload

The RVM project index is here.

Working with gemset

To create a gemset, inside of root folder project run

$ rvm gemset create <gemset>

... or create the file .ruby-gemset with gemset name as content.

Working with .rvmrc file within the project

You can want installing gems inside a some folder (as vendor, for example) of your project. For that, create .bundle/config file inside of root folder with the follow content

---
BUNDLE_PATH: "<path>"

Create, inside of root folder of your project, the .rvmrc file with follow command

$ rvm --rvmrc --create @<gemset>

So edit ~/.rvm/environments/ruby-<version>@<gemset> file according with your demands and run

$ cd .

Always that you get in at the root folder of your project, a warning about .rvmrc file will be given.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment