From fccd1f2c5c5c618a578f7d03f5ba79390fad3f88 Mon Sep 17 00:00:00 2001 From: Vincent Truong Date: Mon, 5 Feb 2024 12:04:04 -0600 Subject: [PATCH 1/2] Add readme about debugging --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index a43a64dcf3..b7a6cc6843 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,34 @@ Users that are frequent contributors and are involved in discussion (join the sl ### Stay Scoped Try to keep your PRs limited to one particular issue, and don't make changes that are out of scope for that issue. If you notice something that needs attention but is out of scope, please [create a new issue](https://github.com/rubyforgood/human-essentials/issues/new). +## Debugging +To debug, drop a ``binding.remote_pry`` into the line where you want execution to pause at. Then run ``pry-remote`` in the terminal to connect to it. +https://github.com/Mon-Ouie/pry-remote +``` +class Foo + +def initialize(x, y) + binding.remote_pry + end +end +Foo.new 10, 20 +``` + +``` +$ pry-remote +From: example.rb @ line 7 in Foo#initialize: + 2: + 3: require 'pry-remote' + 4: + 5: class Foo + 6: def initialize(x, y) + => 7: binding.remote_pry + 8: end + 9: end + 10: + 11: Foo.new 10, 20 +``` ## Testing 🧪 ### Writing Tests/Specs - Run all the tests with `bundle exec rspec` From 19ec1c3a438f8fd75bee1b3470992d710b94cc8d Mon Sep 17 00:00:00 2001 From: Vincent Truong Date: Wed, 7 Feb 2024 10:54:36 -0600 Subject: [PATCH 2/2] Mention regular pry; remove long example --- README.md | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index b7a6cc6843..19dc1c3636 100644 --- a/README.md +++ b/README.md @@ -167,33 +167,12 @@ Users that are frequent contributors and are involved in discussion (join the sl Try to keep your PRs limited to one particular issue, and don't make changes that are out of scope for that issue. If you notice something that needs attention but is out of scope, please [create a new issue](https://github.com/rubyforgood/human-essentials/issues/new). ## Debugging -To debug, drop a ``binding.remote_pry`` into the line where you want execution to pause at. Then run ``pry-remote`` in the terminal to connect to it. +If starting server directly, via `rail s` or `rail console`, or built-in debugger in RubyMine, then you can use `binding.pry` to debug. Drop the pry where you want the execution to pause. + +If starting via Procfile with `bin/start`, then drop a ``binding.remote_pry`` into the line where you want execution to pause at. Then run ``pry-remote`` in the terminal to connect to it. https://github.com/Mon-Ouie/pry-remote -``` -class Foo -def initialize(x, y) - binding.remote_pry - end -end -Foo.new 10, 20 -``` - -``` -$ pry-remote -From: example.rb @ line 7 in Foo#initialize: - 2: - 3: require 'pry-remote' - 4: - 5: class Foo - 6: def initialize(x, y) - => 7: binding.remote_pry - 8: end - 9: end - 10: - 11: Foo.new 10, 20 -``` ## Testing 🧪 ### Writing Tests/Specs - Run all the tests with `bundle exec rspec`