Bundler with multiple projects (content roots)

I have a project that is composed of multiple gems and multiple rails applications (service oriented architecture).  I'm trying to come up with a good way to work with them within rubymine using a project composed of multiple content roots.  Previously, I would have a single project per frame, and would cycle between them as needed, but this can be a PITA, so am looking into using a single project with multiple content roots to work within a single rubymine frame.

First, I created am empty directory, meta_project, and created a new rubymine project for that directory.
Then in Preferences -> Project Structure, I added a content root for each sub-project, pointing to that projects directory, then marked the "Test Sources" directory for each sub project, as well as adding the git mapping in Preferences ->Version Control

meta_project (~/workspace/meta_project)
     -----gem_project_1 (~/workspace/gem_project_1)

     -----gem_project_2 (~/workspace/gem_project_2)

     -----rails_project_1 (~/workspace/rails_project_1)

     -----rails_project_2 (~/workspace/rails_project_2)

These sub projects all have a ".idea" directory as I have, and continue to, open them individually.  However, I don't think this affects the meta_project, but let me know if I'm wrong.

Most things seem to work well, I like the combined VCS operations cross project, especially the combined Changes view.

My first question, am I doing this correctly, or is there a better way?

Secondly, Bundler integration seems to be broken with this setup.  If I run Tools -> Bundler -> Install, it does so for one of my sub projects, but not all.  As a result, the indexing triggered by bundling from rubymine doesn't run for all projects, and the "External Libraries" tree in Project view doesn't reflect all the libraries across all the sub projects (just the one bundler ran for).  Likewise for other "index" dependent operations, like code completion, etc.  Also, it would be nice to have a separate "External Libraries" subtree for each subproject rather than (or in addition to) the single global one.

Another nice-to-have would be some Gemfile magic so that rubymine could automatically detect that gems used by sub_projects are present in meta_project, and point to them rather than fetching the released one.  I can do it manually with path => "../sub_project" in the Gemfiles, but would be cool not to have to risk checking them in that way.

Any guidance or workarounds appreciated, thanks,


p.s. Using RubyMine momiji 130-1770

Comment actions Permalink

Hi Matt,

for your case I'd suggest to try our multi-project support.
To do this you just need to have several project (one for each gem or rails app), open your main (meta) project
and open all others in the same window specifing that they should be added to the main project.


Comment actions Permalink

Cool, thanks, that did the trick.  Here I was thinking that the multi-project support you keep talking about was just the use of content roots, but its actually a separate thing.  Note that if you use "Open Recent" instead of "Open...", it doesn't prompt you to add to the project to current, and since thats how I usually open my existing projects, I never noticed the multi-project option.



Please sign in to leave a comment.