Class: PactBroker::Client::CreateTag

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/client/create_tag.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pact_broker_base_url, pacticipant_name, version, tags, auto_create_version, pact_broker_client_options) ⇒ CreateTag

Returns a new instance of CreateTag.



13
14
15
16
17
18
19
20
# File 'lib/pact_broker/client/create_tag.rb', line 13

def initialize(pact_broker_base_url, pacticipant_name, version, tags, auto_create_version, pact_broker_client_options)
  @pact_broker_base_url = pact_broker_base_url
  @pacticipant_name = pacticipant_name
  @version = version
  @tags = tags
  @auto_create_version = auto_create_version
  @pact_broker_client_options = pact_broker_client_options
end

Class Method Details

.call(pact_broker_base_url, pacticipant_name, version, tags, auto_create_version, pact_broker_client_options = {}) ⇒ Object



9
10
11
# File 'lib/pact_broker/client/create_tag.rb', line 9

def self.call(pact_broker_base_url, pacticipant_name, version, tags, auto_create_version, pact_broker_client_options={})
  new(pact_broker_base_url, pacticipant_name, version, tags, auto_create_version, pact_broker_client_options).call
end

Instance Method Details

#callObject



22
23
24
25
26
27
28
29
30
# File 'lib/pact_broker/client/create_tag.rb', line 22

def call
  ensure_version_exists if !auto_create_version
  tags.each do | tag |
    $stdout.puts "Tagging #{pacticipant_name} version #{version} as #{tag}"
    Retry.while_error do
      pact_broker_client.pacticipants.versions.tag pacticipant: pacticipant_name, version: version, tag: tag
    end
  end
end