Mercurial > repos > other > Puppet
annotate modules/stdlib/lib/puppet/parser/functions/pry.rb @ 275:d9352a684e62
Mass update of modules to remove deprecation warnings
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 26 Jan 2020 11:36:07 +0000 |
parents | c42fb28cff86 |
children | 4a2ee7e3b110 |
rev | line source |
---|---|
272 | 1 # |
2 # pry.rb | |
3 # | |
4 module Puppet::Parser::Functions | |
5 newfunction(:pry, :type => :statement, :doc => <<-DOC | |
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
6 @summary |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
7 This function invokes a pry debugging session in the current scope object. |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
8 This is useful for debugging manifest code at specific points during a compilation. |
272 | 9 |
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
10 @return |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
11 debugging information |
272 | 12 |
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
13 @example **Usage** |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
14 |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
15 `pry()` |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
16 |
272 | 17 DOC |
18 ) do |arguments| | |
19 begin | |
20 require 'pry' | |
21 rescue LoadError | |
22 raise(Puppet::Error, "pry(): Requires the 'pry' rubygem to use, but it was not found") | |
23 end | |
24 # | |
25 ## Run `catalog` to see the contents currently compiling catalog | |
26 ## Run `cd catalog` and `ls` to see catalog methods and instance variables | |
27 ## Run `@resource_table` to see the current catalog resource table | |
28 # | |
29 if $stdout.isatty | |
30 binding.pry # rubocop:disable Lint/Debugger | |
31 else | |
32 Puppet.warning 'pry(): cowardly refusing to start the debugger on a daemonized master' | |
33 end | |
34 end | |
35 end |