Module: CemSpecHelper::MappingDataSpec
- Defined in:
- lib/cem_spec_helper/mapping_data_spec.rb
Defined Under Namespace
Classes: Mapping
Constant Summary collapse
- MAP_ROOT =
File.join(Dir.pwd, 'spec', 'fixtures', 'data', 'mapping').freeze
- SYNTHETIC_MAP_ROOT =
File.join(Dir.pwd, 'spec', 'fixtures', 'unit', 'puppet_x', 'puppetlabs', 'cem', 'data_processor', 'mapping').freeze
Instance Method Summary collapse
- #load_mapping_data ⇒ Object
- #load_synthetic_mapping_data ⇒ Object
- #mapping_data ⇒ Object
- #synthetic_mapping_data ⇒ Object
Instance Method Details
#load_mapping_data ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cem_spec_helper/mapping_data_spec.rb', line 10 def load_mapping_data # Get frameworks with maps Dir[File.join(MAP_ROOT, '*')].each_with_object([]) do |fw_dir, arr| framework = File.basename(fw_dir) # Get OS' in frameworks Dir[File.join(fw_dir, '*')].each do |os_dir| os = File.basename(os_dir) # Get major OS versions in OS' Dir[File.join(os_dir, '*')].each do |ver_dir| ver = File.basename(ver_dir) mapping = Mapping.new(framework, os, ver) # Get map names and load map files Dir[File.join(ver_dir, '*.yaml')].each do |map_file| map_type = File.basename(map_file, '.yaml') mapping.add_map(map_type, map_file) end arr << mapping end end end end |
#load_synthetic_mapping_data ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/cem_spec_helper/mapping_data_spec.rb', line 32 def load_synthetic_mapping_data # Get frameworks with maps Dir[File.join(SYNTHETIC_MAP_ROOT, '*')].each_with_object([]) do |fw_dir, arr| framework = File.basename(fw_dir) mapping = Mapping.new(framework, 'Synthetic', '1') # Get map names and load map files Dir[File.join(fw_dir, '*.yaml')].each do |map_file| map_type = File.basename(map_file, '.yaml') mapping.add_map(map_type, map_file) end arr << mapping end end |
#mapping_data ⇒ Object
50 51 52 |
# File 'lib/cem_spec_helper/mapping_data_spec.rb', line 50 def mapping_data @mapping_data ||= load_mapping_data end |
#synthetic_mapping_data ⇒ Object
46 47 48 |
# File 'lib/cem_spec_helper/mapping_data_spec.rb', line 46 def synthetic_mapping_data @synthetic_mapping_data ||= load_synthetic_mapping_data end |