pact-mock_service 2.8.1 → 2.9.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: 2e0585076366311b3315c8bd80584eb0f5bfbf87eed8ee4bbbd561ac88c4cfea
4
- data.tar.gz: fdd8ad14aadcb135156b2a3d7879e21e1ed1a1e93a66736810bfdfda1928515f
3
+ metadata.gz: b82bc38bee71e0f4870efdcefd13f9959b6ec44de8ed01b9a44e7bcc1710e98d
4
+ data.tar.gz: 81e5ac42bcdaa64bdfa74ab5af1a093b521aa543684f104a2f5d7acc1edb754b
5
5
  SHA512:
6
- metadata.gz: 759c2d76e3928dbaf72b81ee999ce8d30bb4d37342913d0cfa6ab0b223d711a4d4bd0ceda6f40cf52dba36edf27bbe54a2b889f23f9c3256ef7f36c1c1544544
7
- data.tar.gz: cb1929ccb48e06ff2d5197c73731017a795c33594d99d93ac896fe3bca803eaf2f936a7d79e8a7a2bb7382bc1381d901a6b3a13d0f731f412b88d666f328caad
6
+ metadata.gz: 58a15eb3aeade226fb8b154c2422e80bddbca9706d1ce5e36d1e126a15a4dd6656f844a935657ef96cc0cf45569934c90e0c41b80003e39b01f79e27b531f376
7
+ data.tar.gz: 15a02ed2aa3904b1eca749652df85f9fba5308cedb0c87cbffa99f338150c5b54acc872df17c18b9cba0582f3d7854efd1053490f6bebb49ba40bafa911c6fb6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ <a name="v2.9.0"></a>
2
+ ### v2.9.0 (2018-06-15)
3
+
4
+
5
+ #### Features
6
+
7
+ * allow --log-level to be specified in the CLI ([cf84a34](/../../commit/cf84a34))
8
+
9
+
1
10
  <a name="v2.8.1"></a>
2
11
  ### v2.8.1 (2018-06-01)
3
12
 
data/README.md CHANGED
@@ -42,7 +42,7 @@ Run `pact-mock-service help` for command line options.
42
42
 
43
43
  ## Mock Service Usage
44
44
 
45
- Each mock service process is designed to mock only ONE provider. To mock multiple providers, you will need to start a process for each provider. The lifecycle of a mock service instance during a test suite execution is as follows:
45
+ Each mock service process is designed to mock only ONE provider for ONE consumer. To mock multiple providers, you will need to start a process for each provider. The lifecycle of a mock service instance during a test suite execution is as follows:
46
46
 
47
47
  * _Before suite:_ start mock service
48
48
  * _Before each test:_ clear interactions from previous test
@@ -22,6 +22,7 @@ module Pact
22
22
  method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
23
23
  method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact. Note that only versions 1 and 2 are currently supported.", default: '2'
24
24
  method_option :log, aliases: "-l", desc: "File to which to log output"
25
+ method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
25
26
  method_option :cors, aliases: "-o", desc: "Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses"
26
27
  method_option :ssl, desc: "Use a self-signed SSL cert to run the service over HTTPS", type: :boolean, default: false
27
28
  method_option :sslcert, desc: "Specify the path to the SSL cert to use when running the service over HTTPS"
@@ -38,6 +39,7 @@ module Pact
38
39
  method_option :host, aliases: "-h", desc: "Host on which to bind the service", default: 'localhost'
39
40
  method_option :pact_dir, aliases: "-d", desc: "Directory to which the pacts will be written"
40
41
  method_option :log_dir, aliases: "-l", desc: "File to which to log output"
42
+ method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
41
43
  method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
42
44
  method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact. Note that only versions 1 and 2 are currently supported.", default: '2'
43
45
  method_option :cors, aliases: "-o", desc: "Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses"
@@ -59,6 +61,7 @@ module Pact
59
61
  method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
