Class: PuppetDebugger::InputResponders::Resources
Constant Summary
collapse
- COMMAND_WORDS =
%w(resources)
- SUMMARY =
'List all the resources current in the catalog.'
- COMMAND_GROUP =
:scope
Instance Attribute Summary
#debugger
Instance Method Summary
collapse
command_completion, command_group, command_words, details, execute, #modules_paths, #puppet_debugger_lib_dir, summary
Instance Method Details
#find_resources(resources, filter = []) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/plugins/puppet-debugger/input_responders/resources.rb', line 19
def find_resources(resources, filter = [])
return resources if filter.nil? || filter.empty?
filter_string = filter.join(' ').downcase
resources.find_all do |resource|
resource.name.to_s.downcase.include?(filter_string) || resource.type.to_s.downcase.include?(filter_string)
end
end
|
#run(args = []) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/plugins/puppet-debugger/input_responders/resources.rb', line 9
def run(args = [])
filter = args
resources = find_resources(debugger.catalog.resources, filter)
modified = resources.map do |res|
res.to_s.gsub(/\[/, "['").gsub(/\]/, "']") end
output = "Resources not shown in any specific order\n".warning
output += modified.ai
end
|