pact_broker-client 1.9.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/RELEASING.md +1 -2
- data/lib/pact_broker/client/can_i_deploy.rb +8 -3
- data/lib/pact_broker/client/version.rb +1 -1
- data/pact-broker-client.gemspec +1 -0
- data/script/release.sh +3 -2
- data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +12 -4
- data/spec/pacts/pact_broker_client-pact_broker.json +6 -3
- data/spec/support/matrix.json +2 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d02c4958a4ce2075aa48badee273f98fa548a788
|
4
|
+
data.tar.gz: b46ca8c2e3d9774b03708d21a37dbd1ba38b5a49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e40cdbc4fb73a1003aa67031ceaa81e87af13f0e5ebef364ea2eedfa645b146aa4c9b5c1428c6be23a83f7a6ce331f1e7763121302173fca39ee49a3ef7e0c2d
|
7
|
+
data.tar.gz: e35369fe4b2ede88564929b9c9bec86bf13bbca64b9b4ad170c9fbfab300aa8da6e4145fd626643e4b868e6fdbbd03732e9e4fb3cf815a214ed8a45bacaef678
|
data/CHANGELOG.md
CHANGED
data/RELEASING.md
CHANGED
@@ -2,6 +2,7 @@ require 'pact_broker/client/error'
|
|
2
2
|
require 'pact_broker/client/pact_broker_client'
|
3
3
|
require 'pact_broker/client/retry'
|
4
4
|
require 'pact_broker/client/matrix/formatter'
|
5
|
+
require 'term/ansicolor'
|
5
6
|
|
6
7
|
module PactBroker
|
7
8
|
module Client
|
@@ -28,7 +29,7 @@ module PactBroker
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def call
|
31
|
-
if matrix[:summary][:
|
32
|
+
if matrix[:summary][:deployable]
|
32
33
|
Result.new(true, success_message(matrix))
|
33
34
|
else
|
34
35
|
Result.new(false, failure_message(matrix))
|
@@ -46,7 +47,7 @@ module PactBroker
|
|
46
47
|
def success_message(matrix)
|
47
48
|
message = format_matrix(matrix)
|
48
49
|
if format != 'json'
|
49
|
-
message = 'Computer says yes \o/' + "\n\n" + message
|
50
|
+
message = 'Computer says yes \o/ ' + "\n\n" + message + "\n\n#{Term::ANSIColor.green(reason(matrix))}"
|
50
51
|
end
|
51
52
|
message
|
52
53
|
end
|
@@ -54,7 +55,7 @@ module PactBroker
|
|
54
55
|
def failure_message(matrix)
|
55
56
|
message = format_matrix(matrix)
|
56
57
|
if format != 'json'
|
57
|
-
message = 'Computer says no ¯\_(ツ)_/¯' + "\n\n" + message
|
58
|
+
message = 'Computer says no ¯\_(ツ)_/¯ ' + "\n\n" + message + "\n\n#{Term::ANSIColor.red(reason(matrix))}"
|
58
59
|
end
|
59
60
|
message
|
60
61
|
end
|
@@ -67,6 +68,10 @@ module PactBroker
|
|
67
68
|
options[:output]
|
68
69
|
end
|
69
70
|
|
71
|
+
def reason(matrix)
|
72
|
+
matrix[:summary][:reason]
|
73
|
+
end
|
74
|
+
|
70
75
|
def matrix
|
71
76
|
@matrix ||= Retry.until_true { pact_broker_client.matrix.get(version_selectors) }
|
72
77
|
end
|
data/pact-broker-client.gemspec
CHANGED
data/script/release.sh
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#!/bin/
|
1
|
+
#!/bin/sh
|
2
2
|
set -e
|
3
|
-
|
3
|
+
|
4
|
+
bundle exec bump ${1:-minor} --no-commit
|
4
5
|
bundle exec rake generate_changelog
|
5
6
|
git add CHANGELOG.md lib/pact_broker/client/version.rb
|
6
7
|
git commit -m "Releasing version $(ruby -r ./lib/pact_broker/client/version.rb -e "puts PactBroker::Client::VERSION")"
|
@@ -4,11 +4,11 @@ module PactBroker
|
|
4
4
|
module Client
|
5
5
|
describe CanIDeploy do
|
6
6
|
let(:pact_broker_base_url) { 'http://example.org' }
|
7
|
-
let(:version_selectors) { [{pacticipant: "Foo", version: "1"}] }
|
7
|
+
let(:version_selectors) { [{ pacticipant: "Foo", version: "1" }] }
|
8
8
|
let(:pact_broker_client_options) { { foo: 'bar' } }
|
9
9
|
let(:matrix_client) { instance_double('PactBroker::Client::Matrix') }
|
10
|
-
let(:matrix) { {matrix: ['foo'], summary: {
|
11
|
-
let(:options) { {output: 'text' } }
|
10
|
+
let(:matrix) { { matrix: ['foo'], summary: { deployable: true, reason: 'some reason' } } }
|
11
|
+
let(:options) { { output: 'text' } }
|
12
12
|
|
13
13
|
before do
|
14
14
|
allow_any_instance_of(PactBroker::Client::PactBrokerClient).to receive(:matrix).and_return(matrix_client)
|
@@ -37,10 +37,14 @@ module PactBroker
|
|
37
37
|
expect(subject.message).to include "Computer says yes"
|
38
38
|
expect(subject.message).to include "\n\ntext matrix"
|
39
39
|
end
|
40
|
+
|
41
|
+
it "returns a success reason" do
|
42
|
+
expect(subject.message).to include "some reason"
|
43
|
+
end
|
40
44
|
end
|
41
45
|
|
42
46
|
context "when compatible versions are not found" do
|
43
|
-
let(:matrix) { {matrix: ['foo'], summary: {
|
47
|
+
let(:matrix) { {matrix: ['foo'], summary: { deployable: false, reason: 'some reason' }} }
|
44
48
|
|
45
49
|
it "returns a failure response" do
|
46
50
|
expect(subject.success).to be false
|
@@ -49,6 +53,10 @@ module PactBroker
|
|
49
53
|
it "returns a failure message" do
|
50
54
|
expect(subject.message).to include "Computer says no"
|
51
55
|
end
|
56
|
+
|
57
|
+
it "returns a failure reason" do
|
58
|
+
expect(subject.message).to include "some reason"
|
59
|
+
end
|
52
60
|
end
|
53
61
|
|
54
62
|
context "when a PactBroker::Client::Error is raised" do
|
@@ -200,7 +200,8 @@
|
|
200
200
|
},
|
201
201
|
"body": {
|
202
202
|
"summary": {
|
203
|
-
"
|
203
|
+
"deployable": true,
|
204
|
+
"reason": "some text"
|
204
205
|
},
|
205
206
|
"matrix": [
|
206
207
|
{
|
@@ -247,7 +248,8 @@
|
|
247
248
|
},
|
248
249
|
"body": {
|
249
250
|
"summary": {
|
250
|
-
"
|
251
|
+
"deployable": true,
|
252
|
+
"reason": "some text"
|
251
253
|
},
|
252
254
|
"matrix": [
|
253
255
|
{
|
@@ -415,7 +417,8 @@
|
|
415
417
|
},
|
416
418
|
"body": {
|
417
419
|
"summary": {
|
418
|
-
"
|
420
|
+
"deployable": true,
|
421
|
+
"reason": "some text"
|
419
422
|
},
|
420
423
|
"matrix": [
|
421
424
|
{
|
data/spec/support/matrix.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact_broker-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Beth Skurrie
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '1.16'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: bump
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.5'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.5'
|
125
139
|
description: Client for the Pact Broker. Publish, retrieve and query pacts and verification
|
126
140
|
results.
|
127
141
|
email:
|