pact-message 0.1.4 → 0.2.1

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
2
  SHA1:
3
- metadata.gz: d1aa37dbc2996594f153d7c714a81158dca338ff
4
- data.tar.gz: 57b44ccc110677be81ce173a5bf4b2e67705795f
3
+ metadata.gz: 5e485798ab6743cfdc2d99c1bd54b66ca4e80e28
4
+ data.tar.gz: 40801208dfbcdd0db7a93e528819b63884a54381
5
5
  SHA512:
6
- metadata.gz: c27529dd6d6744c6270a15030ed847019df834da67af15c117b843d365c97fdeefd5bf6a7d17d25740c6e53d1ec97247927c5f1c635c02f4d82d1daf86152f48
7
- data.tar.gz: 95409ba2a19871d3ab845c18adb0461a0f5a37e89ff7d23f085b581628c74d69287bddfcadd4d49410e306d1df659d39a37cb3377e0f1c38a7457dfb945c6a30
6
+ metadata.gz: 4d459fe2831df7182485d1dd84c5bd44523ac33186016ce046f0c314464ede165091a548dca55cb06a891c43c5925531f76e8da187a742e65973536e4161f6f2
7
+ data.tar.gz: 128fc9bd83257fffbca3a27cb5a23586362b53c217daee5539d0e9ab3e4392a9816592692e937caea47e0a06fbba11a5bb0e44fb506b0ee03a542ecb5d6ffce2
data/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ <a name="v0.1.5"></a>
2
+ ### v0.1.5 (2018-03-26)
3
+
4
+
5
+ #### Features
6
+
7
+ * upgrade to pact-support 1.5 ([20fea42](/../../commit/20fea42))
8
+ * move pact message classes out of pact-support into pact-message ([a187c4a](/../../commit/a187c4a))
9
+ * update DSL syntax ([8766965](/../../commit/8766965))
10
+ * add cli for other languages to use ([b111edd](/../../commit/b111edd))
11
+ * reuse consumer contract writer from pact-mock_service ([93aa122](/../../commit/93aa122))
12
+ * create dsl and basic pact file writer ([5333564](/../../commit/5333564))
13
+
14
+
15
+ #### Bug Fixes
16
+
17
+ * set pact_specification_version in cli ([834d671](/../../commit/834d671))
18
+ * requires ([886068c](/../../commit/886068c))
19
+ * change executables path from exe to bin ([921a1c3](/../../commit/921a1c3))
20
+
21
+
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
+ Dir.glob('./lib/tasks/**/*.rake').each { |task| load task }
4
+ Dir.glob('./tasks/**/*.rake').each { |task| load task }
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
@@ -21,9 +21,13 @@ module Pact
21
21
  @content = attributes[:content]
22
22
  end
23
23
 
24
- def self.from_hash hash, options
25
- content_hash = Pact::MatchingRules.merge(hash['content'], hash['content']['matchingRules'], options)
26
- content = Pact::ConsumerContract::Message::Content.new(content_hash)
24
+ def self.from_hash hash, options = {}
25
+ opts = options.dup
26
+ unless opts[:pact_specification_version]
27
+ opts[:pact_specification_version] = Pact::SpecificationVersion::NIL_VERSION
28
+ end
29
+ content_hash = Pact::MatchingRules.merge(hash['content'], hash['content']['matchingRules'], opts)
30
+ content = Pact::ConsumerContract::Message::Content.from_hash(content_hash)
27
31
  new(symbolize_keys(hash).merge(content: content))
28
32
  end
29
33
 
@@ -5,6 +5,11 @@ module Pact
5
5
  include ActiveSupportSupport
6
6
  include SymbolizeKeys
7
7
 
8
+ # Could technically be an array
9
+ def self.from_hash content, options = {}
10
+ new(content)
11
+ end
12
+
8
13
  def initialize content
9
14
  @content = content
10
15
  end
