====== RVM ====== ===== Usage ===== ==== Installation ==== - %%\curl -L https://get.rvm.io | bash -s stable%% - install stable version - Add to ~/.zshrc, ~/.bashrc: export PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function [[ -r $HOME/.rvm/scripts/completion ]] && . $HOME/.rvm/scripts/completion - Logout/Login to complete the installation. ==== Get State ==== * %%rvm list%% - show currently installed rubies; * %%rvm list known%% - show all known RVM installable Rubies; * %%rvm gemset list%% - list installed gemsets for selected Ruby version; * %%rvm info%% - show the current environment information for current ruby; * %%rvm gemdir%% - gem directory of the currently selected ruby. ==== Install Ruby ==== - %%rvm install 1.9.3 --autolibs=read-only%% - install Ruby of specific version; - %%rvm gemset create rails3myproject%% - creates gemset with //rails3myproject// name; - %% rvm use 1.9.3@rails3myproject --default%% - use Ruby 1.9.3 with //rails3myproject// gemset for new shells; - %%rvm rubygems current%% or %%rvm rubygems latest%% - install the most recent RubyGems that RVM knows about; - %%rvm rubygems 1.8.29%% - install version 1.8.29 of RubyGems; - %%gem install rails -v 3.2.15%% - install specific rails in current gemset; - %%gem install bundler%% - install Bundler; - %%rvm use 1.9.3@rails3 --create --default%% - short way to create and use specific Ruby&Rails for current and new shells; - %%rvm wrapper ruby-name%% - create symlinks in ~/.rvm/bin for specific Ruby version; - %%rvm wrapper default --no-prefix%% - create symlinks in ~/.rvm/bin for default Ruby version. ==== Upgrading ==== * %%rvm get stable%% - update to the latest stable version ==== Remove Unused ==== * %%rvm gemset delete rails2%% - remove the entire gemset directory 'rails2'; * %%rvm rubygems remove%% - remove the different version installed of RubyGems; * %%rvm uninstall 1.8.7%% - uninstall Ruby-1.8.7 but keep sources; * %%rvm remove 1.8.7%% - uninstall Ruby-1.8.7 with sources. * %%gem pristine charlock_holmes%% - removes charlock_holmes gem ==== Useful Commands ==== * %%rvm reset%% - reboot RVM; * %%rvm implode%% - fully remove RVM; * %%rvm use system%% - use System's Ruby version; * %%rvm gemset export%% - export gemset to default.gems; * %%rvm gemset import default.gems%% - install gemset from default.gems list. ==== Separate Ruby for Projects ==== Create //$project/.rvmrc// file with %%rvm use RubyVersion@projectname%% for example %%rvm use 1.9.3@rails3%%. ==== Typical Scanarios ==== Redmine installations: command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - curl -sSL https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm rvm reload rvm install 2.4.10 --autolibs=read-only # Redmine only rvm use 2.4.10@global --create --default # Redmine only gem uninstall bundler; gem install bundler # Temporary workaround: 1.12.3 requires to unlock nproc limits protection rvm wrapper regenerate bundle # updates symlinks in ~/.rvm/bin cd redmine bundle update bundle install --no-deployment --without development test # Redmine only paxctl -m `which ruby` # Hardened Gentoo only ==== Links ==== * [[http://rvm.io/integration/bundler|RubyGems Bundler Integration]].