pact-mock_service 3.10.0 → 3.11.2
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 +4 -4
- data/CHANGELOG.md +25 -0
- data/README.md +1 -1
- data/lib/pact/consumer_contract/consumer_contract_writer.rb +5 -4
- data/lib/pact/mock_service/interactions/interaction_mismatch.rb +1 -1
- data/lib/pact/mock_service/version.rb +1 -1
- data/lib/pact/support/metrics.rb +21 -8
- metadata +7 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35208bed4d9b93717ba8b35a08aa6f2e56782ea293545592f27083c5c1bbf2e7
|
4
|
+
data.tar.gz: 005f131effb1f86c89e019b897d6c639c2b415e82a2abbd952d857c7bba3159f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42fbfc013b5b85714fc7708aae97ff6fdc2df21c9fe8f9ad12ade37a7663811ba0e8930243c9cc501eab8cd8dc8a3bcc5677435d58b80aae092ab183a1f4a045
|
7
|
+
data.tar.gz: 63453f0a70730d551afad689e26a2387d1d5f8c9b51b6d145f415c858e695fb3c6620143d956a97d3854818c09b5eac43682d75646ffcbc80fa367c983770afc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
+
<a name="v3.11.2"></a>
|
2
|
+
### v3.11.2 (2023-05-18)
|
3
|
+
|
4
|
+
#### Bug Fixes
|
5
|
+
|
6
|
+
* use native lockfile, rather than ruby gem, tested on ruby 3.3.0-dev ([9a51a01](/../../commit/9a51a01))
|
7
|
+
|
8
|
+
<a name="v3.11.1"></a>
|
9
|
+
### v3.11.1 (2023-05-05)
|
10
|
+
|
11
|
+
#### Bug Fixes
|
12
|
+
|
13
|
+
* set args via ** for diff_formatter.call ([96a00a9](/../../commit/96a00a9))
|
14
|
+
|
15
|
+
<a name="v3.11.0"></a>
|
16
|
+
### v3.11.0 (2022-08-17)
|
17
|
+
|
18
|
+
#### Features
|
19
|
+
|
20
|
+
* only print metrics warning once per thread ([1ae43da](/../../commit/1ae43da))
|
21
|
+
|
22
|
+
#### Bug Fixes
|
23
|
+
|
24
|
+
* fix ruby `circular require` warning (#136) ([615e59c](/../../commit/615e59c))
|
25
|
+
|
1
26
|
<a name="v3.10.0"></a>
|
2
27
|
### v3.10.0 (2022-02-21)
|
3
28
|
|
data/README.md
CHANGED
@@ -130,7 +130,7 @@ Description:
|
|
130
130
|
|
131
131
|
See [CONTRIBUTING.md](/CONTRIBUTING.md)
|
132
132
|
|
133
|
-
[pact]: https://github.com/
|
133
|
+
[pact]: https://github.com/pact-foundation/pact-ruby
|
134
134
|
[executables]: https://github.com/pact-foundation/pact-ruby-standalone/releases
|
135
135
|
[pact-dev]: https://groups.google.com/forum/#!forum/pact-dev
|
136
136
|
[wiki]: https://github.com/pact-foundation/pact-mock_service/wiki
|
@@ -5,7 +5,6 @@ require 'pact/consumer_contract/pact_file'
|
|
5
5
|
require 'pact/consumer_contract/consumer_contract_decorator'
|
6
6
|
require 'pact/shared/active_support_support'
|
7
7
|
require 'fileutils'
|
8
|
-
require 'filelock'
|
9
8
|
|
10
9
|
module Pact
|
11
10
|
|
@@ -60,8 +59,10 @@ module Pact
|
|
60
59
|
def update_pactfile
|
61
60
|
logger.info log_message
|
62
61
|
FileUtils.mkdir_p File.dirname(pactfile_path)
|
63
|
-
|
64
|
-
|
62
|
+
# must be read after obtaining the lock, and must be read from the yielded file object, otherwise windows freaks out
|
63
|
+
# https://apidock.com/ruby/File/flock
|
64
|
+
File.open(pactfile_path, File::RDWR|File::CREAT, 0644) {|pact_file|
|
65
|
+
pact_file.flock(File::LOCK_EX)
|
65
66
|
@existing_contents = pact_file.read
|
66
67
|
new_contents = pact_json
|
67
68
|
pact_file.rewind
|
@@ -69,7 +70,7 @@ module Pact
|
|
69
70
|
pact_file.write new_contents
|
70
71
|
pact_file.flush
|
71
72
|
pact_file.truncate(pact_file.pos)
|
72
|
-
|
73
|
+
}
|
73
74
|
end
|
74
75
|
|
75
76
|
def pact_json
|
data/lib/pact/support/metrics.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'securerandom'
|
2
2
|
require 'digest'
|
3
3
|
require 'socket'
|
4
|
-
require 'pact/support/metrics'
|
5
4
|
require 'pact/mock_service/version'
|
6
5
|
require 'net/http'
|
7
6
|
|
@@ -10,17 +9,21 @@ module Pact
|
|
10
9
|
class Metrics
|
11
10
|
|
12
11
|
def self.report_metric(event, category, action, value = 1)
|
12
|
+
do_once_per_thread(:pact_metrics_message_shown) do
|
13
|
+
if track_events?
|
14
|
+
Pact.configuration.output_stream.puts "mock WARN: Please note: we are tracking events anonymously to gather important usage statistics like Pact-Ruby version and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment variable to 'true'."
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
13
18
|
in_thread do
|
14
19
|
begin
|
15
20
|
if track_events?
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
req = Net::HTTP::Post.new(uri)
|
20
|
-
req.set_form_data(create_tracking_event(event, category, action, value))
|
21
|
+
uri = URI('https://www.google-analytics.com/collect')
|
22
|
+
req = Net::HTTP::Post.new(uri)
|
23
|
+
req.set_form_data(create_tracking_event(event, category, action, value))
|
21
24
|
|
22
|
-
|
23
|
-
|
25
|
+
Net::HTTP.start(uri.hostname, uri.port, read_timeout:2, open_timeout:2, :use_ssl => true ) do |http|
|
26
|
+
http.request(req)
|
24
27
|
end
|
25
28
|
end
|
26
29
|
rescue StandardError => e
|
@@ -43,6 +46,16 @@ module Pact
|
|
43
46
|
end
|
44
47
|
end
|
45
48
|
|
49
|
+
# Not super safe to use the thread, but it's good enough for this usecase
|
50
|
+
def self.do_once_per_thread(key)
|
51
|
+
result = nil
|
52
|
+
if !Thread.current[key]
|
53
|
+
result = yield
|
54
|
+
end
|
55
|
+
Thread.current[key] = true
|
56
|
+
result
|
57
|
+
end
|
58
|
+
|
46
59
|
def self.create_tracking_event(event, category, action, value)
|
47
60
|
{
|
48
61
|
"v" => 1,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact-mock_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Fraser
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2023-05-18 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|
@@ -96,28 +96,14 @@ dependencies:
|
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '1.
|
100
|
-
type: :runtime
|
101
|
-
prerelease: false
|
102
|
-
version_requirements: !ruby/object:Gem::Requirement
|
103
|
-
requirements:
|
104
|
-
- - "~>"
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
version: '1.3'
|
107
|
-
- !ruby/object:Gem::Dependency
|
108
|
-
name: term-ansicolor
|
109
|
-
requirement: !ruby/object:Gem::Requirement
|
110
|
-
requirements:
|
111
|
-
- - "~>"
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: '1.0'
|
99
|
+
version: '1.8'
|
114
100
|
type: :runtime
|
115
101
|
prerelease: false
|
116
102
|
version_requirements: !ruby/object:Gem::Requirement
|
117
103
|
requirements:
|
118
104
|
- - "~>"
|
119
105
|
- !ruby/object:Gem::Version
|
120
|
-
version: '1.
|
106
|
+
version: '1.8'
|
121
107
|
- !ruby/object:Gem::Dependency
|
122
108
|
name: pact-support
|
123
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,20 +124,6 @@ dependencies:
|
|
138
124
|
- - ">="
|
139
125
|
- !ruby/object:Gem::Version
|
140
126
|
version: 1.16.4
|
141
|
-
- !ruby/object:Gem::Dependency
|
142
|
-
name: filelock
|
143
|
-
requirement: !ruby/object:Gem::Requirement
|
144
|
-
requirements:
|
145
|
-
- - "~>"
|
146
|
-
- !ruby/object:Gem::Version
|
147
|
-
version: '1.1'
|
148
|
-
type: :runtime
|
149
|
-
prerelease: false
|
150
|
-
version_requirements: !ruby/object:Gem::Requirement
|
151
|
-
requirements:
|
152
|
-
- - "~>"
|
153
|
-
- !ruby/object:Gem::Version
|
154
|
-
version: '1.1'
|
155
127
|
- !ruby/object:Gem::Dependency
|
156
128
|
name: rack-test
|
157
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,14 +192,14 @@ dependencies:
|
|
220
192
|
requirements:
|
221
193
|
- - "~>"
|
222
194
|
- !ruby/object:Gem::Version
|
223
|
-
version: '
|
195
|
+
version: '2.4'
|
224
196
|
type: :development
|
225
197
|
prerelease: false
|
226
198
|
version_requirements: !ruby/object:Gem::Requirement
|
227
199
|
requirements:
|
228
200
|
- - "~>"
|
229
201
|
- !ruby/object:Gem::Version
|
230
|
-
version: '
|
202
|
+
version: '2.4'
|
231
203
|
- !ruby/object:Gem::Dependency
|
232
204
|
name: hashie
|
233
205
|
requirement: !ruby/object:Gem::Requirement
|
@@ -412,7 +384,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
412
384
|
- !ruby/object:Gem::Version
|
413
385
|
version: '0'
|
414
386
|
requirements: []
|
415
|
-
rubygems_version: 3.
|
387
|
+
rubygems_version: 3.4.13
|
416
388
|
signing_key:
|
417
389
|
specification_version: 4
|
418
390
|
summary: Provides a mock service for use with Pact
|