rvm gemset with a specific ruby patch e.g. pNNN - ruby

I want to create a gemset with a specific patch version of ruby. Generally I use
rvm use 2.0.0#billslim --create
without issue, however i need to use 2.0.0p481, but specifying p481 doesn't work e.g.
rvm use 2.0.0-481#billslim --create
and if i only use 2.0.0 it always try to install p594.
I've tried
rvm use 2.0.0-481#billslim --create
rvm use 2.0.0p481#billslim --create
rvm use 2.0.0#billslim -l 481 --create
rvm --ruby-version use 2.0.0p481 # unknown ruby string, BUT
rvm --ruby-version use ruby-2.0.0p481 # also gives unknown ruby string
adding a .ruby-version file in my repository root e.g. echo 'ruby-2.0.0p481' > .ruby-version
different formats of the strings e.g. ruby-2.0.0 and ruby-2.0.0-p481 but these result in 'unknown ruby string'
nothing works...
the rvm.io docs don't seem to mention patch versions much when doing gem sets
the other info suggests patch versions should work the suggested formats don't work.

of course the only combination i didn't try, works!
rvm use ruby-2.0.0-p481#billslim --create
doh!

Related

Issue with creating a gemset via Chef - .ruby-gemset and .ruby-version not getting created

I have included rvm --create --ruby-version ruby-2.3.3#storesview in my recipe to create a gemset. Running the kitchen converge does not result in the creation of .ruby-gemset and .ruby-version. But when I run rvm --create --ruby-version ruby-2.3.3#storesview directly on the VM terminal, the files are getting created. What could be the reason? Thanks.
Here's what my bash code looks like :
bash "somename" do
user 'root'
cwd "/var/www/html/APIStoresView/"
code <<-EOH
rvm --create --ruby-version ruby-2.3.3#storesview
EOH
end
In general use of rvm on servers should be discouraged, and Chef+rvm is dicey at the best of times. More specifically, appbundler (used by Chef to create marginally bullet proof binary stubs) sets a lot of environment variables that can confuse rvm.
If you need a specific version of Ruby for a project, I would highly recommend using poise-ruby+poise-ruby-build and Bundler rather than rvm and gemsets.

How do I uninstall an old version of Ruby, and is it a wise thing to do?

When logged in as root and I type ruby -v centOS server reports 'ruby 1.9.3p392'. This is what I want.
But if I put rvmsudo ruby -v then I get 'ruby 1.8.7'. I do not want to use this older version, it is causing problems for my gitlab install.
I would like to remove it and make sure only v1.9 is used, how can I do this? Or should I leave it there but try and require certain users to use a different version?
Also, in case doing this messes anything up, is it possible to either;
a.see if anything on the server requires v1.8?
b.reverse the uninstall if it causes a problem?
Before uninstalling, take note of the patch level of 1.8.7 just in case. rvmsudo ruby -v should return something like ruby 1.8.7p234. The p#{num} is your patch level.
You should be able to uninstall 1.8.7 with rvm uninstall 1.8.7 (or possibly rvmsudo uninstall 1.8.7). This version of Ruby shouldn't be used by anything on the system other than code you've written, so it should only affect your applications and scripts.
The best way to tell what else would be using 1.8.7 is to look for scripts and crontabs that are owned by the user that rvm is running under. I'm not sure there's a tool that can evaluate it for you.
The best way to roll back in case of an emergency is rvm install 1.8.7-p#{num_from_above}. Alternatively, if you're on a platform like AWS or have rsync backups enabled, you might consider taking a snapshot that you can roll back to if you get in over your head.
Hope that's helpful!
Try setting default
$ rvm --default use 1.9.2
$ ruby -v
#ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
to remove you can use:
sudo apt-get remove ruby 1.8.7
Docs here & here
As you mentioned the ruby version output for root is ruby 1.9.3p392 in my understanding you will not have any problems.
Sure, you can have more than one version of ruby installed and find them under ~/.rvm/rubies. Also there you can find out the default version which is used. For more information you can have a look here: set default ruby where it explains how to set a default ruby and how to reset to the systems default.
You can uninstall cocoapods and install cocapods in the right directory.
sudo gem uninstall cocoapods
sudo gem install -n /usr/local/bin cocoapods

rvm doesn't notify when using a new gemset

I'm using rvmrc files per project. When I cd into my project the terminal/rvm does not indicate that I'm using a new gemset. How do I set it up?
In case it helps: I'm using oh-my-zsh.
it might depend on your project files, basically rvm will not print information about using when the use keyword is omitted:
rvm 1.9.3 # will be quiet
rvm use 1.9.3 # will print: Using...
the same result will be when you put those in .rvmrc, also generating new .rvmrc with --rvmrc will behave the same way:
rvm 1.9.3 --rvmrc # `cd` will be quiet
rvm use 1.9.3 --rvmrc # `cd` will print: Using...

How to automatically start Ruby Version Manager

Is there a way to automatically load rvm on start up?
Every time I open a new terminal window I need to type rvm 1.9.2 to be able to use the gem set. Can I add 1.9.2 as a default?
There are several ways
The normal one is
rvm use 1.9.2 --default
You could also create a file .rvmrc which can also load a specific gemset per folder. For example if you have an application that uses the gemset 1.9.2#myapp, your .rvmrc in myapp could be:
# myapp/.rvmrc
rvm use 1.9.2#myapp --create
you should be able to simply do this;
rvm --default use 1.9.2

RVM: Create a gemset for whatever ruby is currently running

I want to use per project gemsets. But I don't want to specify the ruby version.
Something like:
#.rvmrc
rvm --create use "#project"
But this give me the following error:
error: Unknown ruby interpreter string component: 'ruby 1.9.2 p136'
info: Now using system ruby.
Is there a way to do what i want?
I'm not sure if that's the case but perhaps
rvm --create use doesn't support params without ruby version.
#.rvmrc
rvm gemset create "project"
rvm gemset use "project"
I didn't check this, just saw at:
http://rvm.beginrescueend.com/gemsets/creating/

Resources