pact-message 0.4.4 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 43374e97bfa51563bc3ab89d73c440c173c4de2e
4
- data.tar.gz: baeac5facaea29cb8b4361081664768eb3668b0c
2
+ SHA256:
3
+ metadata.gz: 78d08c5d0ff1f47c7645c15116d76899e296609e415a2bd7c316aecb2f3ab350
4
+ data.tar.gz: c306cdc07c7ec261cdb6908d0c5528a934055d71bfd4ca64cddede5d960d698b
5
5
  SHA512:
6
- metadata.gz: 9f1d1389d16098395139fc3e704e078ec0b85b58be47ae4c20dc1ed1bead79958f316952353415119dc64f1d176aece71d7a024ee167e37654c7f35684bd51b8
7
- data.tar.gz: eb13de87b16f9beab09da1fc85497a74680eebfef9afa5660d35129ee2a7b7ad657ccb90d90d9c25d30b868c9c7c01db358f084f050207e3a737d3775913a7af
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
+ }
@@ -1,12 +1,33 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4.1
5
- before_install: gem install bundler -v 1.15.4
6
- notifications:
7
- webhooks:
8
- urls:
9
- - https://webhooks.gitter.im/e/6523128341fad111ed79
10
- on_success: change
11
- on_failure: always
12
- on_start: never
4
+ - 2.2.4
5
+ before_install:
6
+ - rvm use @global
7
+ - gem uninstall bundler -x || gem uninstall bundler -a || true
8
+ - gem install bundler -v 1.17.3
9
+ - bundler --version
10
+ script:
11
+ - rvm use @global
12
+ - bundle exec rake
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
33
+
@@ -1,3 +1,63 @@
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
+
12
+ <a name="v0.7.0"></a>
13
+ ### v0.7.0 (2020-02-10)
14
+
15
+
16
+ #### Features
17
+
18
+ * Add metadata to a message request ([796590f](/../../commit/796590f))
19
+ * support the _id attribute from the Pact Broker, and give each message an index ([3a05501](/../../commit/3a05501))
20
+
21
+
22
+ #### Bug Fixes
23
+
24
+ * add back support for using providerState instead of providerStates when updating a pact ([b494a76](/../../commit/b494a76))
25
+
26
+
27
+ <a name="v0.6.0"></a>
28
+ ### v0.6.0 (2020-02-10)
29
+
30
+
31
+ #### Features
32
+
33
+ * Add metadata to a message request ([796590f](/../../commit/796590f))
34
+ * support the _id attribute from the Pact Broker, and give each message an index ([3a05501](/../../commit/3a05501))
35
+
36
+
37
+ #### Bug Fixes
38
+
39
+ * add back support for using providerState instead of providerStates when updating a pact ([b494a76](/../../commit/b494a76))
40
+
41
+
42
+ <a name="v0.5.0"></a>
43
+ ### v0.5.0 (2018-10-04)
44
+
45
+
46
+ #### Features
47
+
48
+ * **pact specification v3**
49
+ * add support for multiple provider states and params ([b2c1cc7](/../../commit/b2c1cc7))
50
+
51
+
52
+ <a name="v0.4.5"></a>
53
+ ### v0.4.5 (2018-07-07)
54
+
55
+
56
+ #### Bug Fixes
57
+
58
+ * include metaData in message pact ([e68ca4f](/../../commit/e68ca4f))
59
+
60
+
1
61
  <a name="v0.4.3"></a>
2
62
  ### v0.4.3 (2018-05-06)
3
63
 
@@ -0,0 +1,15 @@
1
+ FROM ruby:2.2.4-alpine
2
+
3
+ # Installation path
4
+ ENV HOME=/app
5
+ WORKDIR $HOME
6
+
7
+ RUN set -ex && \
8
+ adduser -h $HOME -s /bin/false -D -S -G root ruby && \
9
+ chmod g+w $HOME && \
10
+ apk add --update --no-cache make gcc libc-dev git
11
+
12
+ RUN gem install bundler -v 1.17.3
13
+ COPY Gemfile pact-message.gemspec $HOME/
14
+ COPY lib/pact/message/version.rb $HOME/lib/pact/message/version.rb
15
+ RUN bundle install --no-cache
data/README.md CHANGED
@@ -4,13 +4,14 @@
4
4
 
5
5
  Create and verify consumer driven contracts for messages.
6
6
 
7
- This project is still under development and is not ready for production use.
7
+
8
8
 
9
9
  ## Installation
10
10
 
11
11
  Add this line to your application's Gemfile:
12
12
 
13
13
  ```ruby
14
+ gem 'pact'
14
15
  gem 'pact-message'
15
16
  ```
16
17
 
