pact_broker 2.54.0 → 2.55.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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/pact_broker/api/contracts/webhook_contract.rb +6 -4
- data/lib/pact_broker/api/pact_broker_urls.rb +2 -2
- data/lib/pact_broker/api/renderers/html_pact_renderer.rb +14 -14
- data/lib/pact_broker/api/resources/pact.rb +1 -1
- data/lib/pact_broker/doc/controllers/app.rb +7 -1
- data/lib/pact_broker/doc/views/layouts/main.haml +1 -1
- data/lib/pact_broker/ui/app.rb +1 -0
- data/lib/pact_broker/ui/controllers/clusters.rb +2 -2
- data/lib/pact_broker/ui/controllers/groups.rb +3 -2
- data/lib/pact_broker/ui/controllers/index.rb +3 -2
- data/lib/pact_broker/ui/controllers/matrix.rb +5 -3
- data/lib/pact_broker/ui/helpers/url_helper.rb +4 -4
- data/lib/pact_broker/ui/view_models/index_item.rb +16 -11
- data/lib/pact_broker/ui/view_models/index_items.rb +2 -2
- data/lib/pact_broker/ui/view_models/matrix_line.rb +12 -7
- data/lib/pact_broker/ui/view_models/matrix_lines.rb +2 -2
- data/lib/pact_broker/ui/views/groups/show.html.erb +3 -3
- data/lib/pact_broker/ui/views/index/_css_and_js.haml +9 -9
- data/lib/pact_broker/ui/views/index/_navbar.haml +3 -3
- data/lib/pact_broker/ui/views/index/_pagination.haml +1 -1
- data/lib/pact_broker/ui/views/index/show-with-tags.haml +3 -3
- data/lib/pact_broker/ui/views/index/show.haml +3 -3
- data/lib/pact_broker/ui/views/layouts/main.haml +4 -4
- data/lib/pact_broker/ui/views/matrix/show.haml +10 -10
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/webhooks/service.rb +4 -3
- data/pact_broker.gemspec +1 -1
- data/public/javascripts/pact.js +7 -6
- data/script/seed.rb +1 -1
- data/spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb +1 -1
- data/vendor/hal-browser/browser.html +5 -2
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7a4ca507c57031ed0e5aa7f988f4a0826bd97c2d8904431da26052fb6884558
|
4
|
+
data.tar.gz: e700fab3146413a638120a9d73655ee5b6ae8393932223654091588e1682798c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4d48c58ceb23d1b20dfdd3e263d52c69e30355c72bc27e00795c0b11a2a56b5c9bf52034b2f0e8d2dd2d09480ac7e6a5ae474d34457de7653e381fd6518e62c
|
7
|
+
data.tar.gz: e454fa82a641873ae68221190d91c84830aa0def182d6637fca1a34a9a1aecf64a4f165221283d5850deaef1a2d5580610b0ca214b6b2885b6ebe14bdc56250e
|
data/CHANGELOG.md
CHANGED
@@ -14,11 +14,13 @@ module PactBroker
|
|
14
14
|
# I just cannot seem to get the validation to stop on the first error.
|
15
15
|
# If one rule fails, they all come back failed, and it's driving me nuts.
|
16
16
|
# Why on earth would I want that behaviour?
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
# I cannot believe I have to do this shit.
|
18
|
+
@first_errors = errors
|
19
|
+
@first_errors.messages.keys.each do | key |
|
20
|
+
@first_errors.messages[key] = @first_errors.messages[key][0...1]
|
20
21
|
end
|
21
|
-
|
22
|
+
|
23
|
+
def self.errors; @first_errors end
|
22
24
|
result
|
23
25
|
end
|
24
26
|
|
@@ -284,8 +284,8 @@ module PactBroker
|
|
284
284
|
"#{base_url}/groups/#{pacticipant_name}"
|
285
285
|
end
|
286
286
|
|
287
|
-
def hal_browser_url target_url
|
288
|
-
"/hal-browser/browser.html#" + target_url
|
287
|
+
def hal_browser_url target_url, base_url = ''
|
288
|
+
"#{base_url}/hal-browser/browser.html#" + target_url
|
289
289
|
end
|
290
290
|
|
291
291
|
def url_encode param
|
@@ -37,18 +37,18 @@ module PactBroker
|
|
37
37
|
|
38
38
|
def head
|
39
39
|
"<title>#{title}</title>
|
40
|
-
<link rel='stylesheet' type='text/css' href='/stylesheets/github.css'>
|
41
|
-
<link rel='stylesheet' type='text/css' href='/stylesheets/pact.css'>
|
42
|
-
<link rel='stylesheet' type='text/css' href='/stylesheets/github-json.css'>
|
43
|
-
<link rel='stylesheet' type='text/css' href='/css/bootstrap.min.css'>
|
44
|
-
<link rel='stylesheet' type='text/css' href='/stylesheets/material-menu.css'>
|
45
|
-
<link rel='stylesheet' type='text/css' href='/stylesheets/jquery-confirm.min.css'>
|
46
|
-
<script src='/javascripts/highlight.pack.js'></script>
|
47
|
-
<script src='/javascripts/jquery-3.3.1.min.js'></script>
|
48
|
-
<script src='/js/bootstrap.min.js'></script>
|
49
|
-
<script src='/javascripts/material-menu.js'></script>
|
50
|
-
<script src='/javascripts/pact.js'></script>
|
51
|
-
<script src='/javascripts/jquery-confirm.min.js'></script>
|
40
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/stylesheets/github.css'>
|
41
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/stylesheets/pact.css'>
|
42
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/stylesheets/github-json.css'>
|
43
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/css/bootstrap.min.css'>
|
44
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/stylesheets/material-menu.css'>
|
45
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/stylesheets/jquery-confirm.min.css'>
|
46
|
+
<script src='#{base_url}/javascripts/highlight.pack.js'></script>
|
47
|
+
<script src='#{base_url}/javascripts/jquery-3.3.1.min.js'></script>
|
48
|
+
<script src='#{base_url}/js/bootstrap.min.js'></script>
|
49
|
+
<script src='#{base_url}/javascripts/material-menu.js'></script>
|
50
|
+
<script src='#{base_url}/javascripts/pact.js'></script>
|
51
|
+
<script src='#{base_url}/javascripts/jquery-confirm.min.js'></script>
|
52
52
|
<script>hljs.initHighlightingOnLoad();</script>"
|
53
53
|
end
|
54
54
|
|
@@ -72,7 +72,7 @@ module PactBroker
|
|
72
72
|
<a href=\"#{matrix_url}\">View Matrix</a>
|
73
73
|
</li>
|
74
74
|
<li>
|
75
|
-
<a href=\"
|
75
|
+
<a href=\"#{base_url}\">Home</a>
|
76
76
|
</li>
|
77
77
|
<li>
|
78
78
|
<span data-consumer-name=\"#{@pact.consumer.name}\"
|
@@ -129,7 +129,7 @@ module PactBroker
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def json_url
|
132
|
-
PactBroker::Api::PactBrokerUrls.hal_browser_url pact_url
|
132
|
+
PactBroker::Api::PactBrokerUrls.hal_browser_url pact_url, base_url
|
133
133
|
end
|
134
134
|
|
135
135
|
def pact_url
|
@@ -100,7 +100,7 @@ module PactBroker
|
|
100
100
|
|
101
101
|
def set_post_deletion_response
|
102
102
|
latest_pact = pact_service.find_latest_pact(pact_params)
|
103
|
-
response_body = { "_links" => {} }
|
103
|
+
response_body = { "_links" => { index: { href: base_url } } }
|
104
104
|
if latest_pact
|
105
105
|
response_body["_links"]["pb:latest-pact-version"] = {
|
106
106
|
href: latest_pact_url(base_url, latest_pact),
|
@@ -33,7 +33,7 @@ module PactBroker
|
|
33
33
|
get ":rel_name" do
|
34
34
|
rel_name = params[:rel_name]
|
35
35
|
context = params[:context]
|
36
|
-
view_params = {:layout_engine => :haml, layout: :'layouts/main'}
|
36
|
+
view_params = {:layout_engine => :haml, layout: :'layouts/main', locals: { base_url: base_url }}
|
37
37
|
if resource_exists? rel_name, context
|
38
38
|
markdown view_name_for(rel_name, context).to_sym, view_params, {}
|
39
39
|
elsif resource_exists? rel_name
|
@@ -42,6 +42,12 @@ module PactBroker
|
|
42
42
|
markdown :not_found, view_params, {}
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def base_url
|
49
|
+
PactBroker.configuration.base_url || request.base_url
|
50
|
+
end
|
45
51
|
end
|
46
52
|
end
|
47
53
|
end
|
data/lib/pact_broker/ui/app.rb
CHANGED
@@ -18,8 +18,8 @@ module PactBroker
|
|
18
18
|
end
|
19
19
|
|
20
20
|
get "/" do
|
21
|
-
view_model = ViewDomain::IndexItems.new(pacticipant_service.find_index_items)
|
22
|
-
haml 'clusters/show', locals: {relationships: view_model}
|
21
|
+
view_model = ViewDomain::IndexItems.new(pacticipant_service.find_index_items, base_url: base_url)
|
22
|
+
haml 'clusters/show', locals: {relationships: view_model, base_url: base_url}
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
@@ -13,9 +13,10 @@ module PactBroker
|
|
13
13
|
pacticipant = pacticipant_service.find_pacticipant_by_name(params[:name])
|
14
14
|
erb :'groups/show.html', {
|
15
15
|
locals: {
|
16
|
-
csv_path: "/groups/#{params[:name]}.csv",
|
16
|
+
csv_path: "#{base_url}/groups/#{params[:name]}.csv",
|
17
17
|
pacticipant_name: params[:name],
|
18
|
-
repository_url: pacticipant&.repository_url
|
18
|
+
repository_url: pacticipant&.repository_url,
|
19
|
+
base_url: base_url
|
19
20
|
}
|
20
21
|
}, {
|
21
22
|
layout: 'layouts/main'
|
@@ -25,7 +25,7 @@ module PactBroker
|
|
25
25
|
|
26
26
|
# TODO remove this code when verified
|
27
27
|
options[:optimised] = true unless params[:optimised] == 'false'
|
28
|
-
index_items = ViewDomain::IndexItems.new(index_service.find_index_items(options))
|
28
|
+
index_items = ViewDomain::IndexItems.new(index_service.find_index_items(options), base_url: base_url)
|
29
29
|
|
30
30
|
page = tags ? :'index/show-with-tags' : :'index/show'
|
31
31
|
locals = {
|
@@ -34,7 +34,8 @@ module PactBroker
|
|
34
34
|
page_number: page_number,
|
35
35
|
page_size: page_size,
|
36
36
|
pagination_record_count: index_items.pagination_record_count,
|
37
|
-
current_page_size: index_items.size
|
37
|
+
current_page_size: index_items.size,
|
38
|
+
base_url: base_url
|
38
39
|
}
|
39
40
|
|
40
41
|
haml page, {locals: locals, layout: :'layouts/main'}
|
@@ -21,7 +21,8 @@ module PactBroker
|
|
21
21
|
lines: [],
|
22
22
|
title: "The Matrix",
|
23
23
|
selectors: create_selector_objects(selectors),
|
24
|
-
options: create_options_model(options)
|
24
|
+
options: create_options_model(options),
|
25
|
+
base_url: base_url
|
25
26
|
}
|
26
27
|
begin
|
27
28
|
if params[:q]
|
@@ -48,7 +49,7 @@ module PactBroker
|
|
48
49
|
selectors = [ PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: params[:consumer_name]), PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: params[:provider_name]) ]
|
49
50
|
options = {latestby: 'cvpv', limit: 100}
|
50
51
|
lines = matrix_service.find(selectors, options)
|
51
|
-
lines = PactBroker::UI::ViewDomain::MatrixLines.new(lines)
|
52
|
+
lines = PactBroker::UI::ViewDomain::MatrixLines.new(lines, base_url: base_url)
|
52
53
|
locals = {
|
53
54
|
lines: lines,
|
54
55
|
title: "The Matrix",
|
@@ -56,7 +57,8 @@ module PactBroker
|
|
56
57
|
provider_name: params[:provider_name],
|
57
58
|
selectors: create_selector_objects(selectors),
|
58
59
|
options: create_options_model(options),
|
59
|
-
badge_url: nil
|
60
|
+
badge_url: nil,
|
61
|
+
base_url: base_url
|
60
62
|
}
|
61
63
|
haml :'matrix/show', {locals: locals, layout: :'layouts/main'}
|
62
64
|
end
|
@@ -7,12 +7,12 @@ module PactBroker
|
|
7
7
|
|
8
8
|
extend self
|
9
9
|
|
10
|
-
def group_url pacticipant_name
|
11
|
-
"/groups/#{ERB::Util.url_encode(pacticipant_name)}"
|
10
|
+
def group_url pacticipant_name, base_url = ''
|
11
|
+
"#{base_url}/groups/#{ERB::Util.url_encode(pacticipant_name)}"
|
12
12
|
end
|
13
13
|
|
14
|
-
def matrix_url consumer_name, provider_name
|
15
|
-
"/matrix/provider/#{ERB::Util.url_encode(provider_name)}/consumer/#{ERB::Util.url_encode(consumer_name)}"
|
14
|
+
def matrix_url consumer_name, provider_name, base_url = ''
|
15
|
+
"#{base_url}/matrix/provider/#{ERB::Util.url_encode(provider_name)}/consumer/#{ERB::Util.url_encode(consumer_name)}"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -11,8 +11,9 @@ module PactBroker
|
|
11
11
|
|
12
12
|
include PactBroker::Api::PactBrokerUrls
|
13
13
|
|
14
|
-
def initialize relationship
|
14
|
+
def initialize relationship, options = {}
|
15
15
|
@relationship = relationship
|
16
|
+
@options = options
|
16
17
|
end
|
17
18
|
|
18
19
|
def consumer_name
|
@@ -48,23 +49,23 @@ module PactBroker
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def consumer_group_url
|
51
|
-
Helpers::URLHelper.group_url
|
52
|
+
Helpers::URLHelper.group_url(consumer_name, base_url)
|
52
53
|
end
|
53
54
|
|
54
55
|
def provider_group_url
|
55
|
-
Helpers::URLHelper.group_url
|
56
|
+
Helpers::URLHelper.group_url(provider_name, base_url)
|
56
57
|
end
|
57
58
|
|
58
59
|
def latest_pact_url
|
59
|
-
"#{pactigration_base_url(
|
60
|
+
"#{pactigration_base_url(base_url, @relationship)}/latest"
|
60
61
|
end
|
61
62
|
|
62
63
|
def pact_url
|
63
|
-
PactBroker::Api::PactBrokerUrls.pact_url(
|
64
|
+
PactBroker::Api::PactBrokerUrls.pact_url(base_url, @relationship)
|
64
65
|
end
|
65
66
|
|
66
67
|
def pact_matrix_url
|
67
|
-
Helpers::URLHelper.matrix_url
|
68
|
+
Helpers::URLHelper.matrix_url(consumer_name, provider_name, base_url)
|
68
69
|
end
|
69
70
|
|
70
71
|
def any_webhooks?
|
@@ -72,11 +73,11 @@ module PactBroker
|
|
72
73
|
end
|
73
74
|
|
74
75
|
def pact_versions_url
|
75
|
-
PactBroker::Api::PactBrokerUrls.pact_versions_url(consumer_name, provider_name)
|
76
|
+
PactBroker::Api::PactBrokerUrls.pact_versions_url(consumer_name, provider_name, base_url)
|
76
77
|
end
|
77
78
|
|
78
79
|
def integration_url
|
79
|
-
PactBroker::Api::PactBrokerUrls.integration_url(consumer_name, provider_name)
|
80
|
+
PactBroker::Api::PactBrokerUrls.integration_url(consumer_name, provider_name, base_url)
|
80
81
|
end
|
81
82
|
|
82
83
|
def webhook_label
|
@@ -114,11 +115,11 @@ module PactBroker
|
|
114
115
|
def webhook_url
|
115
116
|
url = case @relationship.webhook_status
|
116
117
|
when :none
|
117
|
-
PactBroker::Api::PactBrokerUrls.webhooks_for_consumer_and_provider_url @relationship.latest_pact.consumer, @relationship.latest_pact.provider
|
118
|
+
PactBroker::Api::PactBrokerUrls.webhooks_for_consumer_and_provider_url @relationship.latest_pact.consumer, @relationship.latest_pact.provider, base_url
|
118
119
|
else
|
119
|
-
PactBroker::Api::PactBrokerUrls.webhooks_status_url @relationship.latest_pact.consumer, @relationship.latest_pact.provider
|
120
|
+
PactBroker::Api::PactBrokerUrls.webhooks_status_url @relationship.latest_pact.consumer, @relationship.latest_pact.provider, base_url
|
120
121
|
end
|
121
|
-
|
122
|
+
PactBroker::Api::PactBrokerUrls.hal_browser_url(url, base_url)
|
122
123
|
end
|
123
124
|
|
124
125
|
def last_verified_date
|
@@ -181,6 +182,10 @@ module PactBroker
|
|
181
182
|
version_number
|
182
183
|
end
|
183
184
|
end
|
185
|
+
|
186
|
+
def base_url
|
187
|
+
@options[:base_url]
|
188
|
+
end
|
184
189
|
end
|
185
190
|
end
|
186
191
|
end
|
@@ -7,9 +7,9 @@ module PactBroker
|
|
7
7
|
|
8
8
|
attr_reader :pagination_record_count
|
9
9
|
|
10
|
-
def initialize index_items
|
10
|
+
def initialize index_items, options = {}
|
11
11
|
# Why are we sorting twice!?
|
12
|
-
@index_items = index_items.collect{ |index_item| IndexItem.new(index_item) }.sort
|
12
|
+
@index_items = index_items.collect{ |index_item| IndexItem.new(index_item, options) }.sort
|
13
13
|
# until the feature flag is turned on
|
14
14
|
@pagination_record_count = index_items.size
|
15
15
|
@pagination_record_count = index_items.pagination_record_count if index_items.respond_to?(:pagination_record_count)
|
@@ -12,8 +12,9 @@ module PactBroker
|
|
12
12
|
include PactBroker::Api::PactBrokerUrls
|
13
13
|
include PactBroker::Messages
|
14
14
|
|
15
|
-
def initialize line
|
15
|
+
def initialize line, options = {}
|
16
16
|
@line = line
|
17
|
+
@options = options
|
17
18
|
@overwritten = false # true if the pact was revised and this revision is no longer the latest
|
18
19
|
end
|
19
20
|
|
@@ -22,7 +23,7 @@ module PactBroker
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def provider_name_url
|
25
|
-
hal_browser_url(pacticipant_url_from_params(pacticipant_name: provider_name))
|
26
|
+
hal_browser_url(pacticipant_url_from_params({ pacticipant_name: provider_name }, base_url), base_url)
|
26
27
|
end
|
27
28
|
|
28
29
|
def consumer_name
|
@@ -30,7 +31,7 @@ module PactBroker
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def consumer_name_url
|
33
|
-
hal_browser_url(pacticipant_url_from_params(pacticipant_name: consumer_name))
|
34
|
+
hal_browser_url(pacticipant_url_from_params({ pacticipant_name: consumer_name }, base_url), base_url)
|
34
35
|
end
|
35
36
|
|
36
37
|
def pact_version_sha
|
@@ -68,7 +69,7 @@ module PactBroker
|
|
68
69
|
|
69
70
|
def consumer_version_number_url
|
70
71
|
params = { pacticipant_name: consumer_name, version_number: consumer_version_number }
|
71
|
-
hal_browser_url(version_url_from_params(params))
|
72
|
+
hal_browser_url(version_url_from_params(params, base_url), base_url)
|
72
73
|
end
|
73
74
|
|
74
75
|
def consumer_version_order
|
@@ -85,7 +86,7 @@ module PactBroker
|
|
85
86
|
|
86
87
|
def provider_version_number_url
|
87
88
|
params = { pacticipant_name: provider_name, version_number: provider_version_number }
|
88
|
-
hal_browser_url(version_url_from_params(params))
|
89
|
+
hal_browser_url(version_url_from_params(params, base_url), base_url)
|
89
90
|
end
|
90
91
|
|
91
92
|
def provider_version_order
|
@@ -142,7 +143,7 @@ module PactBroker
|
|
142
143
|
end
|
143
144
|
|
144
145
|
def verification_status_url
|
145
|
-
hal_browser_url(verification_url(self))
|
146
|
+
hal_browser_url(verification_url(self, base_url), base_url)
|
146
147
|
end
|
147
148
|
|
148
149
|
def pact_publication_date
|
@@ -150,7 +151,7 @@ module PactBroker
|
|
150
151
|
end
|
151
152
|
|
152
153
|
def pact_publication_date_url
|
153
|
-
pact_url(
|
154
|
+
pact_url(base_url, @line)
|
154
155
|
end
|
155
156
|
|
156
157
|
def relative_date date
|
@@ -182,6 +183,10 @@ module PactBroker
|
|
182
183
|
message("messages.matrix.pre_verified")
|
183
184
|
end
|
184
185
|
end
|
186
|
+
|
187
|
+
def base_url
|
188
|
+
@options[:base_url]
|
189
|
+
end
|
185
190
|
end
|
186
191
|
end
|
187
192
|
end
|
@@ -5,9 +5,9 @@ module PactBroker
|
|
5
5
|
module ViewDomain
|
6
6
|
class MatrixLines < Array
|
7
7
|
|
8
|
-
def initialize rows
|
8
|
+
def initialize rows, options = {}
|
9
9
|
lines = rows.collect do | row |
|
10
|
-
PactBroker::UI::ViewDomain::MatrixLine.new(row)
|
10
|
+
PactBroker::UI::ViewDomain::MatrixLine.new(row, options)
|
11
11
|
end
|
12
12
|
super(lines.sort)
|
13
13
|
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
<head>
|
6
6
|
<meta charset="utf-8">
|
7
7
|
<title>Network Graph</title>
|
8
|
-
<link rel='shortcut icon' href='
|
8
|
+
<link rel='shortcut icon' href='<%= base_url %>/favicon.ico' type='image/x-icon'/>
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
10
10
|
<meta name="description" content="">
|
11
11
|
<meta name="author" content="Duncan Alexander">
|
12
|
-
<script type="text/javascript" src="
|
12
|
+
<script type="text/javascript" src="<%= base_url %>/javascripts/d3.v3.js.pagespeed.ce.dFNRrGTALe.js"></script>
|
13
13
|
<style>
|
14
14
|
body{
|
15
15
|
font-family:"Helvetica Neue",Arial,sans-serif;
|
@@ -105,7 +105,7 @@ var relationshipPath = function(relationship, nodeLocations, pacticipants) {
|
|
105
105
|
|
106
106
|
var latestPactUrl = function (consumerName, providerName) {
|
107
107
|
//TODO send this with the relationship data
|
108
|
-
return '
|
108
|
+
return '<%= base_url %>/pacts/provider/' + providerName + '/consumer/' + consumerName + '/latest';
|
109
109
|
};
|
110
110
|
|
111
111
|
var relationshipData = function(pacticipant, relationships) {
|
@@ -1,9 +1,9 @@
|
|
1
|
-
%link{rel: 'stylesheet', href:
|
2
|
-
%link{rel: 'stylesheet', href:
|
3
|
-
%link{rel: 'stylesheet', href:
|
4
|
-
%link{rel: 'stylesheet', href:
|
5
|
-
%script{type: 'text/javascript', src:
|
6
|
-
%script{type: 'text/javascript', src:
|
7
|
-
%script{type: 'text/javascript', src:
|
8
|
-
%script{type: 'text/javascript', src:
|
9
|
-
%script{type: 'text/javascript', src:
|
1
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/index.css"}
|
2
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/material-menu.css"}
|
3
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/material-icon.css"}
|
4
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/jquery-confirm.min.css"}
|
5
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/jquery.tablesorter.min.js"}
|
6
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/material-menu.js"}
|
7
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/index.js"}
|
8
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/clipboard.js"}
|
9
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/jquery-confirm.min.js"}
|
@@ -4,11 +4,11 @@
|
|
4
4
|
%ul.navbar-right#top-left-menu
|
5
5
|
%li
|
6
6
|
- if tag_toggle
|
7
|
-
%a{href:
|
7
|
+
%a{href: "#{base_url}?tags=true"}
|
8
8
|
Show latest tags
|
9
9
|
- else
|
10
|
-
%a{href:
|
10
|
+
%a{href: "#{base_url}"}
|
11
11
|
Hide latest tags
|
12
12
|
|
13
|
-
%a{href:
|
13
|
+
%a{href: "#{base_url}/hal-browser/browser.html"}
|
14
14
|
API Browser
|
@@ -1,7 +1,7 @@
|
|
1
1
|
%body
|
2
2
|
= render :haml, :'index/_css_and_js', :layout => false
|
3
3
|
.container
|
4
|
-
= render :haml, :'index/_navbar', :layout => false, locals: {tag_toggle: false}
|
4
|
+
= render :haml, :'index/_navbar', :layout => false, locals: {tag_toggle: false, base_url: base_url}
|
5
5
|
- if index_items.empty?
|
6
6
|
= render :haml, :'index/_getting-started', :layout => false
|
7
7
|
%h1.page-header
|
@@ -96,8 +96,8 @@
|
|
96
96
|
$(document).ready(function(){
|
97
97
|
initializeClipper(".clippable");
|
98
98
|
|
99
|
-
$("span.pact a").load("/images/doc-text.svg");
|
100
|
-
$("span.pact-matrix a").load("/images/doc-matrix.svg");
|
99
|
+
$("span.pact a").load("#{base_url}/images/doc-text.svg");
|
100
|
+
$("span.pact-matrix a").load("#{base_url}/images/doc-matrix.svg");
|
101
101
|
$('td[data-toggle="tooltip"]').each(function(index, td){
|
102
102
|
//appended tooltip div screws up table if it's appended after a
|
103
103
|
//td, so need to append it to a div
|
@@ -1,7 +1,7 @@
|
|
1
1
|
%body
|
2
2
|
= render :haml, :'index/_css_and_js', :layout => false
|
3
3
|
.container
|
4
|
-
= render :haml, :'index/_navbar', :layout => false, locals: {tag_toggle: true}
|
4
|
+
= render :haml, :'index/_navbar', :layout => false, locals: {tag_toggle: true, base_url: base_url}
|
5
5
|
- if index_items.empty?
|
6
6
|
= render :haml, :'index/_getting-started', :layout => false
|
7
7
|
%h1.page-header
|
@@ -67,8 +67,8 @@
|
|
67
67
|
});
|
68
68
|
|
69
69
|
$(document).ready(function(){
|
70
|
-
$("span.pact a").load("/images/doc-text.svg");
|
71
|
-
$("span.pact-matrix a").load("/images/doc-matrix.svg");
|
70
|
+
$("span.pact a").load("#{base_url}/images/doc-text.svg");
|
71
|
+
$("span.pact-matrix a").load("#{base_url}/images/doc-matrix.svg");
|
72
72
|
$('td[data-toggle="tooltip"]').each(function(index, td){
|
73
73
|
//appended tooltip div screws up table if it's appended after a
|
74
74
|
//td, so need to append it to a div
|
@@ -2,8 +2,8 @@
|
|
2
2
|
%html
|
3
3
|
%head
|
4
4
|
%title= defined?(title) ? title : ""
|
5
|
-
%link{rel: 'shortcut icon', href:
|
6
|
-
%link{rel: 'stylesheet', href:
|
7
|
-
%script{type: 'text/javascript', src:
|
8
|
-
%script{type: 'text/javascript', src:
|
5
|
+
%link{rel: 'shortcut icon', href: "#{base_url}/images/favicon.ico", type:'image/x-icon'}
|
6
|
+
%link{rel: 'stylesheet', href: "#{base_url}/css/bootstrap.min.css"}
|
7
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/jquery-3.3.1.min.js"}
|
8
|
+
%script{type: 'text/javascript', src:"#{base_url}/js/bootstrap.min.js"}
|
9
9
|
= yield
|
@@ -1,16 +1,16 @@
|
|
1
1
|
%body
|
2
|
-
%link{rel: 'stylesheet', href:
|
3
|
-
%link{rel: 'stylesheet', href:
|
4
|
-
%link{rel: 'stylesheet', href:
|
5
|
-
%script{type: 'text/javascript', src:
|
6
|
-
%script{type: 'text/javascript', src:
|
7
|
-
%script{type: 'text/javascript', src:
|
8
|
-
%script{type: 'text/javascript', src:
|
9
|
-
%script{type: 'text/javascript', src:
|
2
|
+
%link{rel: 'stylesheet', href: "#{base_url}/css/bootstrap.min.css"}
|
3
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/index.css"}
|
4
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/matrix.css"}
|
5
|
+
%script{type: 'text/javascript', src: "#{base_url}/javascripts/jquery-3.3.1.min.js"}
|
6
|
+
%script{type: 'text/javascript', src: "#{base_url}/javascripts/jquery.tablesorter.min.js"}
|
7
|
+
%script{type: 'text/javascript', src: "#{base_url}/javascripts/matrix.js"}
|
8
|
+
%script{type: 'text/javascript', src: "#{base_url}/javascripts/clipboard.js"}
|
9
|
+
%script{type: 'text/javascript', src: "#{base_url}/js/bootstrap.min.js"}
|
10
10
|
|
11
11
|
.container
|
12
12
|
.navbar-right
|
13
|
-
%a{href:
|
13
|
+
%a{href: base_url}
|
14
14
|
Home
|
15
15
|
%h1.page-header
|
16
16
|
= title
|
@@ -23,7 +23,7 @@
|
|
23
23
|
= escape_html(error)
|
24
24
|
|
25
25
|
|
26
|
-
%form{action:
|
26
|
+
%form{action: "#{base_url}/matrix", onsubmit:'return onSubmit()'}
|
27
27
|
- selectors.each_with_index do | selector, index |
|
28
28
|
.selector
|
29
29
|
%label{for: "pacticipant#{index}"}
|
data/lib/pact_broker/version.rb
CHANGED
@@ -40,12 +40,13 @@ module PactBroker
|
|
40
40
|
def self.errors webhook, uuid = nil
|
41
41
|
contract = PactBroker::Api::Contracts::WebhookContract.new(webhook)
|
42
42
|
contract.validate(webhook.attributes)
|
43
|
-
|
43
|
+
messages = contract.errors.messages
|
44
44
|
|
45
45
|
if uuid && !valid_uuid_format?(uuid)
|
46
|
-
|
46
|
+
messages["uuid"] = [message("errors.validation.invalid_webhook_uuid")]
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
|
+
OpenStruct.new(messages: messages, empty?: messages.empty?, any?: messages.any?)
|
49
50
|
end
|
50
51
|
|
51
52
|
def self.create uuid, webhook, consumer, provider
|
data/pact_broker.gemspec
CHANGED
@@ -46,7 +46,7 @@ Gem::Specification.new do |gem|
|
|
46
46
|
gem.add_runtime_dependency 'httparty', '~> 0.14'
|
47
47
|
gem.add_runtime_dependency 'json', '~> 2.3'
|
48
48
|
gem.add_runtime_dependency 'roar', '~> 1.1'
|
49
|
-
gem.add_runtime_dependency 'reform', '~> 2.2'
|
49
|
+
gem.add_runtime_dependency 'reform', '~> 2.3','>= 2.3.1'
|
50
50
|
gem.add_runtime_dependency 'dry-validation', '~> 0.10.5'
|
51
51
|
gem.add_runtime_dependency 'sequel', '~> 5.28'
|
52
52
|
gem.add_runtime_dependency 'webmachine', '1.5.0'
|
data/public/javascripts/pact.js
CHANGED
@@ -74,7 +74,7 @@ function promptToDeleteResource(deletionUrl, confirmationText) {
|
|
74
74
|
confirmDeleteResource(confirmationText, confirmed, cancelled);
|
75
75
|
}
|
76
76
|
|
77
|
-
function createWhereToNextConfirmationConfiguration(latestPactUrl) {
|
77
|
+
function createWhereToNextConfirmationConfiguration(latestPactUrl, indexUrl) {
|
78
78
|
return {
|
79
79
|
title: "Pact deleted",
|
80
80
|
content: "Where to next?",
|
@@ -89,14 +89,14 @@ function createWhereToNextConfirmationConfiguration(latestPactUrl) {
|
|
89
89
|
home: {
|
90
90
|
text: "Home",
|
91
91
|
action: function() {
|
92
|
-
window.location.href =
|
92
|
+
window.location.href = indexUrl;
|
93
93
|
}
|
94
94
|
}
|
95
95
|
}
|
96
96
|
};
|
97
97
|
}
|
98
98
|
|
99
|
-
function createAllPactsDeletedConfirmationConfiguration() {
|
99
|
+
function createAllPactsDeletedConfirmationConfiguration(indexUrl) {
|
100
100
|
return {
|
101
101
|
title: "Pact deleted",
|
102
102
|
content: "All versions of this pact have now been deleted.",
|
@@ -104,7 +104,7 @@ function createAllPactsDeletedConfirmationConfiguration() {
|
|
104
104
|
home: {
|
105
105
|
text: "Home",
|
106
106
|
action: function() {
|
107
|
-
window.location.href =
|
107
|
+
window.location.href = indexUrl;
|
108
108
|
}
|
109
109
|
}
|
110
110
|
}
|
@@ -115,11 +115,12 @@ function handleDeletionSuccess(responseBody) {
|
|
115
115
|
if (responseBody._links["pb:latest-pact-version"]) {
|
116
116
|
$.confirm(
|
117
117
|
createWhereToNextConfirmationConfiguration(
|
118
|
-
responseBody._links["pb:latest-pact-version"].href
|
118
|
+
responseBody._links["pb:latest-pact-version"].href,
|
119
|
+
responseBody._links["index"].href
|
119
120
|
)
|
120
121
|
);
|
121
122
|
} else {
|
122
|
-
$.confirm(createAllPactsDeletedConfirmationConfiguration());
|
123
|
+
$.confirm(createAllPactsDeletedConfirmationConfiguration(responseBody._links["index"].href));
|
123
124
|
}
|
124
125
|
}
|
125
126
|
|
data/script/seed.rb
CHANGED
@@ -59,7 +59,7 @@ TestDataBuilder.new
|
|
59
59
|
body: webhook_body.to_json)
|
60
60
|
.set_now(Date.today - 101)
|
61
61
|
.tap{ | it |
|
62
|
-
|
62
|
+
2.times do | i |
|
63
63
|
it.create_pact_with_verification("Foo", i.to_s, "Bar", i.to_s)
|
64
64
|
.create_pact_with_verification("Bar", i.to_s, "Foo", i.to_s)
|
65
65
|
.add_day
|
@@ -56,7 +56,7 @@ module PactBroker
|
|
56
56
|
expect(subject).to include("<html>")
|
57
57
|
expect(subject).to include("</html>")
|
58
58
|
expect(subject).to include("<link rel='stylesheet'")
|
59
|
-
expect(subject).to include("href='/stylesheets/github.css'")
|
59
|
+
expect(subject).to include("href='http://base/stylesheets/github.css'")
|
60
60
|
expect(subject).to include('<pre><code')
|
61
61
|
expect(subject).to include('"method":')
|
62
62
|
expect(subject).to match /<h\d>.*Some Consumer/
|
@@ -26,7 +26,7 @@
|
|
26
26
|
<ul class="nav">
|
27
27
|
<li><a href="#/" id="entryPointLink">Go To Entry Point</a></li>
|
28
28
|
<li><a href="https://github.com/mikekelly/hal-browser">About The HAL Browser</a></li>
|
29
|
-
<li><a href="/">Pact Broker Home</a></li> <!-- pact_broker -->
|
29
|
+
<li><a href="/" id="pactBrokerHomeLink">Pact Broker Home</a></li> <!-- pact_broker -->
|
30
30
|
</ul>
|
31
31
|
</div>
|
32
32
|
</div>
|
@@ -251,10 +251,13 @@ Content-Type: application/json
|
|
251
251
|
<script src="js/hal/views/documentation.js"></script>
|
252
252
|
|
253
253
|
<script>
|
254
|
+
var baseUrl = window.location.href.split('/hal-browser/')[0]; //pact_broker
|
254
255
|
var browser = new HAL.Browser({
|
255
256
|
container: $('#browser'),
|
256
|
-
entryPoint:
|
257
|
+
entryPoint: baseUrl //pact_broker
|
257
258
|
});
|
258
259
|
Backbone.history.start();
|
260
|
+
|
261
|
+
$('#pactBrokerHomeLink').attr('href', baseUrl); //pact_broker
|
259
262
|
</script>
|
260
263
|
</body>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact_broker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.55.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bethany Skurrie
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-05-
|
13
|
+
date: 2020-05-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
@@ -60,14 +60,20 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '2.
|
63
|
+
version: '2.3'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.3.1
|
64
67
|
type: :runtime
|
65
68
|
prerelease: false
|
66
69
|
version_requirements: !ruby/object:Gem::Requirement
|
67
70
|
requirements:
|
68
71
|
- - "~>"
|
69
72
|
- !ruby/object:Gem::Version
|
70
|
-
version: '2.
|
73
|
+
version: '2.3'
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 2.3.1
|
71
77
|
- !ruby/object:Gem::Dependency
|
72
78
|
name: dry-validation
|
73
79
|
requirement: !ruby/object:Gem::Requirement
|