I'm in kind of a pickle.
I installed Ruby with scoop on Windows 10. Then I chose ruby executable in RubyMine - scoop/apps/ruby/current/bin/ruby.exe
For some reason, RubyMine gem environment is bigger than my terminal gem env.
And location for installed gems differs.
In terminal it's C:/Users/MY_USER/scoop/persist/ruby/gems
And in RubyMine it's C:/Users/MY_USER/scoop/apps/ruby/3.2.2-1/lib/ruby/gems/3.2.0
The "scoop/apps/ruby/current/bin/ruby.exe" is symlink to "scoop/apps/ruby/3.2.2-1/bin/ruby.exe"
I must say that first time RubyMine automatically chose DIRECT Ruby path (not the "current" symlink). I specified forcefully path to "current" ruby, so my RubyMine env and terminal env will be the same.
It worked out flawlessly. Until I restarted my PC.
Now, RubyMine uses ruby.exe in "current" directory, but gem path differs from that in the terminal.
Where does RubyMine stores it's custom .gemrc file, where it specifies path?
I can't understand how to forcefully change gems path. If I will try to create interpreter with custom env variables, I can miss some important ones that may differ and break everything.
Also, this is the code RubyMine executes for launching IRB console. Which looks way too broken to me:
C:/Users/MY_USER/scoop/apps/ruby/current/bin/ruby.exe -x C:\www\work\MY_PROJECT\bin\bundle exec C:\Users\MY_USER\scoop\apps\ruby\current\bin\ruby.exe -r C:\Users\MY_USER\AppData\Local\Programs\RubyMine\plugins\ruby\rb\consoles\irb_config.rb C:/Users/MY_USER/scoop/apps/ruby/3.2.2-1/bin/irb
Terminal IRB on the other hand is at: C:\Users\MY_USER\scoop\apps\ruby\current\bin\irb.bat
Unfortunately, I did not find how RubyMine "discovers" global GEM PATH that is not in any of gemrc files and how to fix this in global terms.
BUT workaround is to use local config for bundler.
Just add local config via
bundle config set --local path "PATH_TO_GEMS_FOR_YOUR_PROJECTS"
RubyMine will eat this up and use this path for bundler.
In the end you will have terminal bundler installing gems into the same location as RubyMine bundler.