rubychef-infraprychefdk

How to get full pry debugging session working within chefdk


I am unable to get the pry-stack_explorer and pry-byebug gems to work while trying to debug inspec from a bundle exec command.

When I open pry by itself I have the show-stack command available to me.

When I place a require 'pry' and binding.pry command in inspec and run it with bundle exec inspec exec some_file.rb, it does stop me at that point with a pry session. However, when I try any of the commands from the byebug or stack_explorer gems, I get an error:

[2] pry(#<#<Class:0x00000003ec1910>>)> show-stack NameError: undefined local variable or method `show' for File :#<Class:0x00000003ec1910> from (pry):1:in `initialize

I am running within the chefdk embedded version of ruby. My pry-related gems are:

ubuntu_machine:~/code/tools/inspec$ chef gem list pry-*

*** LOCAL GEMS ***

pry (0.10.3)
pry-byebug (3.3.0)
pry-doc (0.8.0)
pry-remote (0.1.8)
pry-stack_explorer (0.4.9.2)

Why aren't these commands available from within the session?


Solution

  • Local gems installed on this machine have [in general] nothing to do with your bundle configuration. Please make sure you have pry-stack_explorer and pry-byebug listed in your .gemspec / Gemfile, then run bundle and retry.