pact_broker 2.12.0 → 2.13.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 +42 -5
- data/README.md +13 -8
- data/bethtest.rb +21 -94
- data/db/migrations/20171112_add_test_results.rb +7 -0
- data/db/migrations/20171117_create_webhook_events.rb +14 -0
- data/db/migrations/20171118_create_webhook_events.rb +18 -0
- data/db/migrations/20180108_create_certificates_table.rb +14 -0
- data/db/migrations/20180109_migrate_trigger_type.rb +9 -0
- data/db/pact_broker_database.sqlite3 +0 -0
- data/db/test/backwards_compatibility/gemfiles/1.18.0.gemfile.lock +5 -5
- data/db/test/backwards_compatibility/gemfiles/2.0.0.gemfile.lock +5 -5
- data/db/test/backwards_compatibility/gemfiles/2.1.0.gemfile.lock +5 -5
- data/db/test/backwards_compatibility/gemfiles/2.2.0.gemfile.lock +12 -14
- data/db/test/backwards_compatibility/gemfiles/2.3.0.gemfile.lock +12 -14
- data/db/test/backwards_compatibility/gemfiles/2.4.2.gemfile.lock +12 -14
- data/db/test/backwards_compatibility/gemfiles/2.5.1.gemfile.lock +12 -14
- data/db/test/backwards_compatibility/gemfiles/2.6.0.gemfile.lock +12 -14
- data/db/test/backwards_compatibility/gemfiles/head.gemfile.lock +16 -15
- data/db/test/change_migration_strategy/before/Gemfile +1 -0
- data/example/README.md +65 -0
- data/example/config.ru +1 -0
- data/example/example_data.sql +17 -0
- data/lib/pact_broker/api.rb +1 -1
- data/lib/pact_broker/api/contracts/webhook_contract.rb +9 -1
- data/lib/pact_broker/api/decorators/verification_decorator.rb +1 -0
- data/lib/pact_broker/api/decorators/webhook_decorator.rb +35 -5
- data/lib/pact_broker/api/resources/matrix_badge.rb +21 -0
- data/lib/pact_broker/certificates/certificate.rb +8 -0
- data/lib/pact_broker/certificates/service.rb +41 -0
- data/lib/pact_broker/doc/controllers/app.rb +12 -2
- data/lib/pact_broker/doc/views/webhooks.markdown +37 -2
- data/lib/pact_broker/domain/verification.rb +2 -0
- data/lib/pact_broker/domain/webhook.rb +2 -1
- data/lib/pact_broker/domain/webhook_request.rb +22 -4
- data/lib/pact_broker/error.rb +5 -0
- data/lib/pact_broker/matrix/parse_query.rb +7 -10
- data/lib/pact_broker/matrix/repository.rb +5 -32
- data/lib/pact_broker/matrix/service.rb +21 -3
- data/lib/pact_broker/pacts/repository.rb +9 -2
- data/lib/pact_broker/pacts/service.rb +2 -2
- data/lib/pact_broker/services.rb +5 -0
- data/lib/pact_broker/ui/app.rb +15 -0
- data/lib/pact_broker/ui/controllers/matrix.rb +58 -3
- data/lib/pact_broker/ui/views/matrix/show.haml +65 -10
- data/lib/pact_broker/verifications/service.rb +6 -1
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/webhooks/job.rb +1 -1
- data/lib/pact_broker/webhooks/repository.rb +17 -0
- data/lib/pact_broker/webhooks/service.rb +8 -7
- data/lib/pact_broker/webhooks/triggered_webhook.rb +1 -1
- data/lib/pact_broker/webhooks/webhook.rb +3 -0
- data/lib/pact_broker/webhooks/webhook_event.rb +24 -0
- data/pact_broker.gemspec +2 -1
- data/public/javascripts/matrix.js +60 -0
- data/public/stylesheets/matrix.css +12 -0
- data/script/db-spec.sh +1 -0
- data/script/foo-bar-verification.json +57 -0
- data/script/insert-self-signed-certificate-from-url.rb +32 -0
- data/script/publish-verification.sh +5 -0
- data/script/seed-matrix.rb +6 -5
- data/script/seed.rb +67 -59
- data/spec/features/create_webhook_spec.rb +4 -1
- data/spec/features/get_matrix_badge_spec.rb +40 -0
- data/spec/features/publish_verification_spec.rb +28 -4
- data/spec/fixtures/certificate-invalid.pem +29 -0
- data/spec/fixtures/certificate.pem +53 -0
- data/spec/fixtures/certificates/cacert.pem +21 -0
- data/spec/fixtures/certificates/cert.pem +20 -0
- data/spec/fixtures/certificates/key.pem +27 -0
- data/spec/fixtures/certificates/self-signed.badssl.com.pem +21 -0
- data/spec/fixtures/verification.json +4 -1
- data/spec/fixtures/webhook_valid.json +3 -0
- data/spec/integration/webhooks/certificate_spec.rb +80 -0
- data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +20 -0
- data/spec/lib/pact_broker/api/decorators/pact_webhooks_status_decorator_spec.rb +2 -2
- data/spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb +5 -0
- data/spec/lib/pact_broker/api/decorators/verification_summary_decorator_spec.rb +1 -0
- data/spec/lib/pact_broker/api/decorators/webhook_decorator_spec.rb +29 -19
- data/spec/lib/pact_broker/api/resources/badge_spec.rb +61 -0
- data/spec/lib/pact_broker/api/resources/matrix_badge_spec.rb +11 -0
- data/spec/lib/pact_broker/api/resources/pact_webhooks_spec.rb +8 -9
- data/spec/lib/pact_broker/certificates/service_spec.rb +60 -0
- data/spec/lib/pact_broker/domain/verification_spec.rb +13 -0
- data/spec/lib/pact_broker/domain/webhook_request_spec.rb +0 -4
- data/spec/lib/pact_broker/matrix/service_spec.rb +40 -8
- data/spec/lib/pact_broker/pacts/repository_spec.rb +18 -1
- data/spec/lib/pact_broker/webhooks/job_spec.rb +1 -1
- data/spec/lib/pact_broker/webhooks/repository_spec.rb +53 -13
- data/spec/lib/pact_broker/webhooks/service_spec.rb +9 -6
- data/spec/migrations/change_migration_strategy_spec.rb +13 -14
- data/spec/spec_helper.rb +4 -0
- data/spec/support/ssl_webhook_server.rb +37 -0
- data/spec/support/test_data_builder.rb +12 -4
- data/tasks/database.rb +9 -7
- data/tasks/database/table_dependency_calculator.rb +44 -0
- metadata +57 -6
- data/lib/pact_broker/doc/views/pact-webhooks.markdown +0 -50
- data/lib/pact_broker/doc/views/webhooks-create.markdown +0 -38
- data/lib/pact_broker/doc/views/webhooks-webhooks.markdown +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7427bd8d5ba4ffcaead942be481675c3a275774
|
4
|
+
data.tar.gz: 86b168d56a8937c4b4461fee9a21f6d4af626c33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddd1b99c2162ab7d736f5680c779b1f733c34841959f8803e6289eabdfb9a8d2840188b9af7ab643cf57f86d29a5130ef490a09954db36c001f564c2d6edc10c
|
7
|
+
data.tar.gz: fec0eaa9e4d5f661e3962010cbe87a22db04de9fdd17bcf46adb8653286bd6f0a3e54c31b5e3be651a21acc40f15013c4ff549efd7b6ed0cc608456c7c1fe4f9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,40 @@
|
|
1
|
+
<a name="v2.13.0"></a>
|
2
|
+
### v2.13.0 (2018-01-11)
|
3
|
+
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* ensure latest pact version is returned when searching by pact version sha ([1d2adc6](/../../commit/1d2adc6))
|
8
|
+
* rename 'pact_publication' trigger type to 'publication' ([9fe0ff0](/../../commit/9fe0ff0))
|
9
|
+
|
10
|
+
* **certificates**
|
11
|
+
* load webhook certificates from database ([c72ab28](/../../commit/c72ab28))
|
12
|
+
|
13
|
+
* **matrix ui**
|
14
|
+
* add checkbox for latest version ([7743ecc](/../../commit/7743ecc))
|
15
|
+
* add limit and latestby to form ([c4136bd](/../../commit/c4136bd))
|
16
|
+
* do not log validation errors ([f201d1d](/../../commit/f201d1d))
|
17
|
+
* add form ([cbf0837](/../../commit/cbf0837))
|
18
|
+
|
19
|
+
* **matrix badges**
|
20
|
+
* add badge for provider/tag and consumer/tag ([d69c8e6](/../../commit/d69c8e6))
|
21
|
+
|
22
|
+
* **verification webhooks**
|
23
|
+
* update hal browser documentation ([c2b31b4](/../../commit/c2b31b4))
|
24
|
+
* invoke verification webhooks on publication of verification ([04ed1cc](/../../commit/04ed1cc))
|
25
|
+
* alter logic to select only the relevant webhooks when the pact has changed ([ec18943](/../../commit/ec18943))
|
26
|
+
* default to contract changed event when no events specified, for backwards compatibility ([9fe8d47](/../../commit/9fe8d47))
|
27
|
+
* add events to webhooks to allow differentiation between pact and verification webhooks ([356c023](/../../commit/356c023))
|
28
|
+
|
29
|
+
* **publish test result**
|
30
|
+
* allow json test results to be published with the verification result ([528034c](/../../commit/528034c))
|
31
|
+
|
32
|
+
|
33
|
+
#### Bug Fixes
|
34
|
+
|
35
|
+
* create selector objects when viewing matrix URL with consumer and provider ([e733bae](/../../commit/e733bae))
|
36
|
+
|
37
|
+
|
1
38
|
<a name="v2.12.0"></a>
|
2
39
|
### v2.12.0 (2017-11-29)
|
3
40
|
|
@@ -343,9 +380,9 @@
|
|
343
380
|
* 7c17c62 - Required at least ruby-2.2.0 as we move along ruby release schedule. (Tan Le, Mon Apr 24 22:54:52 2017 +1000)
|
344
381
|
|
345
382
|
#### 1.16.0 (2017-04-10)
|
346
|
-
* 990575f - Added HTML content type for request to get a specific version of a pact. As per request in https://github.com/
|
383
|
+
* 990575f - Added HTML content type for request to get a specific version of a pact. As per request in https://github.com/pact-foundation/pact_broker/issues/82 (Beth Skurrie, Mon Apr 10 15:34:28 2017 +1000)
|
347
384
|
* b47b8d8 - Use /versions rather than /version in test endpoint. Singular will be deprecated. (Beth Skurrie, Fri Apr 7 16:03:19 2017 +1000)
|
348
|
-
* dd4daee - Removed version restriction for pact_broker gem in the example Gemfile. This will avoid a repetition of the twisted dependencies fixed by https://github.com/
|
385
|
+
* dd4daee - Removed version restriction for pact_broker gem in the example Gemfile. This will avoid a repetition of the twisted dependencies fixed by https://github.com/pact-foundation/pact_broker/pull/84 (Beth Skurrie, Tue Apr 4 09:53:39 2017 +1000)
|
349
386
|
* e447b3f - Updated sqlite database. (Beth Skurrie, Mon Apr 3 08:25:41 2017 +1000)
|
350
387
|
* 149efc0 - Update REAME to reflect 2.4 support. (Tan Le, Fri Mar 31 21:42:47 2017 +1100)
|
351
388
|
|
@@ -373,7 +410,7 @@
|
|
373
410
|
* cdfa17b - upgrade default sqlite db to current migration level (Bo Daley, Wed Nov 30 14:37:54 2016 -0500)
|
374
411
|
|
375
412
|
#### 1.11.2 (2016-11-25)
|
376
|
-
* 43f2373 - Added require to hopefully fix broken build. https://travis-ci.org/
|
413
|
+
* 43f2373 - Added require to hopefully fix broken build. https://travis-ci.org/pact-foundation/pact_broker/jobs/174397806 (Bethany Skurrie, Thu Nov 24 07:47:07 2016 +1100)
|
377
414
|
* f747e09 - Removed ruby 2.1 build as it is failing (Beth Skurrie, Wed Nov 9 13:42:08 2016 +1100)
|
378
415
|
* 2dd77a5 - Added extra pact version to example database so that the diff feature could be explored. (Beth, Wed Nov 9 10:07:33 2016 +1100)
|
379
416
|
* 5c04c59 - Updated trailblazer gem to ~>0.3.0 and fixed pact diff spec. (Beth, Wed Nov 9 10:05:53 2016 +1100)
|
@@ -431,7 +468,7 @@
|
|
431
468
|
* 7ea3e61 - Update pact_broker.gemspec (Beth Skurrie, Tue Jul 14 09:02:30 2015 +1000)
|
432
469
|
* f299cfd - Added logging for publishing and deleting pacts (Beth Skurrie, Wed Jul 8 16:00:58 2015 +1000)
|
433
470
|
* 67f0edb - Log error when contract cannot be parsed to a Pact (Beth Skurrie, Wed Jul 8 15:54:29 2015 +1000)
|
434
|
-
* 57caf63 - Double ensure that tables are created with UTF-8 encoding https://github.com/
|
471
|
+
* 57caf63 - Double ensure that tables are created with UTF-8 encoding https://github.com/pact-foundation/pact_broker/issues/24 (Beth Skurrie, Fri Jul 3 15:46:46 2015 +1000)
|
435
472
|
|
436
473
|
#### 1.8.1 (2015-06-30)
|
437
474
|
|
@@ -481,7 +518,7 @@
|
|
481
518
|
|
482
519
|
#### 1.3.2.rc1 (2014-12-03)
|
483
520
|
|
484
|
-
* a2413f4 - Stop Padrino trying to create a log file in the gem directory https://github.com/
|
521
|
+
* a2413f4 - Stop Padrino trying to create a log file in the gem directory https://github.com/pact-foundation/pact_broker/issues/13 (Beth, Wed Dec 3 13:16:06 2014 +1100)
|
485
522
|
* abf9459 - Added DELETE endpoint for pact resource (Beth, Wed Nov 19 17:45:34 2014 +1100)
|
486
523
|
* 1d01937 - Set default encoding to utf-8 in example app. This is required for the sha foreign key to work between the pact table and the pact_version_content table. (Beth, Tue Nov 18 22:35:51 2014 +1100)
|
487
524
|
* 9e3401e - Save all the space! Reuse the same pact_version_content when one with the same sha1 already exists in the database. (Beth, Tue Nov 18 20:27:59 2014 +1100)
|
data/README.md
CHANGED
@@ -111,13 +111,14 @@ Use the HAL browser to view documentation as you browse.
|
|
111
111
|
* unix users just use your package manager
|
112
112
|
* Run `git clone git@github.com:pact-foundation/pact_broker.git && cd pact_broker/example`
|
113
113
|
* Run `bundle install`
|
114
|
-
* Run `bundle exec rackup -p 8080`
|
114
|
+
* Run `bundle exec rackup -p 8080` (this will use a Sqlite database. If you want to try it out with a Postgres database, see the [README](https://github.com/pact-foundation/pact_broker/tree/master/example) in the example directory.)
|
115
115
|
* Open [http://localhost:8080](http://localhost:8080) and you should see a list containing the pact between the Zoo App and the Animal Service.
|
116
116
|
* Click on the arrow to see the generated HTML documentation.
|
117
117
|
* Click on either service to see an autogenerated network diagram.
|
118
118
|
* Click on the HAL Browser link to have a poke around the API.
|
119
119
|
* Click on the book icon under "docs" to view documentation related to a given relation.
|
120
120
|
|
121
|
+
|
121
122
|
### For reals
|
122
123
|
|
123
124
|
#### Hosted
|
@@ -126,17 +127,20 @@ In a hurry? Hate having to run your own infrastructure? Check out the [Hosted Pa
|
|
126
127
|
|
127
128
|
#### Container solutions
|
128
129
|
|
129
|
-
You can use the [Pact Broker Docker
|
130
|
+
You can use the [Pact Broker Docker image][docker] or [Terraform on AWS][terraform]
|
130
131
|
|
131
132
|
#### Rolling your own
|
132
133
|
|
134
|
+
* Are you sure you don't just want to use the [Pact Broker Docker image][docker]? No Docker at your company yet? Ah well, keep reading.
|
133
135
|
* Create a PostgreSQL (recommended) or MySQL (not recommended, see following note) database.
|
134
|
-
* __Note:__ It is recommended to use __PostgreSQL__ as it will support JSON search features that are planned in the future, however MySQL the other [semi supported](https://github.com/pact-foundation/pact_broker/issues/33) database.
|
135
|
-
*
|
136
|
-
*
|
136
|
+
* __Note:__ It is recommended to use __PostgreSQL__ as it will support JSON search features that are planned in the future, however MySQL the other [semi supported](https://github.com/pact-foundation/pact_broker/issues/33) database.
|
137
|
+
* Check the [travis.yml][travisyml] file to make sure you're using the version of the database that we're currently running our tests against.
|
138
|
+
* If you're using PostgreSQL (did we mention this was _recommended!_) you'll find the database creation script in the [example/config.ru](https://github.com/pact-foundation/pact_broker/blob/master/example/config.ru).
|
139
|
+
* Install ruby 2.2.0 or later and bundler >= 1.12.0 (if you've come this far, I'm assuming you know how to do both of these. Did I mention there was a [Docker][docker] image?)
|
140
|
+
* Copy the [pact\_broker](https://github.com/DiUS/pact_broker-docker/tree/master/pact_broker) directory from the Pact Broker Docker project. This will have the recommended settings for database connections, logging, basic auth etc. Note that the Docker image uses Phusion Passenger as the web application server in front of the Pact Broker Ruby application, which is the recommended set up.
|
137
141
|
* Modify the config.ru and Gemfile as desired (eg. choose database driver gem, set your database credentials. Use the "pg" gem if using Postgres and the "mysql2" gem if using MySQL)
|
138
142
|
* Please ensure you use `encoding: 'utf8'` in your Sequel options to avoid encoding issues.
|
139
|
-
* For production usage, use a web application server like [Phusion Passenger](https://www.phusionpassenger.com) or [Nginx](http://nginx.org/) to serve the Pact Broker application.
|
143
|
+
* For production usage, use a web application server like [Phusion Passenger](https://www.phusionpassenger.com) or [Nginx](http://nginx.org/) to serve the Pact Broker application. You'll need to read up on the documentation for these yourself as it is beyond the scope of this documentation.
|
140
144
|
* Deploy to your location of choice.
|
141
145
|
|
142
146
|
## Upgrading
|
@@ -144,9 +148,9 @@ You can use the [Pact Broker Docker container][docker] or [Terraform on AWS][ter
|
|
144
148
|
Please read the [UPGRADING.md](UPGRADING.md) documentation before upgrading your Pact Broker, for information on the supported upgrade paths.
|
145
149
|
|
146
150
|
[decouple]: http://techblog.realestate.com.au/enter-the-pact-matrix-or-how-to-decouple-the-release-cycles-of-your-microservices/
|
147
|
-
[pact]: https://github.com/
|
151
|
+
[pact]: https://github.com/pact-foundation/pact-ruby
|
148
152
|
[nerf]: https://github.com/pact-foundation/pact_broker/wiki/pact-broker-ci-nerf-gun
|
149
|
-
[different-teams]: https://github.com/
|
153
|
+
[different-teams]: https://github.com/pact-foundation/pact-ruby/wiki/Using-pact-where-the-consumer-team-is-different-from-the-provider-team
|
150
154
|
[docker]: https://hub.docker.com/r/dius/pact-broker
|
151
155
|
[terraform]: https://github.com/nadnerb/terraform-pact-broker
|
152
156
|
[hosted]: https://pact.dius.com.au/?utm_source=github&utm_campaign=GITHUB_BROKER&utm_medium=github
|
@@ -157,3 +161,4 @@ Please read the [UPGRADING.md](UPGRADING.md) documentation before upgrading your
|
|
157
161
|
[issues]: https://github.com/pact-foundation/pact_broker/issues
|
158
162
|
[pact-docs]: http://docs.pact.io
|
159
163
|
[cli]: https://github.com/pact-foundation/pact-ruby-standalone/releases
|
164
|
+
[travisyml]: https://github.com/pact-foundation/pact_broker/blob/master/.travis.yml
|
data/bethtest.rb
CHANGED
@@ -1,103 +1,30 @@
|
|
1
|
-
require '
|
1
|
+
require 'openssl'
|
2
|
+
require 'uri'
|
3
|
+
require 'net/http'
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
@from = from
|
6
|
-
@to = to
|
7
|
-
end
|
5
|
+
uri = URI('https://self-signed.badssl.com')
|
6
|
+
downloaded_cert_path = '/tmp/downloaded_cert.pem'
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
puts `openssl s_client -showcerts -servername #{uri.host} -connect #{uri.host}:#{uri.port} </dev/null 2>/dev/null|openssl x509 -text`
|
9
|
+
command = "openssl s_client -showcerts -servername #{uri.host} -connect #{uri.host}:#{uri.port} </dev/null 2>/dev/null|openssl x509 -outform PEM > #{downloaded_cert_path}"
|
10
|
+
puts command
|
11
|
+
puts `#{command}`
|
12
12
|
|
13
|
-
def connected? other
|
14
|
-
(self.to_a & other.to_a).any?
|
15
|
-
end
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
cert_store = OpenSSL::X509::Store.new
|
15
|
+
puts "Adding certificate #{downloaded_cert_path}"
|
16
|
+
cert_store.add_file(downloaded_cert_path)
|
20
17
|
|
21
|
-
|
22
|
-
[@from, @to]
|
23
|
-
end
|
18
|
+
req = Net::HTTP::Get.new(uri)
|
24
19
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
def nodes_connected_to_node node, links
|
32
|
-
unique_nodes links.select{|l|l.include?(node)}
|
33
|
-
end
|
34
|
-
|
35
|
-
def connected_links link, link_pool
|
36
|
-
link_pool.select{|l| l.connected?(link)}
|
37
|
-
end
|
38
|
-
|
39
|
-
def nodes_connected_to_nodes_within_pool nodes, links, node_pool
|
40
|
-
nodes.collect{ | node | nodes_connected_to_node(node, links) }.flatten & node_pool
|
41
|
-
end
|
42
|
-
|
43
|
-
def connected_links_still_within_pool links, link_pool
|
44
|
-
links.collect{ | link | connected_links(link, link_pool) }.flatten.uniq
|
45
|
-
end
|
46
|
-
|
47
|
-
def split_into_clusters_of_nodes links
|
48
|
-
node_pool = unique_nodes links
|
49
|
-
groups = []
|
50
|
-
|
51
|
-
while node_pool.any?
|
52
|
-
group = []
|
53
|
-
groups << group
|
54
|
-
connected_nodes = [node_pool.first]
|
55
|
-
|
56
|
-
while connected_nodes.any?
|
57
|
-
group.concat(connected_nodes)
|
58
|
-
node_pool = node_pool - connected_nodes
|
59
|
-
connected_nodes = nodes_connected_to_nodes_within_pool connected_nodes, links, node_pool
|
60
|
-
end
|
61
|
-
end
|
20
|
+
options = {
|
21
|
+
:use_ssl => uri.scheme == 'https',
|
22
|
+
verify_mode: OpenSSL::SSL::VERIFY_PEER,
|
23
|
+
cert_store: cert_store
|
24
|
+
}
|
62
25
|
|
63
|
-
|
26
|
+
response = Net::HTTP.start(uri.hostname, uri.port, options) do |http|
|
27
|
+
http.request req
|
64
28
|
end
|
65
29
|
|
66
|
-
|
67
|
-
connected_links = link_pool.select{ | candidate| candidate.connected?(link) }
|
68
|
-
if connected_links.empty?
|
69
|
-
[link]
|
70
|
-
else
|
71
|
-
([link] + connected_links.map{| connected_link| recurse(connected_link, link_pool - connected_links)}.flatten).uniq
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def recurse_groups groups, link_pool
|
76
|
-
if link_pool.empty?
|
77
|
-
groups
|
78
|
-
else
|
79
|
-
first, *rest = *link_pool
|
80
|
-
group = recurse first, rest
|
81
|
-
recurse_groups(groups + [group], link_pool - group)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def split_into_clusters_of_links links
|
86
|
-
recurse_groups [], links.dup
|
87
|
-
end
|
88
|
-
|
89
|
-
links = [Link.new('A', 'B'), Link.new('A', 'C'), Link.new('C', 'D'), Link.new('D', 'E'), Link.new('E','A'),
|
90
|
-
Link.new('Y', 'Z'), Link.new('X', 'Y'),
|
91
|
-
Link.new('M', 'N'), Link.new('N', 'O'), Link.new('O', 'P'), Link.new('P','Q')]
|
92
|
-
|
93
|
-
|
94
|
-
groups = split_into_clusters_of_nodes links
|
95
|
-
|
96
|
-
puts groups.collect{ | group| "group = #{group.join(" ")}"}
|
97
|
-
|
98
|
-
groups = split_into_clusters_of_links links
|
99
|
-
puts groups.collect{ | group| "group = #{group.join(", ")}"}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
30
|
+
puts response
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative 'migration_helper'
|
2
|
+
|
3
|
+
Sequel.migration do
|
4
|
+
change do
|
5
|
+
create_table(:webhook_events, charset: 'utf8') do
|
6
|
+
primary_key :id
|
7
|
+
foreign_key :webhook_id, :webhooks, on_delete: :cascade
|
8
|
+
String :name
|
9
|
+
DateTime :created_at, null: false
|
10
|
+
DateTime :updated_at, null: false
|
11
|
+
index [:id, :name], unique: true, name: 'uq_webhook_id_name'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative 'migration_helper'
|
2
|
+
|
3
|
+
Sequel.migration do
|
4
|
+
up do
|
5
|
+
from(:webhooks).each do | webhook |
|
6
|
+
from(:webhook_events).insert(
|
7
|
+
webhook_id: webhook[:id],
|
8
|
+
name: 'contract_content_changed',
|
9
|
+
created_at: DateTime.now,
|
10
|
+
updated_at: DateTime.now
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
down do
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative 'migration_helper'
|
2
|
+
|
3
|
+
Sequel.migration do
|
4
|
+
change do
|
5
|
+
create_table(:certificates, charset: 'utf8') do
|
6
|
+
primary_key :id
|
7
|
+
String :uuid, null: false, unique: true, unique_constraint_name: 'uq_certificate_uuid'
|
8
|
+
String :description, null: true
|
9
|
+
String :content, null: false, type: PactBroker::MigrationHelper.large_text_type
|
10
|
+
DateTime :created_at, null: false
|
11
|
+
DateTime :updated_at, null: false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
from(:triggered_webhooks).where(trigger_type: 'pact_publication').update(trigger_type: 'resource_creation')
|
4
|
+
end
|
5
|
+
|
6
|
+
down do
|
7
|
+
from(:triggered_webhooks).where(trigger_type: 'resource_creation').update(trigger_type: 'pact_publication')
|
8
|
+
end
|
9
|
+
end
|
Binary file
|
@@ -31,7 +31,7 @@ GEM
|
|
31
31
|
dry-container (0.6.0)
|
32
32
|
concurrent-ruby (~> 1.0)
|
33
33
|
dry-configurable (~> 0.1, >= 0.1.3)
|
34
|
-
dry-core (0.
|
34
|
+
dry-core (0.4.2)
|
35
35
|
concurrent-ruby (~> 1.0)
|
36
36
|
dry-equalizer (0.2.0)
|
37
37
|
dry-logic (0.4.2)
|
@@ -62,7 +62,7 @@ GEM
|
|
62
62
|
url_mount (~> 0.2.1)
|
63
63
|
httparty (0.15.6)
|
64
64
|
multi_xml (>= 0.5.2)
|
65
|
-
i18n (0.9.
|
65
|
+
i18n (0.9.1)
|
66
66
|
concurrent-ruby (~> 1.0)
|
67
67
|
inflecto (0.0.2)
|
68
68
|
json (2.1.0)
|
@@ -129,14 +129,14 @@ GEM
|
|
129
129
|
rack (1.5.5)
|
130
130
|
rack-protection (1.5.3)
|
131
131
|
rack
|
132
|
-
rack-proxy (0.6.
|
132
|
+
rack-proxy (0.6.3)
|
133
133
|
rack
|
134
134
|
rack-reverse-proxy (0.12.0)
|
135
135
|
rack (>= 1.0.0)
|
136
136
|
rack-proxy (~> 0.6, >= 0.6.1)
|
137
137
|
rack-test (0.6.3)
|
138
138
|
rack (>= 1.0)
|
139
|
-
rake (12.
|
139
|
+
rake (12.3.0)
|
140
140
|
randexp (0.1.7)
|
141
141
|
redcarpet (3.4.0)
|
142
142
|
reform (2.2.4)
|
@@ -178,7 +178,7 @@ GEM
|
|
178
178
|
thor (0.20.0)
|
179
179
|
thread_safe (0.3.6)
|
180
180
|
tilt (2.0.8)
|
181
|
-
tins (1.
|
181
|
+
tins (1.16.3)
|
182
182
|
tzinfo (1.2.4)
|
183
183
|
thread_safe (~> 0.1)
|
184
184
|
uber (0.1.0)
|
@@ -30,7 +30,7 @@ GEM
|
|
30
30
|
dry-container (0.6.0)
|
31
31
|
concurrent-ruby (~> 1.0)
|
32
32
|
dry-configurable (~> 0.1, >= 0.1.3)
|
33
|
-
dry-core (0.
|
33
|
+
dry-core (0.4.2)
|
34
34
|
concurrent-ruby (~> 1.0)
|
35
35
|
dry-equalizer (0.2.0)
|
36
36
|
dry-logic (0.4.2)
|
@@ -61,7 +61,7 @@ GEM
|
|
61
61
|
url_mount (~> 0.2.1)
|
62
62
|
httparty (0.15.6)
|
63
63
|
multi_xml (>= 0.5.2)
|
64
|
-
i18n (0.9.
|
64
|
+
i18n (0.9.1)
|
65
65
|
concurrent-ruby (~> 1.0)
|
66
66
|
inflecto (0.0.2)
|
67
67
|
json (2.1.0)
|
@@ -128,14 +128,14 @@ GEM
|
|
128
128
|
rack (1.5.5)
|
129
129
|
rack-protection (1.5.3)
|
130
130
|
rack
|
131
|
-
rack-proxy (0.6.
|
131
|
+
rack-proxy (0.6.3)
|
132
132
|
rack
|
133
133
|
rack-reverse-proxy (0.12.0)
|
134
134
|
rack (>= 1.0.0)
|
135
135
|
rack-proxy (~> 0.6, >= 0.6.1)
|
136
136
|
rack-test (0.6.3)
|
137
137
|
rack (>= 1.0)
|
138
|
-
rake (12.
|
138
|
+
rake (12.3.0)
|
139
139
|
randexp (0.1.7)
|
140
140
|
redcarpet (3.4.0)
|
141
141
|
reform (2.2.4)
|
@@ -178,7 +178,7 @@ GEM
|
|
178
178
|
thor (0.20.0)
|
179
179
|
thread_safe (0.3.6)
|
180
180
|
tilt (2.0.8)
|
181
|
-
tins (1.
|
181
|
+
tins (1.16.3)
|
182
182
|
tzinfo (1.2.4)
|
183
183
|
thread_safe (~> 0.1)
|
184
184
|
uber (0.1.0)
|
@@ -30,7 +30,7 @@ GEM
|
|
30
30
|
dry-container (0.6.0)
|
31
31
|
concurrent-ruby (~> 1.0)
|
32
32
|
dry-configurable (~> 0.1, >= 0.1.3)
|
33
|
-
dry-core (0.
|
33
|
+
dry-core (0.4.2)
|
34
34
|
concurrent-ruby (~> 1.0)
|
35
35
|
dry-equalizer (0.2.0)
|
36
36
|
dry-logic (0.4.2)
|
@@ -61,7 +61,7 @@ GEM
|
|
61
61
|
url_mount (~> 0.2.1)
|
62
62
|
httparty (0.15.6)
|
63
63
|
multi_xml (>= 0.5.2)
|
64
|
-
i18n (0.9.
|
64
|
+
i18n (0.9.1)
|
65
65
|
concurrent-ruby (~> 1.0)
|
66
66
|
inflecto (0.0.2)
|
67
67
|
json (2.1.0)
|
@@ -129,14 +129,14 @@ GEM
|
|
129
129
|
rack (1.5.5)
|
130
130
|
rack-protection (1.5.3)
|
131
131
|
rack
|
132
|
-
rack-proxy (0.6.
|
132
|
+
rack-proxy (0.6.3)
|
133
133
|
rack
|
134
134
|
rack-reverse-proxy (0.12.0)
|
135
135
|
rack (>= 1.0.0)
|
136
136
|
rack-proxy (~> 0.6, >= 0.6.1)
|
137
137
|
rack-test (0.6.3)
|
138
138
|
rack (>= 1.0)
|
139
|
-
rake (12.
|
139
|
+
rake (12.3.0)
|
140
140
|
randexp (0.1.7)
|
141
141
|
redcarpet (3.4.0)
|
142
142
|
reform (2.2.4)
|
@@ -179,7 +179,7 @@ GEM
|
|
179
179
|
thor (0.20.0)
|
180
180
|
thread_safe (0.3.6)
|
181
181
|
tilt (2.0.8)
|
182
|
-
tins (1.
|
182
|
+
tins (1.16.3)
|
183
183
|
tzinfo (1.2.4)
|
184
184
|
thread_safe (~> 0.1)
|
185
185
|
uber (0.1.0)
|