Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add debugger (binding.pry) in dependecy gem?

I would like to add binding.pry to check some things on fly in kaminari gem which is dependency of activeadmin gem. I use also kaminari as completely separate gem.

activeadmin (1.0.0.pre5)
      arbre (~> 1.0, >= 1.0.2)
      bourbon
      coffee-rails
      formtastic (~> 3.1)
      formtastic_i18n
      inherited_resources (~> 1.6)
      jquery-rails
      jquery-ui-rails
      kaminari (~> 0.16.1)
      railties (>= 3.2, < 5.1)
      ransack (~> 1.3)
      sass-rails
      sprockets (< 4.1)

I've already tried something like below in Gemfile:

gem 'kaminari', git: 'https://github.com/hubertjakubiak/kaminari.git', branch: 'v0.16.3'
like image 569
Hubert Jakubiak Avatar asked Dec 14 '22 15:12

Hubert Jakubiak


1 Answers

No need for forking here. You can edit locally installed gems. Just do this:

bundle open kaminari

It will open the corresponding version of kaminari in your $EDITOR. There you can insert debug printing, binding.pry or whatever you like. Don't forget to restart the app/server.

And don't forget to clean up when you're done. Either by manually undoing your changes or running

bundle pristine kaminari
like image 111
Sergio Tulentsev Avatar answered Dec 27 '22 01:12

Sergio Tulentsev