blob: facb5f619bdf648d8073b113c354141b948db92e (
plain)
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
|
# frozen_string_literal: true
module Gitlab
module Ci
module Build
class Releaser
BASE_COMMAND = 'release-cli create'
SINGLE_FLAGS = %i[name description tag_name ref released_at].freeze
ARRAY_FLAGS = %i[milestones].freeze
attr_reader :config
def initialize(config:)
@config = config
end
def script
command = BASE_COMMAND.dup
single_flags.each { |k, v| command.concat(" --#{k.to_s.dasherize} \"#{v}\"") }
array_commands.each { |k, v| v.each { |elem| command.concat(" --#{k.to_s.singularize.dasherize} \"#{elem}\"") } }
[command]
end
private
def single_flags
config.slice(*SINGLE_FLAGS)
end
def array_commands
config.slice(*ARRAY_FLAGS)
end
end
end
end
end
|