-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild_image_list.rb
More file actions
46 lines (38 loc) · 1.24 KB
/
Copy pathbuild_image_list.rb
File metadata and controls
46 lines (38 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# frozen_string_literal: true
require 'yaml'
require_relative './image_item'
class BuildImageList
def self.call(yaml_file:)
new(yaml_file).call
end
def call
ret = {}
builds.map do |ruby_version, per_version|
per_version.map do |base_os, per_base_os|
per_base_os.map do |qt_key, per_qt|
params = {
base_os: base_os,
image_version: image_version,
qt: qt_key.to_s,
ruby_version: ruby_version,
tags: per_qt['tags'],
latest: per_qt['actual_latest'] || false
}
item = ImageItem.new params
ret[item.build_tag_name] = item.freeze
end # per_base_os.map
end # per_version.map
end # builds.map
ret
end
protected
def initialize(yaml_file)
image_config_data = YAML.load_file(yaml_file)
@builds = image_config_data['data']['builds']
@hanami_version = image_config_data['data']['metadata']['hanami_version']
@hanami_model_version =image_config_data['data']['metadata']['hanami_model_version']
@image_version = image_config_data['data']['metadata']['image_version']
end
private
attr_reader :builds, :hanami_model_version, :hanami_version, :image_version
end # class BuildImageList