How do I get ruby debugger to work in sinatra with shotgun?

1k Views Asked by At

Is there a way of running shotgun to allow for ruby debugger statements to run? the -d flag seems to be just for debugging output.

1

There are 1 best solutions below

0
On

In order to find the best way to debug sinatra app, I created a repo at github. The most useful part is step into method debug, which looks like below.

enter image description here

Here is the repo: https://github.com/hlee/sinatra_debugger_example

I also confirmed this example support shotgun as well. try as below

cd sinatra_debugger_example
bundle
shotgun config.ru

and visit: http://localhost:9393, you will be able to use pry debug and stepping.

About debugger & pry:

  1. the example project support both debugger and pry.
  2. I personally perfer pry better.

I hope it helps you.