How to install ruby-1.9.3-rc1 using rvm

rvm adds ruby 1.9.3-rc1 into their set (ruby developer community announced it on last Saturday 24th Sep 2011). I tried this on a Mac. Should be the same on linux as well.

Before installing ruby 1.9.3-rc1 , you might want to check out what is being deprecated and what is being added in future versions of ruby. There is a blog post on rubyinside about this. 

rvm install 1.9.3-rc1

rvm use 1.9.2-p290

rvm gemset export 192.gems

rvm use 1.9.3-rc1

rvm gemset import 192

rvm —default 1.9.3-rc1

Change the appropriate .rvmrc files in your projects to use the new and improved ruby. 

How to avoid git commits using the wrong profile

Have you ever committed to the right repo using the wrong profile? I have, so many times that I have lost count. It has always been a pain for me to remember which git account (office, personal, etc) I was currently logged into before making a commit.

I am sure there are many people out there facing the same problem. An article from one of the ruby articles led me to gas (stands for ‘Git Account Switch’? I don’t know). So basically, gas lets you maintain multiple git accounts and also switch from one account to another with a command as simple as,

gas use office #if the name of the profile is ‘office’

Do you see the problem here? Yes, even though gas reduced the number of steps to change the profile, it is still a manual step.

So we still need to remember to change the profile when we change to the associated project folder.

The following is my hack using rvm’s (inefficient) feature of executing the current directory’s .rvmrc file every time you change directories (By the way, if you are not already using rvm, I recommend you do so!)

Example

/home/sairam/code/office/.rvmrc

rvm use ruby-1.9.2-p290-patched # which ruby version to use 

gas use office

/home/sairam/code/personal/.rvmrc

rvm use ruby-1.9.2-p290

gas use personal 

So from now on, whenever I change to ‘office’ or ‘personal’ directories, the corresponding .rvmrc files in the hierarchy are executed and the right git profile is applied thanks to gas.

P.S: If you want to change a mistake which you already made, there is git filter-branch