X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fpry.rb;fp=3rdparty%2Fmodules%2Fstdlib%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fpry.rb;h=c18ef7ef80ddb8a78b5e8d0f7f52a409c3dc1835;hb=6963202b4b62c2816655ac9532521b018fdf83bd;hp=0000000000000000000000000000000000000000;hpb=a69999e580f8b3abd12446c2d6ad59e517651813;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/lib/puppet/parser/functions/pry.rb b/3rdparty/modules/stdlib/lib/puppet/parser/functions/pry.rb new file mode 100644 index 000000000..c18ef7ef8 --- /dev/null +++ b/3rdparty/modules/stdlib/lib/puppet/parser/functions/pry.rb @@ -0,0 +1,30 @@ +# +# pry.rb +# + +module Puppet::Parser::Functions + newfunction(:pry, :type => :statement, :doc => <<-EOS +This function invokes a pry debugging session in the current scope object. This is useful for debugging manifest code at specific points during a compilation. + +*Examples:* + + pry() + EOS + ) do |arguments| + begin + require 'pry' + rescue LoadError + raise(Puppet::Error, "pry(): Requires the 'pry' rubygem to use, but it was not found") + end + # + ## Run `catalog` to see the contents currently compiling catalog + ## Run `cd catalog` and `ls` to see catalog methods and instance variables + ## Run `@resource_table` to see the current catalog resource table + # + if $stdout.isatty + binding.pry # rubocop:disable Lint/Debugger + else + Puppet.warning 'pry(): cowardly refusing to start the debugger on a daemonized master' + end + end +end