Module: PuppetDebugger::Support::Loader
- Included in:
- PuppetDebugger::Support
- Defined in:
- lib/puppet-debugger/support/loader.rb
Instance Method Summary collapse
-
#all_data_types ⇒ Array[String]
-
combined list of core data types and environment data types.
-
-
#core_datatypes ⇒ Array[String]
-
a list of core data types.
-
- #create_loader(environment) ⇒ Object
-
#environment_data_types ⇒ Array[String]
-
returns a list of all the custom data types found in all the modules in the environment.
-
- #loaders ⇒ Object
Instance Method Details
#all_data_types ⇒ Array[String]
Returns - combined list of core data types and environment data types.
27 28 29 30 31 32 33 |
# File 'lib/puppet-debugger/support/loader.rb', line 27 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 ⇒ Array[String]
Returns - a list of core data types.
20 21 22 23 24 |
# File 'lib/puppet-debugger/support/loader.rb', line 20 def core_datatypes loaders.implementation_registry .instance_variable_get(:'@implementations_per_type_name') .keys.find_all { |t| t !~ /::/ } end |
#create_loader(environment) ⇒ Object
5 6 7 |
# File 'lib/puppet-debugger/support/loader.rb', line 5 def create_loader(environment) Puppet::Pops::Loaders.new(environment) end |
#environment_data_types ⇒ Array[String]
Returns - returns a list of all the custom data types found in all the modules in the environment.
10 11 12 13 14 15 16 17 |
# File 'lib/puppet-debugger/support/loader.rb', line 10 def environment_data_types files = Dir.glob(puppet_environment.modulepath.map { |m| File.join(m, '**', 'types', '**', '*.pp') }) 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 |
#loaders ⇒ Object
35 36 37 |
# File 'lib/puppet-debugger/support/loader.rb', line 35 def loaders @loaders ||= create_loader(puppet_environment) end |