-
-
Save estevanjantsk/4131bb90f48ee17b1c2cd47eff5feb5d to your computer and use it in GitHub Desktop.
RVM cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Open terminal and check versions of Ruby on Rails agains production server params or to make sure you are using the mos recent stable version. | |
$ ruby -v | |
$ rvm list | |
$ rvm list know | |
$ rvm install ruby 2.2.1 | |
$ rvm list | |
$ ruby -v | |
$ gem install rails | |
$ rails -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RVM home page: http://rvm.beginrescueend.com | |
rvm list rubies | |
rvm list gemsets | |
rvm @global do gem install ... | |
.ruby-version and .ruby-gemset | |
------ | |
echo "ruby-2.3.0" > ~/projects/project_name/.ruby-version | |
echo "project" > ~/projects/project_name/.ruby-gemset | |
Upgrade to the latest version of rvm from github | |
------------------------------------------------- | |
rvm update --head | |
Ruby on Rails 3 Tutorial says to follow this with | |
rvm reload | |
rvm install 1.8.7 | |
rvm install 1.9.2 | |
and, if you need a patchlevel, do something like | |
rvm install 1.8.7-p174 | |
Install a given version of ruby | |
-------------------------------- | |
rvm list known | |
rvm install 1.9.2 | |
Open a new shell and rvm! | |
------------------------- | |
rvm use 1.9.1 | |
>> Switching to ruby 1.9.1 ... | |
ruby -v | |
>> ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux] | |
which ruby | |
>> /home/wayne/.rvm/ruby-1.9.1-p243/bin/ruby | |
Make 1.9.2 default for all new shells | |
-------------------------------------- | |
rvm --default 1.9.2 | |
Reverting to system default | |
---------------------------- | |
rvm system | |
ruby -v | |
>> ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0] | |
which ruby | |
>> /usr/bin/ruby | |
Installing gems in multiple ruby versions | |
------------------------------------------ | |
rvm 1.8.6,1.9.1 gem install rspec json --no-rdoc --no-ri | |
Starting a new project? Create a Gemset and rvmrc at the same time: | |
Working with gemsets | |
-------------------- | |
rvm 1.8.7 # use the ruby to manage gemsets for | |
rvm gemset create project_name # create a gemset | |
rvm gemset use project_name # use a gemset in this ruby | |
rvm gemset list # list gemsets in this ruby | |
rvm gemset delete project_name # delete a gemset | |
rvm 1.9.1@other_project_name # use another ruby and gemset | |
The global gemset | |
----------------- | |
With every ruby, rvm creates the global gemset. Gems installed into this | |
gemset are available to all gemsets in the ruby. | |
rvm 1.8.7 | |
rvm gemset create project_name | |
gem list # no gems :( | |
rvm gemset use global | |
gem install rake | |
rvm gemset use project_name | |
gem list # rake :) | |
Install a gem directly into the global gemset: | |
rvm 1.8.7@global gem install shoulda | |
Install cheat in the global gemset when you install a new ruby: | |
echo "cheat" >> ~/.rvm/gemsets/global.gems |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment