ruby-on-railsrvmbundlergemset

Using RVM Gemsets & Bundler & RubyMine


I use RVM to manage Ruby versions.
In my project I use Bundler to manage gems for the project.

RVM also have gemsets.
Gem in gemset don't have a connection with Bundler's gem. ← Is this correct?
I came to this conclusion because gem files stored in different locations:
RVM gemset: ~/.rvm/gems/ruby-2.0.0-p247@myApp
Bundler: [my_app_dir]/vendor/bundle/gems
So app uses Bundler gems, not RVM gemset gems.

But when I add gem to my Gemfile, RubyMine IDE shows me warning, that this gem is not in RVM gemset. So I add this gem to RVM gemset also (just to get rid of this warning).

So the questions are:

  1. Is there any good reason to add gems in both places (RVM Gemset and Gemfile)?
  2. If no, then why RubyMine warning me about this?

Solution

    1. Is there any good reason to add gems in both places (RVM Gemset and Gemfile)?

    The gemset is incidental, the Gemfile is absolutely the place to declare your dependencies. Where you store those gems is up to you.

    It sounds like Bundler is configured to store them in a project-local path, but you're expecting them to be in a gemset. Bundler got that configuration by running bundle install --path vendor/bundle/gems at some point. It stores that configuration in its project configuration file at project_dir/.bundle/config:

    BUNDLE_PATH: vendor/bundle/gems
    

    I'm unfamiliar with Rubymine, but if you run the Rails server using Bundler (i.e. bundle exec rails server) you can ignore that warning. Bundler will correctly load the gems listed in the Gemfile.

    If you want to use a gemset instead of the Bundler cache, you can just remove that line from the Bundler configuration file and reinstall your gems with bundle install.

    1. If no, then why RubyMine warning me about this?

    My guess is that Rubymine is not reading the Bundler project configuration (in project_path/.bundle/config) and does not understand where the gems are installed.