1

I have Rails application that I've cloned from github:

https://github.com/RailsApps/rails3-devise-rspec-cucumber

When I run bundle, a new gemset rails3-devise-rspec-cucumber is created.

  1. Could you please explain, why that particular application forces rvm to create a gemset, while any other application won't do it?

  2. How can I prevent application from creating a gemset and force it to use the global gemset?

Thank you!

Alex Smolov
  • 1,831
  • 4
  • 24
  • 43

1 Answers1

2

Take a look at the list of files in the repo you linked. You should see two files named .ruby-version and .ruby-gemset. The latter is what RVM is using to determine the gemset to be used.

Personally, I wouldn't recommend changing the gemset simply because any gems that this application installs will essentially be contained to that one gemset, and will not affect any others (keeps things nice a tidy too).

However if you do wish to change this behaviour, you can either edit the .ruby-gemset file and change the rails3-devise-rspec-cucumber line to global instead, or in your command line, simply do rvm gemset use global.

Note that the latter solution is only temporary, and the moment you reload that directory, rvm will point right back to whatever gemset is indicated in the .ruby-gemset file.

Paul Richter
  • 10,908
  • 10
  • 52
  • 85
  • 1
    thank you for your response! I thought that if I delete `.ruby-version` and `.ruby-gemset`, it would work as usual Rails app (created with `rails new...`). But it doesn't - I still get a new gemset as I run `bundle`. Is is the way it should be? – Alex Smolov Jan 24 '14 at 21:16
  • @AlexSmolov If you deleted those two files, and did not change directories, the gemset and ruby version would remain the same. Think of it like a script that executes immediately when you enter the directory; it basically sets a "value", in a way. So, you would have to delete those files, then do either `cd ..` and then re-enter the project directory, or simply do `cd .`, which should have the same effect. After that, you should see that your rvm gemset reverted to whatever your default gemset is (usually global I guess). – Paul Richter Jan 24 '14 at 22:30
  • @AlexSmolov Oh, also, you keep mentioning that the gemset is created whenever you run `bundle`, but this is not quite the case. Bundle actually doesn't know anything about them; all bundle does is simply dumps gems into your current gem home (which is indicated by the environment variable `$GEM_HOME`), which RVM sets and re-sets whenever you enter a directory with those two files. You can confirm this by manually setting your current RVM gemset to another gemset (before entering your project directory), and then entering the directory and seeing the change. – Paul Richter Jan 24 '14 at 22:34