I am trying to use RubyMine as much as possible and RubyMine sometimes to ask for gems which i'll not utilize for anything on myself (RubyMine does).
Is it possible to detect in Gemfile, that i am bundling from RubyMine? or in general: Is it possible to detect the tool i am bundling from (Terminal, iTerm, RubyMine, TeamCity)?
I know there is specificable platform of ruby as condition for gem. What i am looking for to put into my Gemfile is something like this:
tool :rubymine do
gem 'minitest-reporters'
gem 'ruby-debug'
end
In result when i'll run bundling from FOR EXAMPLE RubyMine, i'll get minitest-reporters and ruby-debug installed, BUT my colleague who does bundle from Terminal will NOT get these gems installed.
OK, here I found some ways to tell, that you are running from inside of RubyMine
(puts this into your Gemfile to test it)
puts [
ORIGINAL_ENV['OLDPWD'],
ORIGINAL_ENV['RM_INFO'],
ORIGINAL_ENV['RUBYLIB'],
ORIGINAL_ENV['RUBYMINE_TESTUNIT_REPORTER'],
ORIGINAL_ENV['TEAMCITY_RAKE_RUNNER_MODE'],
ORIGINAL_ENV['TEAMCITY_RAKE_RUNNER_USED_FRAMEWORKS'],
ORIGINAL_ENV['XPC_SERVICE_NAME']
]
So for example this way I am able to install gems for RubyMine, only when it is really needed
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
if ORIGINAL_ENV && ORIGINAL_ENV['TEAMCITY_RAKE_RUNNER_MODE']
gem 'debase'
end
end
Only bad thing is, that this will be changing Gemfile.lock