pact-message 0.7.0 → 0.8.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
  SHA256:
3
- metadata.gz: d44fac4a872e57e964a935d228261c50773a4f90249bcdd979420b390b057b73
4
- data.tar.gz: ea1c430bf254ae94970eaedb568d578cab98d1e68d6ad9e0dcd16322e0775eb1
3
+ metadata.gz: 78d08c5d0ff1f47c7645c15116d76899e296609e415a2bd7c316aecb2f3ab350
4
+ data.tar.gz: c306cdc07c7ec261cdb6908d0c5528a934055d71bfd4ca64cddede5d960d698b
5
5
  SHA512:
6
- metadata.gz: 4c9e77894059e089b6f3239727abe57425b2256d203b2ed6d66a6ee3b94f6ba063b9871198c18ace55dfb74a7d8c1d509f9ee17076df4d89c87657999a26b2fd
7
- data.tar.gz: 0230fe4dde29531395c5a8153ecf6e718669c412e0088e4eb957131d5c55a64ea4d7eaffc441816b7a8d9c1fa838ee798ee4148a7857e53736534616bc3ef8d5
6
+ metadata.gz: e96ced52250984fefe42525d870ef3257bbaf16c6021f6b6426cf49eea83b5d31683e481357ceae672833e58fe930cb7b2cab410d8f0d4f1186bd3013153d443
7
+ data.tar.gz: 20ef30518e2cf57b1f21e3f2540f4a48858781752318dbe3b2d4dff743830510e83d0335cc59c224a995aacda5860c8a8383bb7c0aa25f60cfde704260ea75da
@@ -0,0 +1,58 @@
1
+ name: Release gem
2
+
3
+ on:
4
+ repository_dispatch:
5
+ types:
6
+ - release-triggered
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: '2.6'
16
+ - run: |
17
+ gem install bundler -v 2.1
18
+ bundle install
19
+ - name: Test
20
+ run: bundle exec rake
21
+
22
+ release:
23
+ needs: test
24
+ runs-on: ubuntu-latest
25
+ outputs:
26
+ gem_name: ${{ steps.release.outputs.gem_name }}
27
+ version: ${{ steps.release.outputs.version }}
28
+ increment: ${{ steps.release.outputs.increment }}
29
+ steps:
30
+ - uses: actions/checkout@v2
31
+ with:
32
+ fetch-depth: 0
33
+ - uses: pact-foundation/release-gem@v0.0.11
34
+ id: release
35
+ env:
36
+ GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_API_KEY }}'
37
+ GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
38
+ INCREMENT: '${{ github.event.client_payload.increment }}'
39
+
40
+ notify-gem-released:
41
+ needs: release
42
+ strategy:
43
+ matrix:
44
+ repository: [pact-foundation/pact-ruby-standalone]
45
+ runs-on: ubuntu-latest
46
+ steps:
47
+ - name: Notify ${{ matrix.repository }} of gem release
48
+ uses: peter-evans/repository-dispatch@v1
49
+ with:
50
+ token: ${{ secrets.GHTOKENFORPACTCLIRELEASE }}
51
+ repository: ${{ matrix.repository }}
52
+ event-type: gem-released
53
+ client-payload: |
54
+ {
55
+ "name": "${{ needs.release.outputs.gem_name }}",
56
+ "version": "${{ needs.release.outputs.version }}",
57
+ "increment": "${{ needs.release.outputs.increment }}"
58
+ }
@@ -11,23 +11,23 @@ script:
11
11
  - rvm use @global
12
12
  - bundle exec rake
13
13
  jobs:
