pact-mock_service 2.10.1 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/pact/mock_service/version.rb +1 -1
- data/lib/pact/stub_service/cli.rb +17 -7
- data/lib/pact/support/expand_file_list.rb +26 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 747c96bb4d050f110fcce31d689e1d618bfca4bbd4ffcd80cb4cbfe9d2a73169
|
4
|
+
data.tar.gz: 32383ee0cdb1aa0a91d631f12c9f666a44d931244aa31d55e53eb54657a0f0bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b2df396720759af740955a36889fd8874d6a0bfa54e1f49a88c1d3d923399927847830476cc0e610701f4ec9a89f8bd1b67dc1a4f0ed1cc5b1185f2f6c16426
|
7
|
+
data.tar.gz: a42b7aeedbc4cd54d8546be463eefef1bf63137c3c3bbdd7d84da433144b99a43dd48a1aafe8bd1df42165efd38f525a467765e749fe9d673d0110906da66722
|
data/CHANGELOG.md
CHANGED
@@ -10,16 +10,17 @@ module Pact
|
|
10
10
|
module StubService
|
11
11
|
class CLI < Pact::MockService::CLI::CustomThor
|
12
12
|
|
13
|
-
desc 'PACT_URI ...', "Start a stub service with the given pact file(s)."
|
13
|
+
desc 'PACT_URI ...', "Start a stub service with the given pact file(s) or directory."
|
14
14
|
long_desc <<-DOC
|
15
|
-
Start a stub service with the given pact file(s). Pact URIs may be local
|
15
|
+
Start a stub service with the given pact file(s) or directories. Pact URIs may be local
|
16
|
+
file or directory paths, or HTTP.
|
16
17
|
Include any basic auth details in the URL using the format https://USERNAME:PASSWORD@URI.
|
17
18
|
Where multiple matching interactions are found, the interactions will be sorted by
|
18
19
|
response status, and the first one will be returned. This may lead to some non-deterministic
|
19
20
|
behaviour. If you are having problems with this, please raise it on the pact-dev google group,
|
20
21
|
and we can discuss some potential enhancements.
|
21
22
|
Note that only versions 1 and 2 of the pact specification are currently fully supported.
|
22
|
-
Pacts using the v3 format may be used, however, any matching features added in
|
23
|
+
Pacts using the v3 format may be used, however, any matching features added in v3 will
|
23
24
|
currently be ignored.
|
24
25
|
DOC
|
25
26
|
|
@@ -33,13 +34,16 @@ module Pact
|
|
33
34
|
method_option :stub_pactfile_paths, hide: true
|
34
35
|
method_option :monkeypatch, hide: true
|
35
36
|
|
36
|
-
def service(*
|
37
|
-
raise Thor::Error.new("Please provide an existing pact file to load") if pactfiles.empty?
|
37
|
+
def service(*pact_files)
|
38
38
|
require 'pact/mock_service/run'
|
39
|
-
|
39
|
+
require 'pact/support/expand_file_list'
|
40
|
+
|
41
|
+
expanded_pact_files = file_list(pact_files)
|
42
|
+
raise Thor::Error.new("Please provide at least one pact file to load") if expanded_pact_files.empty?
|
43
|
+
|
40
44
|
opts = Thor::CoreExt::HashWithIndifferentAccess.new
|
41
45
|
opts.merge!(options)
|
42
|
-
opts[:stub_pactfile_paths] =
|
46
|
+
opts[:stub_pactfile_paths] = expanded_pact_files
|
43
47
|
opts[:pactfile_write_mode] = 'none'
|
44
48
|
MockService::Run.(opts)
|
45
49
|
end
|
@@ -52,6 +56,12 @@ module Pact
|
|
52
56
|
end
|
53
57
|
|
54
58
|
default_task :service
|
59
|
+
|
60
|
+
no_commands do
|
61
|
+
def file_list(pact_files)
|
62
|
+
Pact::Support::ExpandFileList.call(pact_files)
|
63
|
+
end
|
64
|
+
end
|
55
65
|
end
|
56
66
|
end
|
57
67
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Pact
|
2
|
+
module Support
|
3
|
+
module ExpandFileList
|
4
|
+
def self.call pact_files
|
5
|
+
pact_files
|
6
|
+
.collect{ |path| unixify_path(path) }
|
7
|
+
.collect{ | path | expand_path(path) }
|
8
|
+
.flatten
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.unixify_path(path)
|
12
|
+
path.gsub(/\\+/, '/')
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.expand_path(path)
|
16
|
+
if File.directory?(path)
|
17
|
+
Dir.glob(File.join(path, "*.json"))
|
18
|
+
elsif Dir.glob(path).any?
|
19
|
+
Dir.glob(path)
|
20
|
+
else
|
21
|
+
path
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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.
|
4
|
+
version: 2.11.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-08-
|
15
|
+
date: 2018-08-28 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|
@@ -379,6 +379,7 @@ files:
|
|
379
379
|
- lib/pact/mock_service/spawn.rb
|
380
380
|
- lib/pact/mock_service/version.rb
|
381
381
|
- lib/pact/stub_service/cli.rb
|
382
|
+
- lib/pact/support/expand_file_list.rb
|
382
383
|
homepage: https://github.com/bethesque/pact-mock_service
|
383
384
|
licenses:
|
384
385
|
- MIT
|