matrixeval-ruby 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,59 +0,0 @@
1
- require_relative "./container"
2
-
3
- module Matrixeval
4
- module Ruby
5
- class Variant
6
- class << self
7
- def default(key, vector)
8
- self.new({"key" => key}, vector)
9
- end
10
- end
11
-
12
- attr_reader :key, :env, :vector, :default, :container, :mounts
13
-
14
- def initialize(config = {}, vector)
15
- raise Error.new("Variant#key is missing") if config["key"].nil?
16
-
17
- @vector = vector
18
- @key = config["key"].to_s
19
- @container = Container.new(config["container"])
20
- @env = config["env"] || {}
21
- @default = config["default"] || false
22
- @mounts = config["mounts"] || []
23
- end
24
-
25
- def name
26
- "#{vector.key}: #{key}"
27
- end
28
-
29
- def bundle_volume_name
30
- "bundle_#{container.image.gsub(/[^A-Za-z0-9]/,'_')}"
31
- end
32
-
33
- def id
34
- "#{vector.id}_#{key.to_s.gsub(/[^A-Za-z0-9]/,'_')}"
35
- end
36
-
37
- def docker_compose_service_name
38
- id
39
- end
40
-
41
- def pathname
42
- id
43
- end
44
-
45
- def default?
46
- default
47
- end
48
-
49
- def match_command_options?(options)
50
- options[vector.key] == key.to_s
51
- end
52
-
53
- def ==(variant)
54
- vector.key == variant.vector.key &&
55
- key == variant.key
56
- end
57
- end
58
- end
59
- end
@@ -1,39 +0,0 @@
1
- require_relative "./variant"
2
-
3
- module Matrixeval
4
- module Ruby
5
- class Vector
6
- attr_reader :key, :variants
7
-
8
- def initialize(key, config)
9
- @key = key.to_s
10
- @variants = (config["variants"] || []).map do |variant_config|
11
- config = if variant_config.is_a?(Hash)
12
- variant_config
13
- else
14
- { "key" => variant_config.to_s }
15
- end
16
-
17
- Variant.new(config, self)
18
- end
19
- end
20
-
21
- def main?
22
- key == "ruby"
23
- end
24
-
25
- def id
26
- "#{key.to_s.gsub(/[^A-Za-z0-9]/,'_')}"
27
- end
28
-
29
- def default_variant
30
- variant = variants.find(&:default?)
31
- if variant.nil?
32
- raise Error.new("Please set a default variant for matrix #{key}")
33
- end
34
-
35
- variant
36
- end
37
- end
38
- end
39
- end