@@ -20,11 +21,76 @@ And then execute:
20
21
 
21
22
  Or install it yourself as:
22
23
 
24
+ $ gem install pact
23
25
  $ gem install pact-message
24
26
 
25
27
  ## Usage
26
28
 
29
+ The key to using Message Pact is to completely separate the business logic that creates the message from the transmission protocol (eg. Kafka, Websockets, Lambda). This allows you to write a contract for the message contents, no matter how it is communicated.
30
+
31
+ ### Consumer
32
+
33
+ Not finished yet as nobody has asked for it. Ping @Beth Skurrie on slack.pact.io if you'd like use this.
34
+
35
+ ### Provider
36
+
37
+ Also called a "producer". Message pact verification follows all the same principles as HTTP pact verification, except that instead of verifying that a provider can make the expected HTTP response, we are verifying that the provider can create the expected message. Please read the HTTP Pact [verification](https://github.com/pact-foundation/pact-ruby/wiki/Verifying-pacts) documentation. The only difference is in the configuration block. Use `message_provider` instead of `service_provider`, and configure a `builder` block that takes a `|description|` argument, instead of a Rack `app` block.
38
+
39
+ Make sure you've required 'pact/message' as well as 'pact'.
40
+
41
+ ```ruby
42
+ require 'pact'
43
+ require 'pact/message'
44
+
45
+ Pact.message_provider "MyMessageProvider" do
46
+ honours_pact_with "MyMessageConsumer" do
47
+ pact_uri "/path/or/url/to/your/pact", {
48
+ username: "optional username",
49
+ password: "optional password",
50
+ token: "optional token"
51
+ }
52
+ end
53
+
54
+ # or
55
+
56
+ honours_pacts_from_pact_broker do
57
+ # See docs at https://github.com/pact-foundation/pact-ruby/wiki/Verifying-pacts
58
+ end
59
+
60
+ builder do |message_description|
61
+ #... code that accepts a message description and returns
62
+ # a message hash that should match what is expected in the pact
63
+ do
64
+ end
65
+
66
+ ```
67
+
68
+ How you map between the message description and the code that creates the message is up to you. The easiest way is something like this:
69
+
70
+ ```ruby
71
+ class MyMessageProvider
72
+ def create_hello_message
73
+ {
74
+ text: "Hello world"
75
+ }
76
+ end
77
+ end
78
+
79
+ CONFIG = {
80
+ "a hello message" => lambda { MyMessageProvider.new.create_hello_message }
81
+ }
82
+
83
+ Pact.message_provider "SomeProvider" do
84
+ builder do |description|
85
+ CONFIG[description].call
86
+ do
87
+ end
88
+
89
+ ```
90
+
91
+ #### Provider states
27
92
 
93
+ Provider states work the same way for Message Pact as they do for HTTP Pact. Please read the [provider state](https://github.com/pact-foundation/pact-ruby#using-provider-states) docs in the HTTP Pact project.
28
94
 
29
95
  ## Development
30
96
 
@@ -13,13 +13,16 @@ module Pact
13
13
  include Pact::ActiveSupportSupport
14
14
  include Pact::SymbolizeKeys
15
15
 
16
- attr_accessor :description, :contents, :provider_state, :metadata
16
+ attr_accessor :description, :contents, :provider_state, :provider_states, :metadata, :_id, :index
17
17
 
18
18
  def initialize attributes = {}
19
19
  @description = attributes[:description]
20
20
  @provider_state = attributes[:provider_state] || attributes[:providerState]
21
+ @provider_states = attributes[:provider_states] || []
21
22
  @contents = attributes[:contents]
22
23
  @metadata = attributes[:metadata]
24
+ @_id = attributes[:_id]
25
+ @index = attributes[:index]
23
26
  end
24
27
 
25
28
  def self.from_hash hash, options = {}
@@ -30,18 +33,22 @@ module Pact
30
33
  contents_matching_rules = hash['matchingRules'] && hash['matchingRules']['body']
31
34
  contents_hash = Pact::MatchingRules.merge(hash['contents'], contents_matching_rules, opts)
32
35
  contents = Pact::ConsumerContract::Message::Contents.from_hash(contents_hash)
33
- metadata = hash['metaData']
34
- provider_state = hash['providerStates'] && hash['providerStates'].first && hash['providerStates'].first['name']
35
- warn_if_multiple_provider_states(provider_state, hash)
36
- warn_if_params_used_in_provider_states(hash)
37
- new(symbolize_keys(hash).merge(contents: contents, provider_state: provider_state, metadata: metadata))
36
+ metadata = hash['metaData'] || hash['metadata']
37
+
38
+ provider_state_name = parse_provider_state_name(hash['providerState'], hash['providerStates'])
39
+ provider_states = parse_provider_states(provider_state_name, hash['providerStates'])
40
+ new(symbolize_keys(hash).merge(
41
+ contents: contents,
42
+ provider_state: provider_state_name,
43
+ provider_states: provider_states,
44
+ metadata: metadata))
38
45
  end
39
46
 
40
47
  def to_hash
41
48
  {
42
49
  description: description,
43
50
  provider_states: [{ name: provider_state }],
44
- contents: contents.to_hash,
51
+ contents: contents.contents,
45
52
  metadata: metadata
46
53
  }
47
54
  end
@@ -57,7 +64,8 @@ module Pact
57
64
  providerStates: [{
58
65
  name: provider_state,
59
66
  params: {}
60
- }]
67
+ }],
68
+ metadata: metadata
61
69
  }
