How to Make a Gemset in Rvm the Default

how to make a gemset in RVM the default?

Have you tried specifying rvm --default use after the gemset is created so passing:

 rvm --default use ruby-1.9.3-p0@rails3.2

and then seeing if that sticks? Using create and default at the same time isn't something I've tried before, it's the only thing that strikes me as out of place.

Given the discussion below I'd offer this as a means for dealing with the problem. (Personally, I'd probably implode rvm and start over.) But, if you wanted to try to make a go of it with this install then I'd look at your .rvm folder, specifically in .rvm/environments/default which will contain all the environment variables exported for the default environment. Here you'll find rvm_gemset_name this may be set incorrectly and isn't updated for some reason (permissions?) or is set correctly in which case its some other environment issue. You could try manually setting it here in the file if its not correct.

How to set the default gemset in RVM with Rails & Heroku

Only way you could do it is to add two files to your application: .ruby-version and .ruby-gemset and add 2.1.1 in the .ruby-version file and rails4 in the .ruby-gemset file.

You can also do this on your command line with:

echo 2.1.1 > .ruby-version

and

echo rails4 > .ruby-gemset

And that will create the files for you with the version 2.1.1 and the gemset rails4

So whenever you open a new terminal, rvm will use ruby 2.1.1 and gemset rails 4

Check out more on rvm documentation

Hope this helps

How do I change the default gemset and ruby version for my project?

if you want a specific gemset and ruby version per project just manually create a .rvmrc file in your root project directly. In that file add:

ruby-1.9.3-p362@gemset-name --create

Or if you don't want to manually create it, you can have rvm do it for you. cd into the root directory of your project and create a .rvmrc file like this:

$ rvm use ruby-1.9.3-p194@gemset-name --create --rvmrc

Make sure the .rvmrc file contains a line similar to this and in this format:

 environment_id="ruby-1.9.3-p392@gemset-name"

Update:

The convention used for setting the ruby version and a gemset per project when using RVM is to use a .ruby-version file and a .ruby-gemset file in the project's root directory.

A .ruby-version file would look like this:

ruby-2.0.0-p598

A .ruby-gemset file would look like this:

my_gemset_name

Whats the command to let rvm use default (like global) gemset for every new rails application I create?

You can specify a "default" gemset for a given ruby interpreter, by doing:

rvm use ruby-1.9.2-p0@gemsetname --default

See: http://beginrescueend.com/gemsets/using/ and http://beginrescueend.com/gemsets/basics/

it's probably a better idea to use a specific gemset for each of your projects, together with it's specific Gemfile. Problems could happen if you require '>= x.y.z' in your Gemfiles, and you do a bundle update in one project, but not in the other...

cd ProjectA
rvm gemset create projecta
rvm gemset use projecta

cd ProjectB
rvm gemset create projectb
rvm gemset use projectb

This way, although you update the gems in ProjectA via bundle update to the latest and greatest, they still don't get modified for ProjectB -- eliminating the possibility for interference between projects.


you can also add a .rvmrc file to a directory, e.g. your project directory. RVM will then use the ruby-version and gem set listed in the .rvmrc file as the default for all sub-directories.

e.g. assuming that you have ruby 1.9.3 installed, and a gem set "rails_3.2" for that ruby version:

# cat .rvmrc
rvm use ruby-1.9.3-p0@rails_3.2

RVM .ruby-gemset file does not switch gemsets

It seems you must have both a valid .ruby-version file and a .ruby-gemset file in order for rvm to make the switch.

I was hoping it would switch gemsets and use the default ruby version, since the gemset is one of the existing gemsets for my default ruby. But that's not how it works.

Difference between rvm default and global gemset

Global is documented at rvm site - http://rvm.io/gemsets/global :

Gems you install to the @global gemset for a given ruby are available to all other gemsets you create in association with that ruby.

This is a good way to allow all of your projects to share the same installed gem for a specific ruby interpreter installation.

As for default it is just the gemset when you do not specify a gemset name, this is why it is listed in brackets in rvm gemset list:

gemsets for ruby-2.0.0-p247 (found in /home/mpapis/.rvm/gems/ruby-2.0.0-p247)
(default)
global
=> rvm-site

Where for both (default) and rvm-site all gems from global will be available.

You can select the default gemset by skipping the gemset name:

rvm use 2.0.0

or to switch to default of the current ruby - in case other was used:

rvm use @default

To access any gemset temporarily you can use:

rvm @global do gem install jist

This is especially useful for managing gems installed in global gemset - so those that will be available in all other gemsets of that ruby.

RVM does not change gemset upon entering directory

You'll want to create a project (or directory) specific file per these docs: http://rvm.io/workflow/projects Those will change your ruby version and gemset upon entering the directory where that file is located.

rvm resetting the default

i don't know why synonym "rvm use 1.9.2" stop working and shows such a strange behavior but
assuming using the exact name of rubie work, you can try to specify gemset like this

rvm use ruby-1.9.2-p290@rails304

or to setup as default

rvm use ruby-1.9.2-p290@rails304 --default


Related Topics



Leave a reply



Submit