pact_broker-client 1.7.0 → 1.8.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 +12 -0
- data/gemfiles/default.gemfile.lock +1 -11
- data/gemfiles/ruby_under_22.gemfile.lock +1 -11
- data/lib/pact_broker/client/cli/broker.rb +58 -2
- data/lib/pact_broker/client/cli/custom_thor.rb +1 -19
- data/lib/pact_broker/client/retry.rb +1 -1
- data/lib/pact_broker/client/version.rb +1 -1
- data/pact-broker-client.gemspec +0 -1
- data/spec/lib/pact_broker/client/cli/{broker_spec.rb → broker_can_i_deploy_spec.rb} +0 -0
- data/spec/lib/pact_broker/client/cli/{publish_spec.rb → broker_publish_spec.rb} +4 -4
- data/spec/lib/pact_broker/client/cli/custom_thor_spec.rb +0 -31
- metadata +5 -22
- data/bin/pact-publish +0 -4
- data/lib/pact_broker/client/cli/publish.rb +0 -85
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06c73ab8a4906ce7f19c0239159954dc0dabafe8
|
4
|
+
data.tar.gz: bfb34a47d2bdad5ce202fd87a8ceb9528744a2af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c26067119ce4860e20625220ac490e02456d8f60816b12ba59857dd1f89778fa1b8e009e82adf57b5f213ad535357ce781b32c41b892120ba15067e24c6d1e7
|
7
|
+
data.tar.gz: fbcb42c1b2ad4794e9f82e5dbea3703b816e62d4a2019c2e4d41f7d7b974e9afc3419fb17184ce49fec1bb3ba63c89aa33bdc3a7497947fc3c9694f4c1684c9e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
<a name="v1.8.0"></a>
|
2
|
+
### v1.8.0 (2017-10-19)
|
3
|
+
|
4
|
+
#### Features
|
5
|
+
|
6
|
+
* renamed `pact-publish` command to `pact-broker publish` ([ed7d23a](/../../commit/ed7d23a))
|
7
|
+
|
8
|
+
#### Bug Fixes
|
9
|
+
|
10
|
+
* **pact-publish**
|
11
|
+
* ensure process exits with a status 1 when error is raised ([800f5cd](/../../commit/800f5cd))
|
12
|
+
|
1
13
|
<a name="v1.7.0"></a>
|
2
14
|
### v1.7.0 (2017-10-19)
|
3
15
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
pact_broker-client (1.
|
4
|
+
pact_broker-client (1.8.0)
|
5
5
|
httparty
|
6
6
|
json
|
7
7
|
table_print (~> 1.5)
|
@@ -17,8 +17,6 @@ GEM
|
|
17
17
|
rake
|
18
18
|
thor (>= 0.14.0)
|
19
19
|
awesome_print (1.8.0)
|
20
|
-
byebug (9.1.0)
|
21
|
-
coderay (1.1.2)
|
22
20
|
conventional-changelog (1.3.0)
|
23
21
|
crack (0.4.3)
|
24
22
|
safe_yaml (~> 1.0.0)
|
@@ -30,7 +28,6 @@ GEM
|
|
30
28
|
httparty (0.15.6)
|
31
29
|
multi_xml (>= 0.5.2)
|
32
30
|
json (2.1.0)
|
33
|
-
method_source (0.9.0)
|
34
31
|
multi_xml (0.6.0)
|
35
32
|
pact (1.16.1)
|
36
33
|
json (> 1.8.5)
|
@@ -62,12 +59,6 @@ GEM
|
|
62
59
|
rspec (>= 2.14)
|
63
60
|
term-ansicolor (~> 1.0)
|
64
61
|
thor
|
65
|
-
pry (0.11.2)
|
66
|
-
coderay (~> 1.1.0)
|
67
|
-
method_source (~> 0.9.0)
|
68
|
-
pry-byebug (3.5.0)
|
69
|
-
byebug (~> 9.1)
|
70
|
-
pry (~> 0.10)
|
71
62
|
public_suffix (3.0.0)
|
72
63
|
rack (2.0.3)
|
73
64
|
rack-test (0.6.3)
|
@@ -108,7 +99,6 @@ DEPENDENCIES
|
|
108
99
|
fakefs (~> 0.4)
|
109
100
|
pact (~> 1.16)
|
110
101
|
pact_broker-client!
|
111
|
-
pry-byebug
|
112
102
|
rake (~> 10.0.3)
|
113
103
|
webmock (~> 3.0)
|
114
104
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
pact_broker-client (1.
|
4
|
+
pact_broker-client (1.8.0)
|
5
5
|
httparty
|
6
6
|
json
|
7
7
|
table_print (~> 1.5)
|
@@ -17,8 +17,6 @@ GEM
|
|
17
17
|
rake
|
18
18
|
thor (>= 0.14.0)
|
19
19
|
awesome_print (1.8.0)
|
20
|
-
byebug (9.1.0)
|
21
|
-
coderay (1.1.2)
|
22
20
|
conventional-changelog (1.3.0)
|
23
21
|
crack (0.4.3)
|
24
22
|
safe_yaml (~> 1.0.0)
|
@@ -29,7 +27,6 @@ GEM
|
|
29
27
|
httparty (0.15.6)
|
30
28
|
multi_xml (>= 0.5.2)
|
31
29
|
json (2.1.0)
|
32
|
-
method_source (0.9.0)
|
33
30
|
multi_xml (0.6.0)
|
34
31
|
pact (1.16.1)
|
35
32
|
json (> 1.8.5)
|
@@ -60,12 +57,6 @@ GEM
|
|
60
57
|
rspec (>= 2.14)
|
61
58
|
term-ansicolor (~> 1.0)
|
62
59
|
thor
|
63
|
-
pry (0.11.2)
|
64
|
-
coderay (~> 1.1.0)
|
65
|
-
method_source (~> 0.9.0)
|
66
|
-
pry-byebug (3.5.0)
|
67
|
-
byebug (~> 9.1)
|
68
|
-
pry (~> 0.10)
|
69
60
|
public_suffix (3.0.0)
|
70
61
|
rack (1.6.8)
|
71
62
|
rack-test (0.6.3)
|
@@ -106,7 +97,6 @@ DEPENDENCIES
|
|
106
97
|
fakefs (~> 0.4)
|
107
98
|
pact (~> 1.16)
|
108
99
|
pact_broker-client!
|
109
|
-
pry-byebug
|
110
100
|
rack (< 2.0)
|
111
101
|
rake (~> 10.0.3)
|
112
102
|
webmock (~> 3.0)
|
@@ -1,12 +1,17 @@
|
|
1
1
|
require 'pact_broker/client/can_i_deploy'
|
2
2
|
require 'pact_broker/client/version'
|
3
3
|
require 'pact_broker/client/cli/version_selector_options_parser'
|
4
|
-
require '
|
4
|
+
require 'pact_broker/client/cli/custom_thor'
|
5
|
+
require 'pact_broker/client/publish_pacts'
|
6
|
+
require 'rake/file_list'
|
5
7
|
|
6
8
|
module PactBroker
|
7
9
|
module Client
|
8
10
|
module CLI
|
9
|
-
|
11
|
+
# Thor::Error will have its backtrace hidden
|
12
|
+
class PactPublicationError < ::Thor::Error; end
|
13
|
+
|
14
|
+
class Broker < CustomThor
|
10
15
|
desc 'can-i-deploy', "Returns exit code 0 or 1, indicating whether or not the specified application versions are compatible."
|
11
16
|
|
12
17
|
method_option :name, required: true, aliases: "-n", desc: "The application name. Use once for each pacticipant being checked."
|
@@ -24,12 +29,63 @@ module PactBroker
|
|
24
29
|
exit(1) unless result.success
|
25
30
|
end
|
26
31
|
|
32
|
+
desc 'publish PACT_DIRS_OR_FILES ...', "Publish pacts to a Pact Broker."
|
33
|
+
method_option :consumer_app_version, required: true, aliases: "-a", desc: "The consumer application version"
|
34
|
+
method_option :broker_base_url, required: true, aliases: "-b", desc: "The base URL of the Pact Broker"
|
35
|
+
method_option :broker_username, aliases: "-u", desc: "Pact Broker basic auth username"
|
36
|
+
method_option :broker_password, aliases: "-p", desc: "Pact Broker basic auth password"
|
37
|
+
method_option :tag, aliases: "-t", type: :array, banner: "TAG", desc: "Tag name for consumer version. Can be specified multiple times."
|
38
|
+
method_option :verbose, aliases: "-v", desc: "Verbose output", :required => false
|
39
|
+
|
40
|
+
def publish(*pact_files)
|
41
|
+
validate_pact_files(pact_files)
|
42
|
+
success = publish_pacts(pact_files)
|
43
|
+
raise PactPublicationError, "One or more pacts failed to be published" unless success
|
44
|
+
rescue PactBroker::Client::Error => e
|
45
|
+
raise PactPublicationError, "#{e.class} - #{e.message}"
|
46
|
+
end
|
47
|
+
|
27
48
|
desc 'version', "Show the pact_broker-client gem version"
|
28
49
|
def version
|
29
50
|
$stdout.puts PactBroker::Client::VERSION
|
30
51
|
end
|
31
52
|
|
32
53
|
no_commands do
|
54
|
+
|
55
|
+
def self.exit_on_failure?
|
56
|
+
true
|
57
|
+
end
|
58
|
+
|
59
|
+
def validate_pact_files pact_files
|
60
|
+
unless pact_files && pact_files.any?
|
61
|
+
raise RequiredArgumentMissingError, "No value provided for required pact_files"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def publish_pacts pact_files
|
66
|
+
PactBroker::Client::PublishPacts.call(
|
67
|
+
options.broker_base_url,
|
68
|
+
file_list(pact_files),
|
69
|
+
options.consumer_app_version,
|
70
|
+
tags,
|
71
|
+
pact_broker_client_options
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
def file_list pact_files
|
76
|
+
Rake::FileList[pact_files].collect do | path |
|
77
|
+
if File.directory?(path)
|
78
|
+
Rake::FileList[File.join(path, "*.json")]
|
79
|
+
else
|
80
|
+
path
|
81
|
+
end
|
82
|
+
end.flatten
|
83
|
+
end
|
84
|
+
|
85
|
+
def tags
|
86
|
+
[*options.tag].compact
|
87
|
+
end
|
88
|
+
|
33
89
|
def pact_broker_client_options
|
34
90
|
if options.broker_username
|
35
91
|
{
|
@@ -6,9 +6,7 @@ module PactBroker
|
|
6
6
|
##
|
7
7
|
# Custom Thor task allows the following:
|
8
8
|
#
|
9
|
-
# `script arg1 arg2` to be interpreted as `script <default_task> arg1 arg2`
|
10
9
|
# `--option 1 --option 2` to be interpreted as `--option 1 2` (the standard Thor format for multiple value options)
|
11
|
-
# `script --help` to display the help for the default task instead of the command list
|
12
10
|
#
|
13
11
|
class CustomThor < ::Thor
|
14
12
|
|
@@ -17,24 +15,8 @@ module PactBroker
|
|
17
15
|
super(massage_args(given_args))
|
18
16
|
end
|
19
17
|
|
20
|
-
def help *args
|
21
|
-
if args.empty?
|
22
|
-
super(self.class.default_task)
|
23
|
-
else
|
24
|
-
super
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
18
|
def self.massage_args argv
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.prepend_default_task_name argv
|
33
|
-
if known_first_arguments.include?(argv[0])
|
34
|
-
argv
|
35
|
-
else
|
36
|
-
[default_command] + argv
|
37
|
-
end
|
19
|
+
turn_muliple_tag_options_into_array(argv)
|
38
20
|
end
|
39
21
|
|
40
22
|
# other task names, help, and the help shortcuts
|
data/pact-broker-client.gemspec
CHANGED
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'pact_broker/client/cli/
|
1
|
+
require 'pact_broker/client/cli/broker'
|
2
2
|
|
3
3
|
module PactBroker::Client::CLI
|
4
|
-
describe
|
4
|
+
describe Broker do
|
5
5
|
describe ".broker" do
|
6
6
|
before do
|
7
7
|
allow(PactBroker::Client::PublishPacts).to receive(:call).and_return(true)
|
@@ -17,7 +17,7 @@ module PactBroker::Client::CLI
|
|
17
17
|
}
|
18
18
|
end
|
19
19
|
|
20
|
-
let(:invoke_broker) { subject.
|
20
|
+
let(:invoke_broker) { subject.publish(*file_list) }
|
21
21
|
|
22
22
|
context "with minimum valid options" do
|
23
23
|
it "invokes the PublishPacts command" do
|
@@ -26,7 +26,7 @@ module PactBroker::Client::CLI
|
|
26
26
|
["spec/support/cli_test_pacts/foo.json"],
|
27
27
|
"1.2.3",
|
28
28
|
[],
|
29
|
-
{}
|
29
|
+
{verbose: nil}
|
30
30
|
)
|
31
31
|
invoke_broker
|
32
32
|
end
|
@@ -24,42 +24,11 @@ module PactBroker::Client::CLI
|
|
24
24
|
describe CustomThor do
|
25
25
|
subject { TestThor.new }
|
26
26
|
|
27
|
-
it "invokes the default task when aguments are given without specifying a task" do
|
28
|
-
expect(Delegate).to receive(:call).with(argument: 'foo')
|
29
|
-
TestThor.start(%w{foo})
|
30
|
-
end
|
31
|
-
|
32
27
|
it "converts options that are specified multiple times into a single array" do
|
33
28
|
expect(Delegate).to receive(:call).with({'multi' => ['one', 'two']})
|
34
29
|
TestThor.start(%w{test_multiple_options --multi one --multi two})
|
35
30
|
end
|
36
31
|
|
37
|
-
describe ".prepend_default_task_name" do
|
38
|
-
let(:argv_with) { [TestThor.default_command, 'foo'] }
|
39
|
-
|
40
|
-
context "when the default task name is given" do
|
41
|
-
it "does not prepend the default task name" do
|
42
|
-
expect(TestThor.prepend_default_task_name(argv_with)).to eq(argv_with)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context "when the first argument is --help" do
|
47
|
-
let(:argv) { ['--help', 'foo'] }
|
48
|
-
|
49
|
-
it "does not prepend the default task name" do
|
50
|
-
expect(TestThor.prepend_default_task_name(argv)).to eq(argv)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context "when the default task name is not given" do
|
55
|
-
let(:argv) { ['foo'] }
|
56
|
-
|
57
|
-
it "prepends the default task name" do
|
58
|
-
expect(TestThor.prepend_default_task_name(argv)).to eq(argv_with)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
32
|
describe ".turn_muliple_tag_options_into_array" do
|
64
33
|
it "turns '--tag foo --tag bar' into '--tag foo bar'" do
|
65
34
|
input = %w{--ignore this --tag foo --tag bar --wiffle --that}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact_broker-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bethany Skurrie
|
@@ -136,26 +136,11 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '1.16'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: pry-byebug
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
139
|
description: Publishes pacts to, and retrieves pacts from, the pact broker server.
|
154
140
|
email:
|
155
141
|
- bskurrie@dius.com.au
|
156
142
|
executables:
|
157
143
|
- pact-broker
|
158
|
-
- pact-publish
|
159
144
|
extensions: []
|
160
145
|
extra_rdoc_files: []
|
161
146
|
files:
|
@@ -169,7 +154,6 @@ files:
|
|
169
154
|
- RELEASING.md
|
170
155
|
- Rakefile
|
171
156
|
- bin/pact-broker
|
172
|
-
- bin/pact-publish
|
173
157
|
- ci.sh
|
174
158
|
- doc/markdown/Pact Broker Client - Pact Broker.md
|
175
159
|
- doc/markdown/README.md
|
@@ -182,7 +166,6 @@ files:
|
|
182
166
|
- lib/pact_broker/client/can_i_deploy.rb
|
183
167
|
- lib/pact_broker/client/cli/broker.rb
|
184
168
|
- lib/pact_broker/client/cli/custom_thor.rb
|
185
|
-
- lib/pact_broker/client/cli/publish.rb
|
186
169
|
- lib/pact_broker/client/cli/version_selector_options_parser.rb
|
187
170
|
- lib/pact_broker/client/error.rb
|
188
171
|
- lib/pact_broker/client/matrix.rb
|
@@ -205,9 +188,9 @@ files:
|
|
205
188
|
- pact-broker-client.gemspec
|
206
189
|
- spec/lib/pact_broker/client/base_client_spec.rb
|
207
190
|
- spec/lib/pact_broker/client/can_i_deploy_spec.rb
|
208
|
-
- spec/lib/pact_broker/client/cli/
|
191
|
+
- spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb
|
192
|
+
- spec/lib/pact_broker/client/cli/broker_publish_spec.rb
|
209
193
|
- spec/lib/pact_broker/client/cli/custom_thor_spec.rb
|
210
|
-
- spec/lib/pact_broker/client/cli/publish_spec.rb
|
211
194
|
- spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb
|
212
195
|
- spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
|
213
196
|
- spec/lib/pact_broker/client/matrix_spec.rb
|
@@ -266,9 +249,9 @@ summary: See description
|
|
266
249
|
test_files:
|
267
250
|
- spec/lib/pact_broker/client/base_client_spec.rb
|
268
251
|
- spec/lib/pact_broker/client/can_i_deploy_spec.rb
|
269
|
-
- spec/lib/pact_broker/client/cli/
|
252
|
+
- spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb
|
253
|
+
- spec/lib/pact_broker/client/cli/broker_publish_spec.rb
|
270
254
|
- spec/lib/pact_broker/client/cli/custom_thor_spec.rb
|
271
|
-
- spec/lib/pact_broker/client/cli/publish_spec.rb
|
272
255
|
- spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb
|
273
256
|
- spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
|
274
257
|
- spec/lib/pact_broker/client/matrix_spec.rb
|
data/bin/pact-publish
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
require 'pact_broker/client/cli/custom_thor'
|
2
|
-
require 'pact_broker/client/publish_pacts'
|
3
|
-
require 'pact_broker/client/version'
|
4
|
-
require 'rake/file_list'
|
5
|
-
|
6
|
-
module PactBroker
|
7
|
-
module Client
|
8
|
-
module CLI
|
9
|
-
|
10
|
-
# Thor::Error will have its backtrace hidden
|
11
|
-
class PactPublicationError < ::Thor::Error; end
|
12
|
-
|
13
|
-
class Publish < CustomThor
|
14
|
-
desc 'PACT_DIRS_OR_FILES ...', "Publish pacts to a Pact Broker."
|
15
|
-
method_option :consumer_app_version, required: true, aliases: "-a", desc: "The consumer application version"
|
16
|
-
method_option :broker_base_url, required: true, aliases: "-b", desc: "The base URL of the Pact Broker"
|
17
|
-
method_option :broker_username, aliases: "-u", desc: "Pact Broker basic auth username"
|
18
|
-
method_option :broker_password, aliases: "-p", desc: "Pact Broker basic auth password"
|
19
|
-
method_option :tag, aliases: "-t", type: :array, banner: "TAG", desc: "Tag name for consumer version. Can be specified multiple times."
|
20
|
-
method_option :verbose, aliases: "-v", desc: "Verbose output", :required => false
|
21
|
-
|
22
|
-
def broker(*pact_files)
|
23
|
-
validate(pact_files)
|
24
|
-
success = publish_pacts(pact_files)
|
25
|
-
raise PactPublicationError, "One or more pacts failed to be published" unless success
|
26
|
-
rescue PactBroker::Client::Error => e
|
27
|
-
raise PactPublicationError, "#{e.class} - #{e.message}"
|
28
|
-
end
|
29
|
-
|
30
|
-
desc 'version', "Show the pact_broker-client gem version"
|
31
|
-
def version
|
32
|
-
$stdout.puts PactBroker::Client::VERSION
|
33
|
-
end
|
34
|
-
|
35
|
-
default_task :broker
|
36
|
-
|
37
|
-
no_commands do
|
38
|
-
|
39
|
-
def validate pact_files
|
40
|
-
unless pact_files && pact_files.any?
|
41
|
-
raise RequiredArgumentMissingError, "No value provided for required pact_files"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def publish_pacts pact_files
|
46
|
-
PactBroker::Client::PublishPacts.call(
|
47
|
-
options.broker_base_url,
|
48
|
-
file_list(pact_files),
|
49
|
-
options.consumer_app_version,
|
50
|
-
tags,
|
51
|
-
pact_broker_client_options
|
52
|
-
)
|
53
|
-
end
|
54
|
-
|
55
|
-
def file_list pact_files
|
56
|
-
Rake::FileList[pact_files].collect do | path |
|
57
|
-
if File.directory?(path)
|
58
|
-
Rake::FileList[File.join(path, "*.json")]
|
59
|
-
else
|
60
|
-
path
|
61
|
-
end
|
62
|
-
end.flatten
|
63
|
-
end
|
64
|
-
|
65
|
-
def tags
|
66
|
-
[*options.tag].compact
|
67
|
-
end
|
68
|
-
|
69
|
-
def pact_broker_client_options
|
70
|
-
if options.broker_password
|
71
|
-
{
|
72
|
-
basic_auth: {
|
73
|
-
username: options.broker_username,
|
74
|
-
password: options.broker_password
|
75
|
-
}
|
76
|
-
}
|
77
|
-
else
|
78
|
-
{}
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|