62
70
  )
63
71
  end
@@ -116,19 +124,19 @@ module Pact
116
124
 
117
125
  private
118
126
 
119
- def self.warn_if_multiple_provider_states(provider_state, hash)
120
- if hash['providerStates'] && hash['providerStates'].size > 1
121
- ignored_list = hash['providerStates'].collect{ |provider_state| "\"#{provider_state['name']}\"" }[1..-1].join(", ")
122
- Pact.configuration.error_stream.puts("WARN: Using only the first provider state, \"#{provider_state}\", as support for multiple provider states is not yet implemented. Ignoring provider states: #{ignored_list}")
123
- end
127
+ def self.parse_provider_state_name provider_state, provider_states
128
+ (provider_states && provider_states.first && provider_states.first['name']) || provider_state
124
129
  end
125
130
 
126
- def self.warn_if_params_used_in_provider_states(hash)
127
- return unless hash['providerStates']
128
- provider_states_with_params = hash['providerStates'].select{ | provider_state | provider_state.fetch('params', {}).any? }
129
- if provider_states_with_params.any?
130
- ignored_list = provider_states_with_params.collect{ |provider_state| "\"#{provider_state['name']}\"" }.join(", ")
131
- Pact.configuration.error_stream.puts("WARN: Ignoring params for the following provider states as params support is not yet implemented: #{ignored_list}")
131
+ def self.parse_provider_states provider_state_name, provider_states
132
+ if provider_states && provider_states.any?
133
+ provider_states.collect do | provider_state_hash |
134
+ Pact::ProviderState.new(provider_state_hash['name'], provider_state_hash['params'])
135
+ end
136
+ elsif provider_state_name
137
+ [Pact::ProviderState.new(provider_state_name, {})]
138
+ else
139
+ []
132
140
  end
133
141
  end
134
142
  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 ||=
@@ -14,9 +14,10 @@ module Pact
14
14
 
15
15
  def as_json options = {}
16
16
  hash = { :description => message.description }
17
- hash[:providerStates] = provider_states if message.provider_state
17
+ hash[:providerStates] = provider_states
18
18
  hash[:contents] = extract_contents
19
19
  hash[:matchingRules] = extract_matching_rules
20
+ hash[:metaData] = message.metadata || {}
20
21
  fix_all_the_things hash
21
22
  end
22
23
 
@@ -37,7 +38,7 @@ module Pact
37
38
  end
38
39
 
39
40
  def provider_states
40
- [{ name: message.provider_state }]
41
+ message.provider_states.collect(&:as_json)
41
42
  end
42
43
 
43
44
  def extract_matching_rules
@@ -1,6 +1,7 @@
1
1
  require 'pact/consumer_contract'
2
2
  require 'pact/consumer_contract/message'
3
3
  require 'pact/consumer_contract/message/contents'
4
+ require 'pact/consumer_contract/provider_state'
4
5
 
5
6
  module Pact
6
7
  module Message
@@ -10,7 +11,9 @@ module Pact
10
11
  def call(hash)
11
12
  hash = symbolize_keys(hash)
12
13
  options = { pact_specification_version: pact_specification_version(hash) }
