pact_broker-client 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca92e53e6aab9983ef939c9582e6ac0359ca8259
4
- data.tar.gz: 4497c279c270dd495633134a1203a5ff84caeb30
3
+ metadata.gz: d02c4958a4ce2075aa48badee273f98fa548a788
4
+ data.tar.gz: b46ca8c2e3d9774b03708d21a37dbd1ba38b5a49
5
5
  SHA512:
6
- metadata.gz: 24a2de802420ad8fbd99085b3a12ac34666334991bfc379f968a055f2b4072892cec8ca12a09fcf7536eaf64310f57a727328542c8ae9fde3063f020f31d7731
7
- data.tar.gz: 44faf6be7105518d0432f09834c610a9ab77e55d0b760c2eb8f8b983661b435ffb5dc9198b8ad665b0034439f2284e67838008da67430e576f18d286aa5b6373
6
+ metadata.gz: e40cdbc4fb73a1003aa67031ceaa81e87af13f0e5ebef364ea2eedfa645b146aa4c9b5c1428c6be23a83f7a6ce331f1e7763121302173fca39ee49a3ef7e0c2d
7
+ data.tar.gz: e35369fe4b2ede88564929b9c9bec86bf13bbca64b9b4ad170c9fbfab300aa8da6e4145fd626643e4b868e6fdbbd03732e9e4fb3cf815a214ed8a45bacaef678
@@ -1,3 +1,13 @@
1
+ <a name="v1.10.0"></a>
2
+ ### v1.10.0 (2017-10-31)
3
+
4
+
5
+ #### Features
6
+
7
+ * **can-i-deploy**
8
+ * print out matrix summary 'reason' ([aa25e16](/../../commit/aa25e16))
9
+
10
+
1
11
  <a name="v1.9.0"></a>
2
12
  ### v1.9.0 (2017-10-30)
3
13
 
@@ -1,5 +1,4 @@
1
1
  # Releasing
2
2
 
3
3
  1. Check status of https://travis-ci.org/pact-foundation/pact_broker-client
4
- 2. Increment the version in `lib/pact_broker/client/version.rb`
5
- 3. Run script/release.sh
4
+ 2. Run script/release.sh [major|minor|patch] - will use minor by default
@@ -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][:compatible]
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
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
2
  module Client
3
- VERSION = '1.9.0'
3
+ VERSION = '1.10.0'
4
4
  end
5
5
  end
@@ -30,4 +30,5 @@ Gem::Specification.new do |gem|
30
30
  gem.add_development_dependency 'webmock', '~> 3.0'
31
31
  gem.add_development_dependency 'conventional-changelog'
32
32
  gem.add_development_dependency 'pact', '~> 1.16'
33
+ gem.add_development_dependency 'bump', '~> 0.5'
33
34
  end
@@ -1,6 +1,7 @@
1
- #!/bin/bash
1
+ #!/bin/sh
2
2
  set -e
3
- bundle exec rake
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: {compatible: true}} }
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: {compatible: false}} }
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
- "compatible": true
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
- "compatible": true
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
- "compatible": true
420
+ "deployable": true,
421
+ "reason": "some text"
419
422
  },
420
423
  "matrix": [
421
424
  {
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "summary": {
3
- "compatible": true
3
+ "deployable": true,
4
+ "reason": "some text"
4
5
  },
5
6
  "matrix": [
6
7
  {
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.9.0
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: