Class: Gitlab::Ci::Build::Releaser

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/build/releaser.rb

Constant Summary collapse

BASE_COMMAND =
'release-cli create'
SINGLE_FLAGS =
%i[name description tag_name ref released_at].freeze
ARRAY_FLAGS =
%i[milestones].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ Releaser

Returns a new instance of Releaser.


13
14
15
# File 'lib/gitlab/ci/build/releaser.rb', line 13

def initialize(config:)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config


11
12
13
# File 'lib/gitlab/ci/build/releaser.rb', line 11

def config
  @config
end

Instance Method Details

#scriptObject


17
18
19
20
21
22
23
# File 'lib/gitlab/ci/build/releaser.rb', line 17

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