pact 1.61.0 → 1.62.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
2
  SHA256:
3
- metadata.gz: 3fa7e68e5d7bae7690cd437dd16ad8ae62ac3df3ffc613288ad61db695db7893
4
- data.tar.gz: eae97829dbde3d2f1ac593b928992af49ea115c46a17a5d7599a0420474a40e4
3
+ metadata.gz: 7b4004f1a6eed7b4222d8f6f4bd72eb568c75fd198ab77ee663b6aab918ea907
4
+ data.tar.gz: f6cc541f1416275a0cea5b0819d20f58e6b27d8ca10e8f708b0d44d382b88461
5
5
  SHA512:
6
- metadata.gz: 558da76fbb79adb908e6e33dcabe9fdd3a99d8d899121d60239adbdd428e57320812b978290124a722f7e63faf4fa97928e40e0beb5a951965edfc46ac1559b9
7
- data.tar.gz: e8cb83d40823603b794ffcda15c9211f11a0632fd7a4a93c547fcdfc9734e06ae7cabac5edaee812a590c07f7839c13220e85a84a1d4366cb9f3f75dfb39f974
6
+ metadata.gz: 31ce201c07203749e19cb6ca6d1088ef69f1119686119519ab5e15faddda38f80f2846b782efb2e7cb4c3e26bb9df529e45fcc1350df2be63819fbfde50c54e5
7
+ data.tar.gz: 3fa2538f3f8472759eafcd12b8ef829141f343e5cdab8c83ba27bd4f4f1ca0eee1e960fb2467333b17da30a29c8bc849427178c5dc7566e2c94d948cd109a96e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ <a name="v1.62.0"></a>
2
+ ### v1.62.0 (2022-02-21)
3
+
4
+ #### Features
5
+
6
+ * add telemetry (#256) ([4497ee9](/../../commit/4497ee9))
7
+
1
8
  <a name="v1.61.0"></a>
2
9
  ### v1.61.0 (2021-12-16)
3
10
 
@@ -12,6 +12,7 @@ require 'pact/provider/rspec/pact_broker_formatter'
12
12
  require 'pact/provider/rspec/json_formatter'
13
13
  require 'pact/provider/rspec'
14
14
  require 'pact/provider/rspec/calculate_exit_code'
15
+ require 'pact/utils/metrics'
15
16
 
16
17
  module Pact
17
18
  module Provider
@@ -130,6 +131,8 @@ module Pact
130
131
  ignore_failures: options[:ignore_failures],
131
132
  request_customizer: options[:request_customizer]
132
133
  }
134
+ Pact::Utils::Metrics.report_metric("Pacts verified", "ProviderTest", "Completed")
135
+
133
136
  honour_pactfile pact_source, ordered_pact_json(pact_source.pact_json), spec_options
134
137
  end
135
138
  end