14
- include:
15
- - stage: gem release
16
- rvm: 2.2.4
17
- script: echo "Deploying to rubygems.org ..."
18
- deploy:
19
- provider: rubygems
20
- api_key:
21
- secure: NEA7BYENheSN8qF/6BP52uQjTS5U43MXsyxBeqxbp1JOkJxVSNzQw14xy41aXX0gphT7wEVHinnWS+1slLKXvu4OzGKKzcUsnekYFZoGW7eTyKUx7lh/XtFejQ/Mm4P5t75GBgMoaIi+Pa1rD4fcE7zYGrgCvTwIrOGb/SPIKILj0yT8UXMFod8yDDmxzivSSKYe4rgWYlq8aiidDZr2M5ypBR4WcOptCrkBCF8XxXzhFMY4QtrXLsLFRyCzCrDHmosCfC/bLJQltlJjLXfB5ksgaImWAD7wZ6Q4uC5QqmPShonQiPlLEh53Q5nkEWPIcsV7FVZqzXUjPN3LYHlRv+7D3AvbHmJggSt7fXr8YxbzVUkviBlKqNmc9cqM6CSO++QT3UShNgH5b03YKI8rRjFMWYKn1DrN5F5rFNDoGFcZtQSjFN5g/fEiSYsdkNsIeTp4YFxMkTztAYT8TxgcBvCnfXox6xDaLaPWh13UrUL2VL7O7uDK06xWUCp9Hm3/AXz0wRzya1tK9dCWamE5BOzk2ScOiLOgmpgwNHFVA1U93rkHq7Ixr11wazP3Dcinv0kWcW7hdMcI7VA0DUesxLKw6mkcQpd3NLgSU4mWtpoVFcmdERQUGsNM1d5NjGjBeyVMpC0I9NXM1Wv6cLENSX9b4GR7lkwGG/IHRFNciHk=
22
- gem: pact-message
23
- on:
24
- tags: true
25
- repo: pact-foundation/pact-message-ruby
26
- notifications:
27
- webhooks:
28
- urls:
29
- - https://webhooks.gitter.im/e/6523128341fad111ed79
30
- on_success: change
31
- on_failure: always
32
- on_start: never
14
+ # include:
15
+ # - stage: gem release
16
+ # rvm: 2.2.4
17
+ # script: echo "Deploying to rubygems.org ..."
18
+ # deploy:
19
+ # provider: rubygems
20
+ # api_key:
21
+ # secure: NEA7BYENheSN8qF/6BP52uQjTS5U43MXsyxBeqxbp1JOkJxVSNzQw14xy41aXX0gphT7wEVHinnWS+1slLKXvu4OzGKKzcUsnekYFZoGW7eTyKUx7lh/XtFejQ/Mm4P5t75GBgMoaIi+Pa1rD4fcE7zYGrgCvTwIrOGb/SPIKILj0yT8UXMFod8yDDmxzivSSKYe4rgWYlq8aiidDZr2M5ypBR4WcOptCrkBCF8XxXzhFMY4QtrXLsLFRyCzCrDHmosCfC/bLJQltlJjLXfB5ksgaImWAD7wZ6Q4uC5QqmPShonQiPlLEh53Q5nkEWPIcsV7FVZqzXUjPN3LYHlRv+7D3AvbHmJggSt7fXr8YxbzVUkviBlKqNmc9cqM6CSO++QT3UShNgH5b03YKI8rRjFMWYKn1DrN5F5rFNDoGFcZtQSjFN5g/fEiSYsdkNsIeTp4YFxMkTztAYT8TxgcBvCnfXox6xDaLaPWh13UrUL2VL7O7uDK06xWUCp9Hm3/AXz0wRzya1tK9dCWamE5BOzk2ScOiLOgmpgwNHFVA1U93rkHq7Ixr11wazP3Dcinv0kWcW7hdMcI7VA0DUesxLKw6mkcQpd3NLgSU4mWtpoVFcmdERQUGsNM1d5NjGjBeyVMpC0I9NXM1Wv6cLENSX9b4GR7lkwGG/IHRFNciHk=
22
+ # gem: pact-message
23
+ # on:
24
+ # tags: true
25
+ # repo: pact-foundation/pact-message-ruby
26
+ # notifications:
27
+ # webhooks:
28
+ # urls:
29
+ # - https://webhooks.gitter.im/e/6523128341fad111ed79
30
+ # on_success: change
31
+ # on_failure: always
32
+ # on_start: never
33
33
 
@@ -1,3 +1,14 @@
1
+ <a name="v0.8.0"></a>
2
+ ### v0.8.0 (2020-09-28)
3
+
4
+ #### Features
5
+
6
+ * reify message when yielding ([d7c0a4a](/../../commit/d7c0a4a))
7
+
8
+ #### Bug Fixes
9
+
10
+ * fix bug in Message.to_hash ([e354cd2](/../../commit/e354cd2))
11
+
1
12
  <a name="v0.7.0"></a>
2
13
  ### v0.7.0 (2020-02-10)
3
14
 
@@ -48,7 +48,7 @@ module Pact
48
48
  {
49
49
  description: description,
50
50
  provider_states: [{ name: provider_state }],
51
- contents: contents.to_hash,
51
+ contents: contents.contents,
52
52
  metadata: metadata
53
53
  }
54
54
  end
@@ -1,3 +1,4 @@
1
+ require 'pact/reification'
1
2
  module Pact
2
3
  class ConsumerContract
3
4
  class Message
@@ -15,10 +16,18 @@ module Pact
15
16
  end
16
17
 
17
18
  def to_s
18
- if @contents.is_a?(Hash) || @contents.is_a?(Array)
19
- @contents.to_json
19
+ if contents.is_a?(Hash) || contents.is_a?(Array)
20
+ contents.to_json
20
21
  else
