Class: AbideDevUtils::Sce::BenchmarkLoader::PupMod

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/sce/benchmark_loader.rb

Overview

Loads benchmark data for a Puppet module

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(module_dir = Dir.pwd, **opts) ⇒ PupMod

Returns a new instance of PupMod.



24
25
26
27
28
29
30
# File 'lib/abide_dev_utils/sce/benchmark_loader.rb', line 24

def initialize(module_dir = Dir.pwd, **opts)
  @pupmod = AbideDevUtils::Ppt::PuppetModule.new(module_dir)
  @load_errors = []
  @load_warnings = []
  @ignore_all_errors = opts.fetch(:ignore_all_errors, false)
  @ignore_framework_mismatch = opts.fetch(:ignore_framework_mismatch, false)
end

Instance Attribute Details

#ignore_all_errorsObject (readonly)

Returns the value of attribute ignore_all_errors.



22
23
24
# File 'lib/abide_dev_utils/sce/benchmark_loader.rb', line 22

def ignore_all_errors
  @ignore_all_errors
end

#ignore_framework_mismatchObject (readonly)

Returns the value of attribute ignore_framework_mismatch.



22
23
24
# File 'lib/abide_dev_utils/sce/benchmark_loader.rb', line 22

def ignore_framework_mismatch
  @ignore_framework_mismatch
end

#load_errorsObject (readonly)

Returns the value of attribute load_errors.



22
23
24
# File 'lib/abide_dev_utils/sce/benchmark_loader.rb', line 22

def load_errors
  @load_errors
end

#load_warningsObject (readonly)

Returns the value of attribute load_warnings.



22
23
24
# File 'lib/abide_dev_utils/sce/benchmark_loader.rb', line 22

def load_warnings
  @load_warnings
end

#pupmodObject (readonly)

Returns the value of attribute pupmod.



22
23
24
# File 'lib/abide_dev_utils/sce/benchmark_loader.rb', line 22

def pupmod
  @pupmod
end

Instance Method Details

#loadArray<AbideDevUtils::Sce::Benchmark>

Load the benchmark from the Puppet module

Returns:

Raises:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/abide_dev_utils/sce/benchmark_loader.rb', line 35

def load
  clear_load_errors
  clear_load_warnings
  pupmod.supported_os.each_with_object([]) do |supp_os, ary|
    osname, majver = supp_os.split('::')
    if majver.is_a?(Array)
      majver.sort.each do |v|
        frameworks.each do |fw|
          ary << new_benchmark(osname, v, fw)
        rescue StandardError => e
          handle_load_error(e, fw, osname, v, pupmod.name(strip_namespace: true))
        end
      end
    else
      frameworks.each do |fw|
        ary << new_benchmark(osname, majver, fw)
      rescue StandardError => e
        handle_load_error(e, fw, osname, majver, pupmod.name(strip_namespace: true))
      end
    end
  end
end