pact_broker-client 1.40.0 → 1.45.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +21 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +57 -0
- data/Gemfile +4 -0
- data/README.md +39 -22
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +79 -280
- data/lib/pact_broker/client/backports.rb +9 -0
- data/lib/pact_broker/client/base_command.rb +98 -0
- data/lib/pact_broker/client/can_i_deploy.rb +57 -5
- data/lib/pact_broker/client/cli/broker.rb +23 -76
- data/lib/pact_broker/client/cli/custom_thor.rb +12 -0
- data/lib/pact_broker/client/cli/deployment_commands.rb +94 -0
- data/lib/pact_broker/client/cli/environment_commands.rb +70 -0
- data/lib/pact_broker/client/cli/pacticipant_commands.rb +53 -0
- data/lib/pact_broker/client/cli/record_deployment_long_desc.txt +0 -55
- data/lib/pact_broker/client/cli/version_selector_options_parser.rb +4 -0
- data/lib/pact_broker/client/colorize_notices.rb +31 -0
- data/lib/pact_broker/client/deployments.rb +4 -0
- data/lib/pact_broker/client/deployments/record_deployment.rb +38 -0
- data/lib/pact_broker/client/deployments/record_release.rb +99 -0
- data/lib/pact_broker/client/deployments/record_support_ended.rb +103 -0
- data/lib/pact_broker/client/deployments/record_undeployment.rb +127 -0
- data/lib/pact_broker/client/describe_text_formatter.rb +23 -0
- data/lib/pact_broker/client/environments.rb +6 -0
- data/lib/pact_broker/client/environments/create_environment.rb +31 -0
- data/lib/pact_broker/client/environments/delete_environment.rb +27 -0
- data/lib/pact_broker/client/environments/describe_environment.rb +26 -0
- data/lib/pact_broker/client/environments/environment_command.rb +66 -0
- data/lib/pact_broker/client/environments/list_environments.rb +30 -0
- data/lib/pact_broker/client/environments/text_formatter.rb +30 -0
- data/lib/pact_broker/client/environments/update_environment.rb +31 -0
- data/lib/pact_broker/client/generate_display_name.rb +27 -0
- data/lib/pact_broker/client/hal/entity.rb +31 -6
- data/lib/pact_broker/client/hal/http_client.rb +8 -2
- data/lib/pact_broker/client/hal/link.rb +8 -0
- data/lib/pact_broker/client/hal_client_methods.rb +1 -3
- data/lib/pact_broker/client/matrix.rb +4 -0
- data/lib/pact_broker/client/matrix/abbreviate_version_number.rb +15 -0
- data/lib/pact_broker/client/matrix/resource.rb +26 -1
- data/lib/pact_broker/client/matrix/text_formatter.rb +28 -17
- data/lib/pact_broker/client/pacticipants.rb +6 -0
- data/lib/pact_broker/client/pacticipants/create.rb +24 -34
- data/lib/pact_broker/client/pacticipants/describe.rb +33 -0
- data/lib/pact_broker/client/pacticipants/list.rb +34 -0
- data/lib/pact_broker/client/pacticipants/text_formatter.rb +41 -0
- data/lib/pact_broker/client/publish_pacts.rb +6 -2
- data/lib/pact_broker/client/string_refinements.rb +56 -0
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pact_broker/client/versions.rb +4 -1
- data/lib/pact_broker/client/versions/describe.rb +3 -1
- data/lib/pact_broker/client/versions/formatter.rb +3 -1
- data/lib/pact_broker/client/versions/json_formatter.rb +5 -3
- data/lib/pact_broker/client/versions/text_formatter.rb +3 -1
- data/pact-broker-client.gemspec +2 -0
- data/script/approve-all.sh +6 -0
- data/script/publish-pact.sh +12 -9
- data/script/record-deployments-and-releases.sh +18 -0
- data/spec/fixtures/approvals/can_i_deploy_failure_dry_run.approved.txt +7 -0
- data/spec/fixtures/approvals/can_i_deploy_ignore.approved.txt +13 -0
- data/spec/fixtures/approvals/can_i_deploy_success_dry_run.approved.txt +7 -0
- data/spec/fixtures/approvals/describe_environment.approved.txt +7 -0
- data/spec/fixtures/approvals/describe_pacticipant.approved.txt +2 -0
- data/spec/fixtures/approvals/list_environments.approved.txt +3 -0
- data/spec/integration/describe_environment_spec.rb +31 -0
- data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +109 -7
- data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +19 -6
- data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +1 -1
- data/spec/lib/pact_broker/client/cli/broker_run_webhook_commands_spec.rb +3 -3
- data/spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb +21 -0
- data/spec/lib/pact_broker/client/deployments/record_deployment_spec.rb +204 -0
- data/spec/lib/pact_broker/client/deployments/record_support_ended_spec.rb +208 -0
- data/spec/lib/pact_broker/client/deployments/record_undeployment_spec.rb +219 -0
- data/spec/lib/pact_broker/client/environments/delete_environment_spec.rb +120 -0
- data/spec/lib/pact_broker/client/environments/describe_environment_spec.rb +89 -0
- data/spec/lib/pact_broker/client/environments/update_environment_spec.rb +167 -0
- data/spec/lib/pact_broker/client/generate_display_name_spec.rb +39 -0
- data/spec/lib/pact_broker/client/hal/entity_spec.rb +2 -2
- data/spec/lib/pact_broker/client/pacticipants/create_spec.rb +2 -2
- data/spec/pacts/pact_broker_client-pact_broker.json +88 -287
- data/spec/service_providers/create_environment_spec.rb +78 -0
- data/spec/service_providers/list_environments_spec.rb +77 -0
- data/spec/service_providers/pact_broker_client_matrix_ignore_spec.rb +98 -0
- data/spec/service_providers/pact_broker_client_register_repository_spec.rb +2 -2
- data/spec/service_providers/pacticipants_create_spec.rb +5 -4
- data/spec/service_providers/publish_pacts_spec.rb +5 -2
- data/spec/service_providers/record_deployment_spec.rb +17 -36
- data/spec/service_providers/record_release_spec.rb +132 -0
- data/spec/service_providers/record_undeployment_spec.rb +166 -0
- data/spec/spec_helper.rb +15 -2
- data/spec/support/approvals.rb +26 -0
- data/spec/support/shared_context.rb +8 -3
- data/tasks/pact.rake +21 -1
- metadata +104 -7
- data/lib/pact_broker/client/versions/record_deployment.rb +0 -109
- data/lib/pact_broker/client/versions/record_undeployment.rb +0 -102
- data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +0 -82
@@ -18,7 +18,7 @@ module PactBroker
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def get href, params = {}, headers = {}
|
21
|
-
query = params.collect{ |(key, value)| "#{CGI::escape(key.to_s)}=#{CGI::escape(value)}" }.join("&")
|
21
|
+
query = params.collect{ |(key, value)| "#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}" }.join("&")
|
22
22
|
uri = URI(href)
|
23
23
|
uri.query = query
|
24
24
|
perform_request(create_request(uri, 'Get', nil, headers), uri)
|
@@ -39,9 +39,15 @@ module PactBroker
|
|
39
39
|
perform_request(create_request(uri, 'Patch', body, headers), uri)
|
40
40
|
end
|
41
41
|
|
42
|
+
def delete href, body = nil, headers = {}
|
43
|
+
uri = URI(href)
|
44
|
+
perform_request(create_request(uri, 'Delete', body, headers), uri)
|
45
|
+
end
|
46
|
+
|
42
47
|
def create_request uri, http_method, body = nil, headers = {}
|
43
48
|
request = Net::HTTP.const_get(http_method).new(uri.request_uri)
|
44
|
-
request['Content-Type']
|
49
|
+
request['Content-Type'] ||= "application/json" if ['Post', 'Put'].include?(http_method)
|
50
|
+
request['Content-Type'] ||= "application/merge-patch+json" if ['Patch'].include?(http_method)
|
45
51
|
request['Accept'] = "application/hal+json"
|
46
52
|
headers.each do | key, value |
|
47
53
|
request[key] = value
|
@@ -69,6 +69,14 @@ module PactBroker
|
|
69
69
|
patch(*args).assert_success!
|
70
70
|
end
|
71
71
|
|
72
|
+
def delete(payload = nil, headers = {})
|
73
|
+
wrap_response(href, @http_client.delete(href, payload ? JSON.dump(payload) : nil, headers))
|
74
|
+
end
|
75
|
+
|
76
|
+
def delete!(*args)
|
77
|
+
delete(*args).assert_success!
|
78
|
+
end
|
79
|
+
|
72
80
|
def expand(params)
|
73
81
|
expanded_url = expand_url(params, href)
|
74
82
|
new_attrs = @attrs.merge('href' => expanded_url)
|
@@ -60,6 +60,9 @@ module PactBroker
|
|
60
60
|
elsif selectors.size == 1 && !options[:to_environment]
|
61
61
|
opts[:latest] = 'true'
|
62
62
|
end
|
63
|
+
if options[:ignore_selectors] && options[:ignore_selectors].any?
|
64
|
+
opts[:ignore] = convert_selector_hashes_to_params(options[:ignore_selectors])
|
65
|
+
end
|
63
66
|
opts
|
64
67
|
end
|
65
68
|
|
@@ -69,6 +72,7 @@ module PactBroker
|
|
69
72
|
hash[:version] = selector[:version] if selector[:version]
|
70
73
|
hash[:latest] = 'true' if selector[:latest]
|
71
74
|
hash[:tag] = selector[:tag] if selector[:tag]
|
75
|
+
hash[:branch] = selector[:branch] if selector[:branch]
|
72
76
|
end
|
73
77
|
end
|
74
78
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module PactBroker
|
2
|
+
module Client
|
3
|
+
class Matrix
|
4
|
+
class AbbreviateVersionNumber
|
5
|
+
def self.call version_number
|
6
|
+
if version_number
|
7
|
+
version_number.gsub(/[A-Za-z0-9]{40}/) do | val |
|
8
|
+
val[0...7] + "..."
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -2,9 +2,22 @@ require 'pact_broker/client/base_client'
|
|
2
2
|
|
3
3
|
module PactBroker
|
4
4
|
module Client
|
5
|
+
class Notice < Hash
|
6
|
+
def initialize(hash)
|
7
|
+
self.merge!(hash)
|
8
|
+
end
|
9
|
+
|
10
|
+
def text
|
11
|
+
self[:text]
|
12
|
+
end
|
13
|
+
|
14
|
+
def type
|
15
|
+
self[:type]
|
16
|
+
end
|
17
|
+
end
|
5
18
|
class Matrix < BaseClient
|
6
|
-
class Resource < Hash
|
7
19
|
|
20
|
+
class Resource < Hash
|
8
21
|
def initialize hash
|
9
22
|
self.merge!(hash)
|
10
23
|
end
|
@@ -21,6 +34,10 @@ module PactBroker
|
|
21
34
|
!!(self[:summary] && Integer === self[:summary][:unknown] )
|
22
35
|
end
|
23
36
|
|
37
|
+
def supports_ignore?
|
38
|
+
!!(self[:summary] && Integer === self[:summary][:ignored] )
|
39
|
+
end
|
40
|
+
|
24
41
|
def unknown_count
|
25
42
|
supports_unknown_count? ? self[:summary][:unknown] : nil
|
26
43
|
end
|
@@ -32,6 +49,14 @@ module PactBroker
|
|
32
49
|
def deployable?
|
33
50
|
self[:summary][:deployable]
|
34
51
|
end
|
52
|
+
|
53
|
+
def notices
|
54
|
+
if self[:notices].is_a?(Array)
|
55
|
+
self[:notices].collect { | notice_hash | Notice.new(notice_hash) }
|
56
|
+
else
|
57
|
+
nil
|
58
|
+
end
|
59
|
+
end
|
35
60
|
end
|
36
61
|
end
|
37
62
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'table_print'
|
2
2
|
require 'dig_rb'
|
3
3
|
require 'pact_broker/client/hash_refinements'
|
4
|
+
require 'pact_broker/client/matrix/abbreviate_version_number'
|
4
5
|
|
5
6
|
module PactBroker
|
6
7
|
module Client
|
@@ -8,38 +9,44 @@ module PactBroker
|
|
8
9
|
class TextFormatter
|
9
10
|
using PactBroker::Client::HashRefinements
|
10
11
|
|
11
|
-
Line = Struct.new(:consumer, :consumer_version, :provider, :provider_version, :success, :ref)
|
12
|
-
|
13
|
-
OPTIONS = [
|
14
|
-
{ consumer: {} },
|
15
|
-
{ consumer_version: {display_name: 'C.VERSION'} },
|
16
|
-
{ provider: {} },
|
17
|
-
{ provider_version: {display_name: 'P.VERSION'} },
|
18
|
-
{ success: {display_name: 'SUCCESS?'} },
|
19
|
-
{ ref: { display_name: 'RESULT#' }}
|
20
|
-
]
|
12
|
+
Line = Struct.new(:consumer, :consumer_version, :provider, :provider_version, :success, :ref, :ignored)
|
21
13
|
|
22
14
|
def self.call(matrix)
|
23
15
|
matrix_rows = matrix[:matrix]
|
24
16
|
return "" if matrix_rows.size == 0
|
17
|
+
data = prepare_data(matrix_rows)
|
18
|
+
printer = TablePrint::Printer.new(data, tp_options(data))
|
19
|
+
printer.table_print + verification_result_urls_text(matrix)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.prepare_data(matrix_rows)
|
25
23
|
verification_result_number = 0
|
26
|
-
|
24
|
+
matrix_rows.each_with_index.collect do | line |
|
27
25
|
has_verification_result_url = lookup(line, nil, :verificationResult, :_links, :self, :href)
|
28
26
|
if has_verification_result_url
|
29
27
|
verification_result_number += 1
|
30
28
|
end
|
31
29
|
Line.new(
|
32
30
|
lookup(line, "???", :consumer, :name),
|
33
|
-
lookup(line, "???", :consumer, :version, :number),
|
31
|
+
AbbreviateVersionNumber.call(lookup(line, "???", :consumer, :version, :number)),
|
34
32
|
lookup(line, "???", :provider, :name) ,
|
35
|
-
lookup(line, "???", :provider, :version, :number),
|
36
|
-
(lookup(line, "???", :verificationResult, :success)).to_s,
|
37
|
-
has_verification_result_url ? verification_result_number : ""
|
33
|
+
AbbreviateVersionNumber.call(lookup(line, "???", :provider, :version, :number)),
|
34
|
+
(lookup(line, "???", :verificationResult, :success)).to_s + ( line[:ignored] ? " [ignored]" : ""),
|
35
|
+
has_verification_result_url ? verification_result_number : "",
|
36
|
+
lookup(line, nil, :ignored)
|
38
37
|
)
|
39
38
|
end
|
39
|
+
end
|
40
40
|
|
41
|
-
|
42
|
-
|
41
|
+
def self.tp_options(data)
|
42
|
+
[
|
43
|
+
{ consumer: { width: max_width(data, :consumer, 'CONSUMER') } },
|
44
|
+
{ consumer_version: { display_name: 'C.VERSION', width: max_width(data, :consumer_version, 'C.VERSION') } },
|
45
|
+
{ provider: { width: max_width(data, :provider, 'PROVIDER') } },
|
46
|
+
{ provider_version: { display_name: 'P.VERSION', width: max_width(data, :provider_version, 'P.VERSION') } },
|
47
|
+
{ success: { display_name: 'SUCCESS?' } },
|
48
|
+
{ ref: { display_name: 'RESULT#' } }
|
49
|
+
]
|
43
50
|
end
|
44
51
|
|
45
52
|
def self.lookup line, default, *keys
|
@@ -72,6 +79,10 @@ module PactBroker
|
|
72
79
|
text
|
73
80
|
end
|
74
81
|
end
|
82
|
+
|
83
|
+
def self.max_width(data, column, title)
|
84
|
+
(data.collect{ |row| row.send(column) } + [title]).compact.collect(&:size).max
|
85
|
+
end
|
75
86
|
end
|
76
87
|
end
|
77
88
|
end
|
@@ -1,55 +1,45 @@
|
|
1
|
-
require 'pact_broker/client/
|
2
|
-
require 'json'
|
3
|
-
require 'pact_broker/client/command_result'
|
4
|
-
require 'pact_broker/client/hal_client_methods'
|
1
|
+
require 'pact_broker/client/base_command'
|
5
2
|
|
6
3
|
module PactBroker
|
7
4
|
module Client
|
8
5
|
module Pacticipants2
|
9
|
-
class Create
|
6
|
+
class Create < PactBroker::Client::BaseCommand
|
10
7
|
|
11
|
-
|
8
|
+
private
|
12
9
|
|
13
|
-
|
14
|
-
new(params, pact_broker_base_url, pact_broker_client_options).call
|
15
|
-
end
|
10
|
+
attr_reader :action, :response_entity
|
16
11
|
|
17
|
-
def
|
18
|
-
|
19
|
-
@index_entry_point = create_index_entry_point(pact_broker_base_url, pact_broker_client_options)
|
20
|
-
@verbose = pact_broker_client_options[:verbose]
|
21
|
-
end
|
12
|
+
def do_call
|
13
|
+
pacticipant_entity = index_resource._link('pb:pacticipant').expand('pacticipant' => params[:name]).get
|
22
14
|
|
23
|
-
def call
|
24
|
-
pacticipant_entity = index_entity._link('pb:pacticipant').expand('pacticipant' => params[:name]).get
|
25
|
-
message = nil
|
26
15
|
response_entity = if pacticipant_entity.does_not_exist?
|
27
|
-
|
28
|
-
|
16
|
+
@action = "created"
|
17
|
+
index_resource._link!('pb:pacticipants').post!(pacticipant_resource_params)
|
18
|
+
elsif pacticipant_entity.success?
|
19
|
+
@action = "updated"
|
20
|
+
pacticipant_entity._link!('self').patch!(pacticipant_resource_params, { "Content-Type" => "application/json" })
|
29
21
|
else
|
30
|
-
|
31
|
-
pacticipant_entity._link!('self').patch(pacticipant_resource_params)
|
22
|
+
pacticipant_entity.assert_success!
|
32
23
|
end
|
33
24
|
|
34
25
|
response_entity.assert_success!
|
35
|
-
PactBroker::Client::CommandResult.new(true,
|
36
|
-
rescue StandardError => e
|
37
|
-
$stderr.puts("#{e.class} - #{e}\n#{e.backtrace.join("\n")}") if verbose
|
38
|
-
PactBroker::Client::CommandResult.new(false, "#{e.class} - #{e}")
|
26
|
+
PactBroker::Client::CommandResult.new(true, result_message)
|
39
27
|
end
|
40
28
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
29
|
+
def result_message
|
30
|
+
if json_output?
|
31
|
+
response_entity.response.raw_body
|
32
|
+
else
|
33
|
+
green(message = "Pacticipant \"#{params[:name]}\" #{action} in #{pact_broker_name}")
|
34
|
+
end
|
47
35
|
end
|
48
36
|
|
49
37
|
def pacticipant_resource_params
|
50
|
-
|
51
|
-
|
52
|
-
|
38
|
+
{
|
39
|
+
name: params[:name],
|
40
|
+
repositoryUrl: params[:repository_url],
|
41
|
+
displayName: params[:display_name]
|
42
|
+
}.compact
|
53
43
|
end
|
54
44
|
end
|
55
45
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'pact_broker/client/base_command'
|
2
|
+
require 'pact_broker/client/describe_text_formatter'
|
3
|
+
|
4
|
+
module PactBroker
|
5
|
+
module Client
|
6
|
+
module Pacticipants2
|
7
|
+
class Describe < PactBroker::Client::BaseCommand
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def do_call
|
12
|
+
PactBroker::Client::CommandResult.new(true, result_message)
|
13
|
+
end
|
14
|
+
|
15
|
+
def pacticipant_entity
|
16
|
+
@pacticipant_entity ||= index_resource._link('pb:pacticipant').expand('pacticipant' => params[:name]).get!
|
17
|
+
end
|
18
|
+
|
19
|
+
def result_message
|
20
|
+
if json_output?
|
21
|
+
pacticipant_entity.response.raw_body
|
22
|
+
else
|
23
|
+
properties = pacticipant_entity.response.body.except("_links", "_embedded")
|
24
|
+
if pacticipant_entity._embedded && pacticipant_entity._embedded["labels"] && pacticipant_entity._embedded["labels"].any?
|
25
|
+
properties["labels"] = pacticipant_entity._embedded["labels"]
|
26
|
+
end
|
27
|
+
PactBroker::Client::DescribeTextFormatter.call(properties)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'pact_broker/client/base_command'
|
2
|
+
require 'pact_broker/client/pacticipants/text_formatter'
|
3
|
+
|
4
|
+
module PactBroker
|
5
|
+
module Client
|
6
|
+
module Pacticipants2
|
7
|
+
class List < PactBroker::Client::BaseCommand
|
8
|
+
private
|
9
|
+
|
10
|
+
attr_reader :environments_resource
|
11
|
+
|
12
|
+
def do_call
|
13
|
+
PactBroker::Client::CommandResult.new(true, result_message)
|
14
|
+
end
|
15
|
+
|
16
|
+
def environments_resource
|
17
|
+
@environments_resource = environments_link.get!
|
18
|
+
end
|
19
|
+
|
20
|
+
def environments_link
|
21
|
+
index_resource._link!('pb:pacticipants')
|
22
|
+
end
|
23
|
+
|
24
|
+
def result_message
|
25
|
+
if json_output?
|
26
|
+
environments_resource.response.raw_body
|
27
|
+
else
|
28
|
+
TextFormatter.call(environments_resource._embedded["pacticipants"])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'table_print'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
module PactBroker
|
5
|
+
module Client
|
6
|
+
module Pacticipants2
|
7
|
+
class TextFormatter
|
8
|
+
def self.call(pacticipants)
|
9
|
+
return "" if pacticipants.size == 0
|
10
|
+
|
11
|
+
data = pacticipants.collect do | pacticipant |
|
12
|
+
# Might add a UUID in at some stage. Backwards compatible supporting code.
|
13
|
+
OpenStruct.new({ uuid: "" }.merge(pacticipant).merge(url: pacticipant["_links"]["self"]["href"]))
|
14
|
+
end.sort_by{ | pacticipant | pacticipant.name.downcase }
|
15
|
+
|
16
|
+
TablePrint::Printer.new(data, tp_options(data)).table_print
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.tp_options(data)
|
20
|
+
uuid_width = max_width(data, :uuid, "")
|
21
|
+
name_width = max_width(data, :name, "NAME")
|
22
|
+
display_name_width = max_width(data, :displayName, "DISPLAY NAME")
|
23
|
+
|
24
|
+
tp_options = [
|
25
|
+
{ name: { width: name_width} },
|
26
|
+
{ displayName: { display_name: "Display name", width: display_name_width } },
|
27
|
+
]
|
28
|
+
|
29
|
+
if uuid_width > 0
|
30
|
+
tp_options.unshift({ uuid: { width: uuid_width } })
|
31
|
+
end
|
32
|
+
tp_options
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.max_width(data, column, title)
|
36
|
+
(data.collect{ |row| row.send(column) } + [title]).compact.collect(&:size).max
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -2,6 +2,7 @@ require 'term/ansicolor'
|
|
2
2
|
require 'pact_broker/client/hal_client_methods'
|
3
3
|
require 'base64'
|
4
4
|
require 'pact_broker/client/publish_pacts_the_old_way'
|
5
|
+
require 'pact_broker/client/colorize_notices'
|
5
6
|
|
6
7
|
module PactBroker
|
7
8
|
module Client
|
@@ -71,7 +72,9 @@ module PactBroker
|
|
71
72
|
def text_message
|
72
73
|
response_entities.flat_map do | response_entity |
|
73
74
|
if response_entity.success?
|
74
|
-
if response_entity.
|
75
|
+
if response_entity.notices
|
76
|
+
PactBroker::Client::ColorizeNotices.call(response_entity.notices.collect{ |n| OpenStruct.new(n) } )
|
77
|
+
elsif response_entity.logs
|
75
78
|
response_entity.logs.collect do | log |
|
76
79
|
colorized_message(log)
|
77
80
|
end
|
@@ -112,7 +115,8 @@ module PactBroker
|
|
112
115
|
specification: "pact",
|
113
116
|
contentType: "application/json",
|
114
117
|
content: Base64.strict_encode64(pact_hash.to_json),
|
115
|
-
writeMode: write_mode
|
118
|
+
writeMode: write_mode,
|
119
|
+
onConflict: write_mode
|
116
120
|
}
|
117
121
|
end
|
118
122
|
end
|