@@ -0,0 +1,85 @@
1
+ require 'securerandom'
2
+ require 'digest'
3
+ require 'socket'
4
+ require 'pact/version'
5
+ require 'net/http'
6
+
7
+ module Pact
8
+ module Utils
9
+ class Metrics
10
+
11
+ def self.report_metric(event, category, action, value = 1)
12
+ in_thread do
13
+ begin
14
+ if track_events?
15
+ Pact.configuration.output_stream.puts "WARN: Please note: we are tracking events anonymously to gather important usage statistics like Pact-Ruby version
16
+ and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment
17
+ variable to 'true'."
18
+
19
+ uri = URI('https://www.google-analytics.com/collect')
20
+ req = Net::HTTP::Post.new(uri)
21
+ req.set_form_data(create_tracking_event(event, category, action, value))
22
+
23
+ Net::HTTP.start(uri.hostname, uri.port, read_timeout:2, open_timeout:2, :use_ssl => true ) do |http|
24
+ http.request(req)
25
+ end
26
+ end
27
+ rescue StandardError => e
28
+ handle_error(e)
29
+ end
30
+ end
31
+ end
32
+
33
+ private
34
+ def self.handle_error e
35
+ if ENV['PACT_METRICS_DEBUG'] == 'true'
36
+ Pact.configuration.output_stream.puts("DEBUG: #{e.inspect}\n" + e.backtrace.join("\n"))
37
+ end
38
+ end
39
+
40
+ def self.in_thread
41
+ Thread.new do
42
+ yield
43
+ end
44
+ end
45
+
46
+ def self.create_tracking_event(event, category, action, value)
47
+ {
48
+ "v" => 1,
49
+ "t" => "event",
50
+ "tid" => "UA-117778936-1",
51
+ "cid" => calculate_cid,
52
+ "an" => "Pact Ruby",
53
+ "av" => Pact::VERSION,
54
+ "aid" => "pact-ruby",
55
+ "aip" => 1,
56
+ "ds" => ENV['PACT_EXECUTING_LANGUAGE'] ? "client" : "cli",
57
+ "cd2" => ENV['CI'] == "true" ? "CI" : "unknown",
58
+ "cd3" => RUBY_PLATFORM,
59
+ "cd6" => ENV['PACT_EXECUTING_LANGUAGE'] || "unknown",
60
+ "cd7" => ENV['PACT_EXECUTING_LANGUAGE_VERSION'],
61
+ "el" => event,
62
+ "ec" => category,
63
+ "ea" => action,
64
+ "ev" => value
65
+ }
66
+ end
67
+
68
+ def self.track_events?
69
+ ENV['PACT_DO_NOT_TRACK'] != 'true'
70
+ end
71
+
72
+ def self.calculate_cid
73
+ if RUBY_PLATFORM.include? "windows"
74
+ hostname = ENV['COMPUTERNAME']
75
+ else
76
+ hostname = ENV['HOSTNAME']
77
+ end
78
+ if !hostname
79
+ hostname = Socket.gethostname
80
+ end
81
+ Digest::MD5.hexdigest hostname || SecureRandom.urlsafe_base64(5)
82
+ end
83
+ end
84
+ end
85
+ end
data/lib/pact/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # Remember to bump pact-provider-proxy when this changes major version
2
2
  module Pact
3
- VERSION = "1.61.0"
3
+ VERSION = "1.62.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.61.0
4
+ version: 1.62.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fraser
@@ -9,10 +9,10 @@ authors:
9
9
  - Brent Snook
10
10
  - Ronald Holshausen
11
11
  - Beth Skurrie
12
- autorequire:
12
+ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2021-12-16 00:00:00.000000000 Z
15
+ date: 2022-02-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -385,6 +385,7 @@ files:
385
385
  - lib/pact/tasks/verification_task.rb
386
386
  - lib/pact/templates/help.erb
387
387
  - lib/pact/templates/provider_state.erb
388
+ - lib/pact/utils/metrics.rb
388
389
  - lib/pact/utils/string.rb
389
390
  - lib/pact/version.rb
390
391
  - lib/tasks/pact.rake
@@ -397,7 +398,7 @@ metadata:
397
398
  source_code_uri: https://github.com/pact-foundation/pact-ruby
398
399
  bug_tracker_uri: https://github.com/pact-foundation/pact-ruby/issues
399
400
  documentation_uri: https://github.com/pact-foundation/pact-ruby/blob/master/README.md
400
- post_install_message:
401
+ post_install_message:
401
402
  rdoc_options: []
402
403
  require_paths:
403
404
  - lib
@@ -412,8 +413,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
412
413
  - !ruby/object:Gem::Version
413
414
  version: '0'
414
415
  requirements: []
415
- rubygems_version: 3.2.33
416
- signing_key:
416
+ rubygems_version: 3.3.7
417
+ signing_key:
417
418
  specification_version: 4
418
419
  summary: Enables consumer driven contract testing, providing a mock service and DSL
419
420
  for the consumer project, and interaction playback and verification for the service