Use Pry in gems without modifying the Gemfile or using `require`

后端 未结 2 814
一向
一向 2021-02-13 12:40

I am trying to debug a gem that\'s used by a Rails app.

I cloned the Gem locally to go prying around (and also allows me to do nice things such as git bisect

2条回答
  •  心在旅途
    2021-02-13 13:22

    if you want to use and debug a gem in your rails app, then it should be in the development and test group of the Gemfile in your app.

    you can use tools like pry-debugger https://github.com/nixme/pry-debugger to set breakpoints in your pry session break SomeClass#run.

    i think it's valid to add pry to every project that i fork to fix a bug or contribute stuff. just don't put it in the .gemspec files.

    if you are pushing binding.pry changes to your repo, you should add commit hooks like Jim pointed out. i don't think that this is a pry related issue, it's dependent on how much care you take when reviewing your diff before pushing it out.

提交回复
热议问题