We can create a new gemset to install a specific set of gems in it. In this i am copying an existing gemset into a newly created gemset.
1> To list the available gemsets we can type :
rvm gemset list
gemsets for ruby-2.2.3 (found in /home/taran/.rvm/gems/ruby-2.2.3)
=> (default)
global
2> We will create a new gemset named sample_gemset
rvm gemset create sample_gemset
ruby-2.2.3 - #gemset created /home/taran/.rvm/gems/ruby-2.2.3@sample_gemset
ruby-2.2.3 - #generating sample_gemset wrappers........
3> Now we can copy any gemset into this newly created gemset. Suppose i want to copy global gemset into this newly created sample_gemset
rvm gemset copy 2.2.3@global 2.2.3@sample_gemset
Copying gemset from 2.2.3@global to 2.2.3@sample_gemset
Generating gemset wrappers ruby-2.2.3@sample_gemset...............................-
Making gemset 2.2.3@sample_gemset pristine........................................
4> We can verify that sample_gemset has all the gems of global gemset. For this i am checking the version of rails. It will now have the same version of rails which was present in global gemset.
rvm use 2.2.3@sample_gemset
Using /home/taran/.rvm/gems/ruby-2.2.3 with gemset sample_gemset
rails -v
Rails 4.2.0
4> If we want to delete this sample_gemset we can use
rvm gemset delete sample_gemset
Are you SURE you wish to remove the entire gemset directory 'sample_gemset' (/home/taran/.rvm/gems/ruby-2.2.3@sample_gemset)?
(anything other than 'yes' will cancel) > yes
Removing gemset sample_gemset......
1 Comment(s)