21
- @contents.to_s
22
+ contents.to_s
23
+ end
24
+ end
25
+
26
+ def reified_contents_string
27
+ if contents.is_a?(Hash) || contents.is_a?(Array)
28
+ Pact::Reification.from_term(contents).to_json
29
+ else
30
+ Pact::Reification.from_term(contents).to_s
22
31
  end
23
32
  end
24
33
 
@@ -21,12 +21,12 @@ module Pact
21
21
  interaction_builder.is_expected_to_send(provider_state)
22
22
  end
23
23
 
24
- def send_message
25
- # TODO handle matchers
26
- yield @contents_string if block_given?
24
+ def send_message_string
25
+ yield contents.reified_contents_string if block_given?
27
26
  end
28
27
 
29
28
  def handle_interaction_fully_defined(interaction)
29
+ @contents = interaction.contents
30
30
  @contents_string = interaction.contents.to_s
31
31
  @interactions << interaction
32
32
  @interaction_builder = nil
@@ -42,7 +42,7 @@ module Pact
42
42
  private
43
43
 
44
44
  attr_writer :interaction_builder
45
- attr_accessor :consumer_name, :provider_name, :consumer_contract_details
45
+ attr_accessor :consumer_name, :provider_name, :consumer_contract_details, :contents
46
46
 
47
47
  def interaction_builder
48
48
  @interaction_builder ||=
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Message
3
- VERSION = "0.7.0"
3
+ VERSION = "0.8.0"
4
4
  end
5
5
  end
@@ -36,7 +36,6 @@ Gem::Specification.new do |spec|
36
36
  spec.add_runtime_dependency "pact-mock_service", "~> 3.1"
37
37
  spec.add_runtime_dependency "thor", "~> 0.20"
38
38
 
39
- spec.add_development_dependency "bundler", "~> 1.17.3"
40
39
  spec.add_development_dependency "rake", "~> 10.0"
41
40
  spec.add_development_dependency "rspec", "~> 3.0"
42
41
  spec.add_development_dependency "pry-byebug"
@@ -0,0 +1,30 @@
1
+ #!/bin/sh
2
+
3
+ # Script to trigger release of gem via the pact-foundation/release-gem action
4
+ # Requires a Github API token with repo scope stored in the
5
+ # environment variable GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES
6
+
7
+ : "${GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES:?Please set environment variable GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES}"
8
+
9
+ if [ -n "$1" ]; then
10
+ increment="\"${1}\""
11
+ else
12
+ increment="null"
13
+ fi
14
+
15
+ repository_slug=$(git remote get-url $(git remote show) | cut -d':' -f2 | sed 's/\.git//')
16
+
17
+ output=$(curl -v -X POST https://api.github.com/repos/${repository_slug}/dispatches \
18
+ -H 'Accept: application/vnd.github.everest-preview+json' \
19
+ -H "Authorization: Bearer $GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES" \
20
+ -d "{\"event_type\": \"release-triggered\", \"client_payload\": {\"increment\": ${increment}}}" 2>&1)
21
+
22
+ if ! echo "${output}" | grep "HTTP\/1.1 204" > /dev/null; then
23
+ echo "$output" | sed "s/${GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES}/********/g"
24
+ echo "Failed to trigger release"
25
+ exit 1
26
+ else
27
+ echo "Release workflow triggered"
28
+ fi
29
+
30
+ echo "See https://github.com/${repository_slug}/actions?query=workflow%3A%22Release+gem%22"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact-message
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Beth Skurrie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-13 00:00:00.000000000 Z
11
+ date: 2020-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pact-support
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.20'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 1.17.3
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 1.17.3
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -146,6 +132,7 @@ executables:
146
132
  extensions: []
147
133
  extra_rdoc_files: []
148
134
  files:
135
+ - ".github/workflows/release_gem.yml"
149
136
  - ".gitignore"
150
137
  - ".rspec"
151
138
  - ".travis.yml"
@@ -187,6 +174,7 @@ files:
187
174
  - script/release.sh
188
175
  - script/release/bump-version.sh
189
176
  - script/release/generate-changelog.sh
177
+ - script/trigger-release.sh
190
178
  - script/update-pact.sh
191
179
  - tasks/release.rake
192
180
  homepage: http://pact.io
@@ -209,8 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
197
  - !ruby/object:Gem::Version
210
198
  version: '0'
211
199
  requirements: []
212
- rubyforge_project:
213
- rubygems_version: 2.7.7
200
+ rubygems_version: 3.1.4
214
201
  signing_key:
215
202
  specification_version: 4
216
203
  summary: Consumer contract library for messages