@@ -13,7 +13,8 @@ module Pact
13
13
  def update(message)
14
14
  require 'pact/message'
15
15
  require 'pact/message/consumer/update_pact'
16
- message = Pact::Message.from_hash(JSON.parse(message))
16
+ pact_specification_version = Pact::SpecificationVersion.new(options.pact_specification_version)
17
+ message = Pact::Message.from_hash(JSON.parse(message), { pact_specification_version: pact_specification_version })
17
18
  Pact::Message::Consumer::UpdatePact.call(message, options.pact_dir, options.consumer, options.provider, options.pact_specification_version)
18
19
  end
19
20
  end
@@ -28,7 +28,7 @@ module Pact
28
28
  end
29
29
 
30
30
  def with_content(object)
31
- interaction.content = Pact::Message::Content.new(object)
31
+ interaction.content = Pact::Message::Content.from_hash(object)
32
32
  @callback.call interaction
33
33
  self
34
34
  end
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Message
3
- VERSION = "0.1.4"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
data/pact-message.gemspec CHANGED
@@ -40,4 +40,6 @@ Gem::Specification.new do |spec|
40
40
  spec.add_development_dependency "rake", "~> 10.0"
41
41
  spec.add_development_dependency "rspec", "~> 3.0"
42
42
  spec.add_development_dependency "pry-byebug"
43
+ spec.add_development_dependency 'conventional-changelog', '~>1.2'
44
+ spec.add_development_dependency 'bump', '~> 0.5'
43
45
  end
data/script/release.sh ADDED
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ git reset HEAD CHANGELOG.md lib/pact/message/version.rb # avoid accidentally double incrementing when previous run fails
5
+ git checkout -- lib/pact/message/version.rb # avoid accidentally double incrementing when previous run fails
6
+ # git checkout -- CHANGELOG.md # avoid accidentally double incrementing when previous run fails
7
+ bundle exec bump ${1:-minor} --no-commit
8
+ bundle exec rake generate_changelog
9
+ git add CHANGELOG.md lib/pact/message/version.rb
10
+ git commit -m "chore(release): version $(ruby -r ./lib/pact/message/version.rb -e "puts Pact::Message::VERSION")"
11
+ bundle exec rake tag_for_release
12
+ bundle exec rake release
@@ -0,0 +1,15 @@
1
+ desc 'Generate change log'
2
+ task :generate_changelog do
3
+ require 'conventional_changelog'
4
+ require 'pact/message/version'
5
+ ConventionalChangelog::Generator.new.generate! version: "v#{Pact::Message::VERSION}"
6
+ end
7
+
8
+ desc 'Tag for release'
9
+ task :tag_for_release do | t, args |
10
+ require 'pact/message/version'
11
+ version = Pact::Message::VERSION
12
+ command = "git tag -a v#{version} -m \"chore(release): version #{version}\" && git push origin v#{version}"
13
+ puts command
14
+ puts `#{command}`
15
+ end
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.1.4
4
+ version: 0.2.1
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-03-24 00:00:00.000000000 Z
11
+ date: 2018-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pact-support
@@ -108,6 +108,34 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: conventional-changelog
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.2'
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'
111
139
  description:
112
140
  email:
113
141
  - beth@bethesque.com
@@ -121,6 +149,7 @@ files:
121
149
  - ".gitignore"
122
150
  - ".rspec"
123
151
  - ".travis.yml"
152
+ - CHANGELOG.md
124
153
  - CONTRIBUTING.md
125
154
  - DEVELOPER_DOCUMENTATION.md
126
155
  - Gemfile
@@ -152,6 +181,8 @@ files:
152
181
  - lib/pact/message/consumer_contract_parser.rb
153
182
  - lib/pact/message/version.rb
154
183
  - pact-message.gemspec
184
+ - script/release.sh
185
+ - tasks/release.rake
155
186
  homepage: http://pact.io
156
187
  licenses:
157
188
  - MIT