class PuppetDebugger::InputResponders::Datatypes
Constants
- COMMAND_GROUP
- COMMAND_WORDS
- SUMMARY
Public Instance Methods
all_data_types()
click to toggle source
@return [Array] - combined list of core data types and environment data types
# File lib/plugins/puppet-debugger/input_responders/datatypes.rb, line 49 def all_data_types unless loaders.respond_to?(:implementation_registry) Puppet.info("Data Types Not Available in Puppet: #{Puppet.version}") return [] end core_datatypes + environment_data_types end
core_datatypes()
click to toggle source
loaders.instance_variable_get(:@loaders_by_name) [:func_4x, :func_4xpp, :func_3x, :datatype, :type_pp, :resource_type_pp, :plan, :task] @return [Array] - a list of core data types
# File lib/plugins/puppet-debugger/input_responders/datatypes.rb, line 42 def core_datatypes loaders.implementation_registry.instance_variable_get(:@parent) .instance_variable_get(:@implementations_per_type_name) .keys.find_all { |t| t !~ /::/ } end
environment_data_types()
click to toggle source
@return [Array] - returns a list of all the custom data types found in all the modules in the environment
# File lib/plugins/puppet-debugger/input_responders/datatypes.rb, line 27 def environment_data_types globs = debugger.puppet_environment.instance_variable_get(:@modulepath).map { |m| File.join(m, '**', 'types', '**', '*.pp') } files = globs.map { |g| Dir.glob(g) }.flatten files.map do |f| m = File.read(f).match(/type\s([a-z\d\:_]+)/i) next if m =~ /type|alias/ # can't figure out the best way to filter type and alias out m[1] if m && m[1] =~ /::/ end.uniq.compact end
find_datatypes(datatypes, filter = [])
click to toggle source
# File lib/plugins/puppet-debugger/input_responders/datatypes.rb, line 17 def find_datatypes(datatypes, filter = []) return datatypes if filter.nil? || filter.empty? filter_string = filter.join(' ').downcase datatypes.find_all do |datatype| datatype.downcase.include?(filter_string) end end
run(args = [])
click to toggle source
# File lib/plugins/puppet-debugger/input_responders/datatypes.rb, line 11 def run(args = []) filter = args datatypes = find_datatypes(all_data_types.sort, filter) datatypes.ai end