60
62
  method_option :pid_dir, desc: "PID dir", default: 'tmp/pids'
61
63
  method_option :log, aliases: "-l", desc: "File to which to log output"
64
+ method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
62
65
  method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact. Note that only versions 1 and 2 are currently supported.", default: '2'
63
66
  method_option :cors, aliases: "-o", desc: "Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses"
64
67
  method_option :ssl, desc: "Use a self-signed SSL cert to run the service over HTTPS", type: :boolean, default: false
@@ -89,6 +92,7 @@ module Pact
89
92
  method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
90
93
  method_option :pid_dir, desc: "PID dir", default: 'tmp/pids'
91
94
  method_option :log, aliases: "-l", desc: "File to which to log output"
95
+ method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
92
96
  method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact. Note that only versions 1 and 2 are currently supported.", default: '2'
93
97
  method_option :cors, aliases: "-o", desc: "Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses"
94
98
  method_option :ssl, desc: "Use a self-signed SSL cert to run the service over HTTPS", type: :boolean, default: false
@@ -104,6 +108,7 @@ module Pact
104
108
  desc 'control-start', "Start a Pact mock service control server."
105
109
  method_option :port, aliases: "-p", desc: "Port on which to run the service", default: '1234'
106
110
  method_option :log_dir, aliases: "-l", desc: "File to which to log output", default: "log"
111
+ method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
107
112
  method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
108
113
  method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact", default: '2'
109
114
  method_option :pid_dir, desc: "PID dir", default: "tmp/pids"
@@ -130,6 +135,7 @@ module Pact
130
135
  desc 'control-restart', "Start a Pact mock service control server."
131
136
  method_option :port, aliases: "-p", desc: "Port on which to run the service", default: '1234'
132
137
  method_option :log_dir, aliases: "-l", desc: "File to which to log output", default: "log"
138
+ method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
133
139
  method_option :pact_dir, aliases: "-d", desc: "Directory to which the pacts will be written", default: "."
134
140
  method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
135
141
  method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact. Note that only versions 1 and 2 are currently supported.", default: '2'
@@ -19,9 +19,22 @@ module Pact
19
19
  log_stream = options[:log_file] || $stdout
20
20
  logger = new log_stream
21
21
  logger.formatter = options[:log_formatter] if options[:log_formatter]
22
- logger.level = ::Logger::DEBUG
22
+ logger.level = logger_level(options[:log_level])
23
23
  logger
24
24
  end
25
+
26
+ def self.logger_level log_level_string
27
+ if log_level_string
28
+ begin
29
+ Kernel.const_get('Logger').const_get(log_level_string.upcase)
30
+ rescue NameError
31
+ $stderr.puts "WARN: Ignoring log level '#{log_level_string}' as it is not a valid value. Valid values are: DEBUG INFO WARN ERROR FATAL. Using DEBUG."
32
+ Logger::DEBUG
33
+ end
34
+ else
35
+ Logger::DEBUG
36
+ end
37
+ end
25
38
  end
26
39
  end
27
40
  end
@@ -52,6 +52,7 @@ module Pact
52
52
  def service_options
53
53
  service_options = {
54
54
  pact_dir: options[:pact_dir],
55
+ log_level: options[:log_level],
55
56
  unique_pact_file_names: options[:unique_pact_file_names],
56
57
  consumer: options[:consumer],
57
58
  provider: options[:provider],
@@ -37,6 +37,7 @@ module Pact
37
37
  def mock_service
38
38
  Pact::MockService.new(
39
39
  log_file: create_log_file,
40
+ log_level: options[:log_level],
40
41
  name: name,
41
42
  consumer: consumer,
42
43
  provider: provider,
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module MockService
3
- VERSION = "2.8.1"
3
+ VERSION = "2.9.0"
4
4
  end
5
5
  end
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: 2.8.1
4
+ version: 2.9.0
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: 2018-05-31 00:00:00.000000000 Z
15
+ date: 2018-06-15 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rack