RubyMine 6.0.2 with a stone "debugger" without changing Gemfile.lock?

I use RubyMine (v6.0.2), but my teammates are not, so they need a "debugger" in the gemfile. I can conditionally not require a Gemfile when starting RubyMine (so that the Gemfile can be shared and identical), but since the "debugger stone" is not included, the Gemfile.lock file changes depending on whether the last project was launched with RubyMine or not. This creates a lot of noise with redundant changes to Gemfile.lock.

I tried using the debugger-xml gem; this does not solve the problem.

So - how can I run RubyMine 6.0.2 using the "debugger" in the Gemfile without changing Gemfile.lock?

+4
source share
3 answers

I am working on this issue from across the table. I use the debugger stone, but I have commands that use RubyMine.

We discussed several potential solutions, but all of them are related to conditional checks in the Gemfile, which will lead to a change in the Gemfile.lock file.

I googled around for a better solution and found this SO post: How to use gems not in the Gemfile when working with a supplier?

Combining several answers, I came up with this solution:

  • Remove the pearl of the debugger from the Gemfile.
  • Create Gemfile.local with the content below.
  • Add Gemfile.local to the .gitignore file if using git.
  • Create a function and shell alias.
  • Start rails with $ be rails s

How it works!

Bundler Gemfile, , BUNDLE_GEMFILE. Bundler / , BUNDLE_GEMFILE.

__bundle_exec_custom , Gemfile.local CWD. , BUNDLE_GEMFILE. Gemfile .

, , .

Gemfile.local:

source "https://rubygems.org"

gemfile = File.join(File.dirname(__FILE__), 'Gemfile')
if File.readable?(gemfile)
  puts "Loading #{gemfile}..." if $DEBUG
  instance_eval(File.read(gemfile))
end

gem 'debugger'

:

__bundle_exec_custom () {
  if [ -f Gemfile.local ]
  then
    BUNDLE_GEMFILE="Gemfile.local" bundle exec $@
  else
    bundle exec $@
  fi
}

# Rails aliases
alias be='__bundle_exec_custom'
+6

, . -, RubyMine debugger, Rails, gem.

, gem Gemfile ( Gemfile.lock) , require RubyMine.

gem 'debugger', {group: [:test, :development]}.
    merge(ENV['RM_INFO'] ? {require: false} : {})

JetBrains, .

RM_INFO, RubyMine. , , required , , Gemfile.lock .

+3

, , , Rails 4...

Gemfile :

group :pry do
  gem 'pry', '>= 0.10.0'
  gem 'pry-debugger', '>= 0.2.3'
  gem 'pry-highlight', '>= 0.0.1'
end

config/application.rb - :

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

:

Bundler.require(:pry) unless ENV['RM_INFO'] || Rails.env.production?

unless , , RubyMine RM_INFO, , , .

- RubyMine , IDE.

: Heroku, :pry, ​​ :

 $ heroku config:set BUNDLE_WITHOUT="development:test:pry"
+2

All Articles