Better Debugging With The Ruby Debug Gem Discussion
Nice video, Collin!
One thing I might add is how to get into a debug console when you're running the default bin/dev script. I spin up another console and run "bundle exec rdbg -a" to attach to the debug process. Is there any easier way to get all the goodness of the debug gem in way that integrates into the bin/dev foreman setup?
That's a great tip!
VS Code also has an extension you can use https://github.com/ruby/vscode-rdbg
The other option is to replace foreman with overmind which allows you to do the same thing by opening another terminal and running overmind connect web
to connect to the process. This will work with binding.irb, pry & debug or anything else.
Here's my bin/dev
#!/usr/bin/env sh
PORT="${PORT:-3000}"
export PORT
if command -v overmind > /dev/null 2>&1; then
exec overmind start -f Procfile.dev "$@"
else
exec foreman start -f Procfile.dev "$@"
fi
Awesome...thanks, Chris! And yah, I feel like I'm swimming upstream by running Sublime instead of VSCode, but old dogs and new tricks, eh?
Your bin/dev script looks well-configured to handle either Foreman or Overmind depending on availability.
hey mate just type in binding.break
- you don't need to stuff around with getting into the IRB and THEN debugging from there.
Hey there, I appreciate the comment. I do address this in the video though in addition to being able to use debugger
instead of / in addition to binding.break
.