13
- interactions = hash[:messages].collect { |hash| Pact::ConsumerContract::Message.from_hash(hash, options)}
14
+ interactions = hash[:messages].each_with_index.collect do |hash, index|
15
+ Pact::ConsumerContract::Message.from_hash({ index: index }.merge(hash), options)
16
+ end
14
17
  ConsumerContract.new(
15
18
  :consumer => ServiceConsumer.from_hash(hash[:consumer]),
16
19
  :provider => ServiceProvider.from_hash(hash[:provider]),
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Message
3
- VERSION = "0.4.4"
3
+ VERSION = "0.8.0"
4
4
  end
5
5
  end
@@ -29,14 +29,13 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
31
 
32
- spec.add_runtime_dependency "pact-support", "~> 1.6"
32
+ spec.add_runtime_dependency "pact-support", "~> 1.8"
33
33
  # pact-mock_service dependencies are Pact::ConsumerContractDecorator
34
34
  # and Pact::ConsumerContractWriter. Potentially we should extract
35
35
  # or duplicate these classes to remove the pact-mock_service dependency.
36
- spec.add_runtime_dependency "pact-mock_service", "~> 2.6"
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.15"
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,21 @@
1
+ #!/usr/bin/env bash
2
+
3
+ export IMAGE=pact_message_ruby_bundle_base
4
+
5
+ function docker_build_bundle_base() {
6
+ docker build . -f Dockerfile-bundle-base -t $IMAGE
7
+ }
8
+
9
+ function bundle_update_on_docker() {
10
+ rm -rf tmp/Gemfile.lock
11
+ docker run --rm -v ${PWD}/tmp:/tmp/bundle_update $IMAGE:latest sh -c "bundle update && cp Gemfile.lock /tmp/bundle_update"
12
+ mv tmp/Gemfile.lock .
13
+ }
14
+
15
+ function on_docker() {
16
+ docker run --rm -v ${PWD}:/app $IMAGE:latest sh -c "$@"
17
+ }
18
+
19
+ gem_version() {
20
+ on_docker "bundle exec ruby -e \"require 'bump'; puts Bump::Bump.current\""
21
+ }
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+
3
+ gem_version() {
4
+ on_docker "bundle exec ruby -e \"require 'bump'; puts Bump::Bump.current\""
5
+ }
@@ -1,13 +1,26 @@
1
- #!/bin/bash
1
+ #!/bin/sh
2
2
  set -e
3
3
 
4
+ source script/docker-functions
5
+
4
6
  # avoid accidentally double incrementing when previous run fails
5
7
  git reset HEAD CHANGELOG.md lib/pact/message/version.rb
6
8
  git checkout -- lib/pact/message/version.rb
7
9
  git checkout -- CHANGELOG.md
8
- bundle exec bump ${1:-minor} --no-commit
9
- bundle exec rake generate_changelog
10
+
11
+ docker_build_bundle_base
12
+
13
+ script/release/bump-version.sh $1
14
+ script/release/generate-changelog.sh
15
+
10
16
  git add CHANGELOG.md lib/pact/message/version.rb
11
- git commit -m "chore(release): version $(ruby -r ./lib/pact/message/version.rb -e "puts Pact::Message::VERSION")"
12
- # bundle exec rake tag_for_release # TODO move release to travis
13
- bundle exec rake release
17
+ git commit -m "chore(release): version ${VERSION}
18
+
19
+ [ci-skip]"
20
+
21
+ VERSION=$(gem_version)
22
+ TAG="v${VERSION}"
23
+ git tag -a "${TAG}" -m "Releasing version ${TAG}"
24
+ git push origin "${TAG}"
25
+ git push origin master
26
+ echo "Releasing from https://travis-ci.org/pact-foundation/pact-message-ruby/builds"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env sh
2
+
3
+ source script/docker-functions
4
+
5
+ on_docker "bundle exec bump ${1:-minor} --no-commit"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env sh
2
+
3
+ set -e
4
+
5
+ source script/docker-functions
6
+ on_docker "bundle exec rake generate_changelog"
@@ -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.4.4
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: 2018-05-07 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
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '1.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '1.8'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pact-mock_service
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.6'
33
+ version: '3.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.6'
40
+ version: '3.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -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.15'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.15'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -146,12 +132,14 @@ 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"
152
139
  - CHANGELOG.md
153
140
  - CONTRIBUTING.md
154
141
  - DEVELOPER_DOCUMENTATION.md
142
+ - Dockerfile-bundle-base
155
143
  - Gemfile
156
144
  - LICENSE.txt
157
145
  - QUESTIONS.md
@@ -181,7 +169,12 @@ files:
181
169
  - lib/pact/message/consumer_contract_parser.rb
182
170
  - lib/pact/message/version.rb
183
171
  - pact-message.gemspec
172
+ - script/docker-functions
173
+ - script/functions
184
174
  - script/release.sh
175
+ - script/release/bump-version.sh
176
+ - script/release/generate-changelog.sh
177
+ - script/trigger-release.sh
185
178
  - script/update-pact.sh
186
179
  - tasks/release.rake
187
180
  homepage: http://pact.io
@@ -204,8 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
197
  - !ruby/object:Gem::Version
205
198
  version: '0'
206
199
  requirements: []
207
- rubyforge_project:
208
- rubygems_version: 2.5.2
200
+ rubygems_version: 3.1.4
209
201
  signing_key:
210
202
  specification_version: 4
211
203
  summary: Consumer contract library for messages