Sha256: 05b8b1dc01b99edab0c6cf7b01bc8365148225039ce7d6237f25b3ffe8ea2171

Contents?: true

Size: 916 Bytes

Versions: 4

Compression:

Stored size: 916 Bytes

Contents

require_relative '../../repositories/presets'

Inferno::Application.register_provider(:presets) do
  prepare do
    target_container.start :suites

    presets_repo = Inferno::Repositories::Presets.new

    test_kit_gems =
      Bundler
        .definition
        .specs
        .select { |spec| spec.metadata.fetch('inferno_test_kit', 'false').casecmp? 'true' }

    files_to_load = Dir.glob(['config/presets/*.json', 'config/presets/*.json.erb'])
    files_to_load +=
      test_kit_gems.flat_map do |gem|
        [
          Dir.glob([File.join(gem.full_gem_path, 'config', 'presets', '*.json')]),
          Dir.glob([File.join(gem.full_gem_path, 'config', 'presets', '*.json.erb')])
        ].flatten
      end

    files_to_load.compact!
    files_to_load.uniq!
    files_to_load.map! { |path| File.realpath(path) }

    files_to_load.each do |path|
      presets_repo.insert_from_file(path)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inferno_core-0.6.1 lib/inferno/config/boot/presets.rb
inferno_core-0.6.0 lib/inferno/config/boot/presets.rb
inferno_core-0.5.4 lib/inferno/config/boot/presets.rb
inferno_core-0.5.3 lib/inferno/config/boot/presets.rb