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
}
alias be='__bundle_exec_custom'