class Matrixeval::Context
Attributes
main_variant[R]
rest_variants[R]
Public Class Methods
all()
click to toggle source
# File lib/matrixeval/context.rb, line 13 def all Config.variant_combinations.map do |variants| Context.new( main_variant: variants.find { |v| v.vector.main? }, rest_variants: variants.reject { |v| v.vector.main? } ) end.select do |context| Config.exclusions.none? do |exclusion| context.match_exclusion?(exclusion) end end end
find_by_command_options!(options)
click to toggle source
# File lib/matrixeval/context.rb, line 9 def find_by_command_options!(options) FindByCommandOptions.call(options) end
new(main_variant:, rest_variants:)
click to toggle source
# File lib/matrixeval/context.rb, line 30 def initialize(main_variant:, rest_variants:) @main_variant = main_variant @rest_variants = (rest_variants || []).sort do |v1, v2| v1.id <=> v2.id end end
Public Instance Methods
docker_compose_extend()
click to toggle source
# File lib/matrixeval/context.rb, line 75 def docker_compose_extend BuildDockerComposeExtend.call(self) end
docker_compose_file_path()
click to toggle source
# File lib/matrixeval/context.rb, line 54 def docker_compose_file_path Matrixeval.working_dir.join(".matrixeval/docker-compose/#{id}.yml") end
docker_compose_service_name()
click to toggle source
# File lib/matrixeval/context.rb, line 50 def docker_compose_service_name main_variant.id end
env()
click to toggle source
# File lib/matrixeval/context.rb, line 45 def env rest_variants.map(&:env).reduce({}, &:merge) .merge(main_variant.env) end
id()
click to toggle source
# File lib/matrixeval/context.rb, line 41 def id [[main_variant.id] + rest_variants.map(&:id)].join("_") end
match_exclusion?(exclusion)
click to toggle source
# File lib/matrixeval/context.rb, line 62 def match_exclusion?(exclusion) return false if exclusion.empty? variants.all? do |variant| vector_key = variant.vector.key if exclusion.key?(vector_key) exclusion[vector_key].to_s == variant.key else true end end end
name()
click to toggle source
# File lib/matrixeval/context.rb, line 37 def name variants.map(&:name).join(", ") end
variants()
click to toggle source
# File lib/matrixeval/context.rb, line 58 def variants [main_variant] + rest_variants end