cd ~/foreman
echo "gem 'byebug'" >> bundler.d/katello.local.rb
bundle install
- create and add the following to
config/initializers/byebug.rb
require 'byebug/core'
if Rails.env.development?
Byebug.start_server 'localhost', ENV.fetch("BYEBUG_SERVER_PORT", 1048).to_i
end
echo 'config/initializers/byebug.rb' >> .git/info/exclude
echo '.byebug_history' >> .git/info/exclude
- add
byebug in code where you need a debugger
- with server running, in another terminal, you can run
bundle exec byebug -R localhost:1048 to connect to byebug
- when your endpoint is hit, you will see the code show up in the connected byebug process.
- use
help for commands
- quick tip:
list = is the equivalent of whereami in pry
This doesn't work with
foreman start, only withforeman/script/foreman-start-devor manually starting the rails server