When I’m working on ruby based projects I use rvm to manage and switch between differing ruby versions and gemsets.
I don’t ever keep my .ruby-version or .ruby-gemset files (or the old .rvmrc) under version control. Which means that I have to recreate them each time I clone a copy of the project. Sometimes I will have the same project cloned out in differing folders. I have usually tried to keep folder specific gemsets; that way I don’t have to get creative with gemset names as the gemset is basically the full path of the folder that I am in.
Here is the script that I use to create a new .ruby-version and .ruby-gemset in the current folder that I am in:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
This file is marked executable and in my path (I name it rvmgsc). Whenever I enter a new folder that I want a gemset for I can call it either with an argument of the ruby version that I want to use. If I don’t pass any arguments it will list the ruby versions that I have and let me choose. The script will then continue to make an .ruby-version and .ruby-gemset file, with the correct contents.