Sha256: 0d328c104a94b08affcd81821e32ca488edcc8529e7a9dda97e7f6c2459b9759

Contents?: true

Size: 1.29 KB

Versions: 34

Compression:

Stored size: 1.29 KB

Contents

autoload :YAML, 'yaml'
require 'erubi'
require 'erubi/capture_end'
require 'tilt'

module Mrss
  module EgConfigUtils

    DEBIAN_FOR_RUBY = {
      'ruby-2.3' => 'debian92',
      'ruby-2.4' => 'debian92',
      'ruby-2.5' => 'debian10',
      'ruby-2.6' => 'debian10',
      'ruby-2.7' => 'debian10',
      'ruby-3.0' => 'debian10',
    }

    def standard_debian_rubies(rubies, key: nil, &block)
      rubies.flatten!
      text = block.call
      contents = YAML.load(text)
      out = rubies.map do |ruby|
        contents.merge(
          'matrix_name' => "#{contents['matrix_name']} - #{ruby}",
          'matrix_spec' => contents['matrix_spec'].merge(
            'ruby' => ruby,
            key || 'os' => DEBIAN_FOR_RUBY.fetch(ruby),
          ),
        )
      end.to_yaml
      text =~ /\A\n?(\s+)/
      unless text
        raise "Couldn't figure out indentation level"
      end
      indent = ' ' * ($1.length - 2)
      "\n" + out.sub(/\A---.*\n/, indent).gsub("\n", "\n#{indent}")
    end

    def transform_config(template_path, context)
      Tilt.new(template_path, engine_class: Erubi::CaptureEndEngine).render(context)
    end

    def generated_file_warning
      <<-EOT
# GENERATED FILE - DO NOT EDIT.
# Run ./.evergreen/update-evergreen-configs to regenerate this file.

EOT
    end
  end
end

Version data entries

34 entries across 34 versions & 4 rubygems

Version Path
mogno-1.0.0 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-9.0.0 spec/shared/lib/mrss/eg_config_utils.rb
mongo-2.20.0 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-8.0.8 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-8.1.5 spec/shared/lib/mrss/eg_config_utils.rb
bson-5.0.0-java spec/shared/lib/mrss/eg_config_utils.rb
bson-5.0.0 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-8.1.4 spec/shared/lib/mrss/eg_config_utils.rb
mongo-2.19.3 spec/shared/lib/mrss/eg_config_utils.rb
mongo-2.18.3 spec/shared/lib/mrss/eg_config_utils.rb
mongo-2.19.2 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-8.0.7 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-8.1.3 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-8.1.2 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-8.0.6 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-7.5.4 spec/shared/lib/mrss/eg_config_utils.rb
mongo-2.19.1 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-8.1.1 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-8.0.5 spec/shared/lib/mrss/eg_config_utils.rb
mongoid-8.1.0 spec/shared/lib/mrss/eg_config_utils.rb