pact_broker 2.7.0.beta.1 → 2.7.0.beta.2

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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +30 -4
  4. data/db/migrations/{01_create_pacticipant_table.rb → 000001_create_pacticipant_table.rb} +0 -0
  5. data/db/migrations/{02_create_versions_table.rb → 000002_create_versions_table.rb} +0 -0
  6. data/db/migrations/{03_create_pacts_table.rb → 000003_create_pacts_table.rb} +0 -0
  7. data/db/migrations/{04_create_tags_table.rb → 000004_create_tags_table.rb} +0 -0
  8. data/db/migrations/{05_add_order_column_to_version.rb → 000005_add_order_column_to_version.rb} +0 -0
  9. data/db/migrations/{06_make_version_foreign_key_mandatory.rb → 000006_make_version_foreign_key_mandatory.rb} +0 -0
  10. data/db/migrations/{07_increase_json_content_length.rb → 000007_increase_json_content_length.rb} +0 -0
  11. data/db/migrations/{08_create_latest_pact_view.rb → 000008_create_latest_pact_view.rb} +0 -0
  12. data/db/migrations/{09_add_timestamps.rb → 000009_add_timestamps.rb} +0 -0
  13. data/db/migrations/{10_populate_timestamps.rb → 000010_populate_timestamps.rb} +0 -0
  14. data/db/migrations/{11_made_timestamps_mandatory.rb → 000011_made_timestamps_mandatory.rb} +0 -0
  15. data/db/migrations/{12_create_webhooks_table.rb → 000012_create_webhooks_table.rb} +0 -0
  16. data/db/migrations/{13_add_columns_to_webhooks.rb → 000013_add_columns_to_webhooks.rb} +0 -0
  17. data/db/migrations/{14_add_timestamps_to_pact_views.rb → 000014_add_timestamps_to_pact_views.rb} +0 -0
  18. data/db/migrations/{15_create_pact_version_content.rb → 000015_create_pact_version_content.rb} +0 -0
  19. data/db/migrations/{16_add_pact_content_foreign_key_to_pacts.rb → 000016_add_pact_content_foreign_key_to_pacts.rb} +0 -0
  20. data/db/migrations/{17_migrate_json_content_to_pact_version_content_table.rb → 000017_migrate_json_content_to_pact_version_content_table.rb} +0 -0
  21. data/db/migrations/{18_drop_json_content_column_from_pacts.rb → 000018_drop_json_content_column_from_pacts.rb} +0 -0
  22. data/db/migrations/{19_make_pact_version_content_sha_not_nullable.rb → 000019_make_pact_version_content_sha_not_nullable.rb} +0 -0
  23. data/db/migrations/{20_add_pact_version_content_sha_to_all_pacts_view.rb → 000020_add_pact_version_content_sha_to_all_pacts_view.rb} +0 -0
  24. data/db/migrations/{21_recreate_latest_pacts_view.rb → 000021_recreate_latest_pacts_view.rb} +0 -0
  25. data/db/migrations/{22_create_latest_tagged_pacts_view.rb → 000022_create_latest_tagged_pacts_view.rb} +0 -0
  26. data/db/migrations/{23_create_pact_versions_table.rb → 000023_create_pact_versions_table.rb} +0 -0
  27. data/db/migrations/{24_populate_pact_versions.rb → 000024_populate_pact_versions.rb} +0 -0
  28. data/db/migrations/{25_make_pv_pacticipants_mandatory.rb → 000025_make_pv_pacticipants_mandatory.rb} +0 -0
  29. data/db/migrations/{26_create_pact_publications.rb → 000026_create_pact_publications.rb} +0 -0
  30. data/db/migrations/{27_populate_pact_publications.rb → 000027_populate_pact_publications.rb} +0 -0
  31. data/db/migrations/{28_create_all_pact_publications.rb → 000028_create_all_pact_publications.rb} +0 -0
  32. data/db/migrations/{29_create_latest_tagged_pact_publications.rb → 000029_create_latest_tagged_pact_publications.rb} +0 -0
  33. data/db/migrations/{30_drop_old_tables_and_views.rb → 000030_drop_old_tables_and_views.rb} +0 -0
  34. data/db/migrations/{31_create_verifications.rb → 000031_create_verifications.rb} +0 -0
  35. data/db/migrations/{32_create_latest_verifications.rb → 000032_create_latest_verifications.rb} +0 -0
  36. data/db/migrations/{33_create_config_table.rb → 000033_create_config_table.rb} +0 -0
  37. data/db/migrations/{34_create_index_on_consumer_version_order.rb → 000034_create_index_on_consumer_version_order.rb} +0 -0
  38. data/db/migrations/{35_create_index_on_names.rb → 000035_create_index_on_names.rb} +0 -0
  39. data/db/migrations/{36_create_webhook_execution.rb → 000036_create_webhook_execution.rb} +0 -0
  40. data/db/migrations/{37_create_labels_table.rb → 000037_create_labels_table.rb} +0 -0
  41. data/db/migrations/{38_create_triggered_webhooks_table.rb → 000038_create_triggered_webhooks_table.rb} +0 -0
  42. data/db/migrations/{39_add_triggered_webhooks_fk_to_execution.rb → 000039_add_triggered_webhooks_fk_to_execution.rb} +0 -0
  43. data/db/migrations/{40_create_latest_triggered_webhooks_view.rb → 000040_create_latest_triggered_webhooks_view.rb} +0 -0
  44. data/db/migrations/{41_migrate_execution_data.rb → 000041_migrate_execution_data.rb} +0 -0
  45. data/db/migrations/{42_delete_orphan_webhook_data.rb → 000042_delete_orphan_webhook_data.rb} +0 -0
  46. data/db/migrations/{43_add_provider_version_to_verification.rb → 000043_add_provider_version_to_verification.rb} +0 -0
  47. data/db/migrations/{44_populate_verifications_provider_version_id.rb → 000044_populate_verifications_provider_version_id.rb} +0 -0
  48. data/db/migrations/{45_set_verification_provider_number_nullable.rb → 000045_set_verification_provider_number_nullable.rb} +0 -0
  49. data/db/migrations/{46_recreate_latest_verifications.rb → 000046_recreate_latest_verifications.rb} +0 -0
  50. data/db/migrations/{47_create_all_verifications.rb → 000047_create_all_verifications.rb} +4 -0
  51. data/db/pact_broker_database.sqlite3 +0 -0
  52. data/db/test/backwards_compatibility/Appraisals +8 -0
  53. data/db/test/backwards_compatibility/Rakefile +23 -6
  54. data/db/test/backwards_compatibility/gemfiles/1.18.0.gemfile.lock +20 -19
  55. data/db/test/backwards_compatibility/gemfiles/2.0.0.gemfile.lock +20 -19
  56. data/db/test/backwards_compatibility/gemfiles/2.1.0.gemfile.lock +20 -19
  57. data/db/test/backwards_compatibility/gemfiles/2.2.0.gemfile.lock +29 -26
  58. data/db/test/backwards_compatibility/gemfiles/2.3.0.gemfile.lock +29 -26
  59. data/db/test/backwards_compatibility/gemfiles/2.4.2.gemfile.lock +29 -26
  60. data/db/test/backwards_compatibility/gemfiles/2.5.1.gemfile +13 -0
  61. data/db/test/backwards_compatibility/gemfiles/2.5.1.gemfile.lock +199 -0
  62. data/db/test/backwards_compatibility/gemfiles/2.6.0.gemfile +13 -0
  63. data/db/test/backwards_compatibility/gemfiles/2.6.0.gemfile.lock +199 -0
  64. data/db/test/backwards_compatibility/gemfiles/head.gemfile.lock +30 -27
  65. data/db/test/backwards_compatibility/spec/publish_pact_spec.rb +1 -1
  66. data/db/test/change_migration_strategy/Rakefile +21 -0
  67. data/db/test/change_migration_strategy/before/Gemfile +6 -0
  68. data/lib/pact_broker/api/decorators/matrix_decorator.rb +19 -1
  69. data/lib/pact_broker/api/decorators/matrix_text_decorator.rb +29 -0
  70. data/lib/pact_broker/api/renderers/html_pact_renderer.rb +1 -1
  71. data/lib/pact_broker/api/resources/matrix.rb +21 -11
  72. data/lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb +2 -2
  73. data/lib/pact_broker/app.rb +27 -2
  74. data/lib/pact_broker/db/migrate.rb +1 -1
  75. data/lib/pact_broker/db/version.rb +4 -5
  76. data/lib/pact_broker/db.rb +1 -1
  77. data/lib/pact_broker/domain/relationship.rb +4 -24
  78. data/lib/pact_broker/matrix/parse_query.rb +22 -0
  79. data/lib/pact_broker/matrix/repository.rb +57 -26
  80. data/lib/pact_broker/matrix/service.rb +23 -16
  81. data/lib/pact_broker/pacticipants/service.rb +5 -21
  82. data/lib/pact_broker/pacts/pact_publication.rb +0 -4
  83. data/lib/pact_broker/pacts/repository.rb +1 -1
  84. data/lib/pact_broker/tags/service.rb +1 -0
  85. data/lib/pact_broker/ui/controllers/matrix.rb +3 -2
  86. data/lib/pact_broker/ui/controllers/relationships.rb +2 -2
  87. data/lib/pact_broker/ui/view_models/matrix_line.rb +38 -5
  88. data/lib/pact_broker/ui/view_models/relationship.rb +1 -19
  89. data/lib/pact_broker/ui/views/matrix/show.haml +18 -3
  90. data/lib/pact_broker/ui/views/relationships/show.haml +2 -2
  91. data/lib/pact_broker/verifications/repository.rb +0 -3
  92. data/lib/pact_broker/version.rb +1 -1
  93. data/lib/rack/hal_browser/redirect.rb +2 -2
  94. data/lib/rack/pact_broker/configurable_make_it_later.rb +24 -0
  95. data/lib/rack/pact_broker/no_auth.rb +13 -0
  96. data/pact_broker.gemspec +1 -0
  97. data/script/seed-matrix.rb +71 -0
  98. data/script/seed.rb +0 -5
  99. data/spec/features/get_matrix_spec.rb +4 -1
  100. data/spec/lib/pact_broker/api/decorators/matrix_decorator_spec.rb +41 -7
  101. data/spec/lib/pact_broker/api/resources/matrix_spec.rb +6 -2
  102. data/spec/lib/pact_broker/app_spec.rb +69 -0
  103. data/spec/lib/pact_broker/domain/relationship_spec.rb +1 -1
  104. data/spec/lib/pact_broker/matrix/parse_query_spec.rb +79 -0
  105. data/spec/lib/pact_broker/matrix/repository_spec.rb +244 -12
  106. data/spec/lib/pact_broker/matrix/service_spec.rb +39 -9
  107. data/spec/lib/pact_broker/pacticipants/service_spec.rb +4 -78
  108. data/spec/lib/pact_broker/pacts/repository_spec.rb +14 -16
  109. data/spec/lib/pact_broker/ui/view_models/relationship_spec.rb +5 -4
  110. data/spec/migrations/change_migration_strategy_spec.rb +86 -0
  111. data/spec/service_consumers/provider_states_for_pact_broker_client.rb +34 -0
  112. data/spec/support/test_data_builder.rb +6 -0
  113. data/tasks/database.rb +1 -1
  114. metadata +78 -52
  115. data/lib/pact_broker/ui/views/relationships/show-prod-tags.haml +0 -83
  116. data/spec/lib/pact_broker/pacts/pact_publication_spec.rb +0 -35
@@ -0,0 +1,199 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ appraisal (2.2.0)
5
+ bundler
6
+ rake
7
+ thor (>= 0.14.0)
8
+ as-notifications (1.0.1)
9
+ awesome_print (1.8.0)
10
+ concurrent-ruby (1.0.5)
11
+ daemons (1.2.5)
12
+ declarative (0.0.10)
13
+ declarative-builder (0.1.0)
14
+ declarative-option (< 0.2.0)
15
+ declarative-option (0.1.0)
16
+ diff-lcs (1.3)
17
+ disposable (0.4.3)
18
+ declarative (>= 0.0.9, < 1.0.0)
19
+ declarative-builder (< 0.2.0)
20
+ declarative-option (< 0.2.0)
21
+ representable (>= 2.4.0, <= 3.1.0)
22
+ uber (< 0.2.0)
23
+ dry-configurable (0.7.0)
24
+ concurrent-ruby (~> 1.0)
25
+ dry-container (0.6.0)
26
+ concurrent-ruby (~> 1.0)
27
+ dry-configurable (~> 0.1, >= 0.1.3)
28
+ dry-core (0.3.4)
29
+ concurrent-ruby (~> 1.0)
30
+ dry-equalizer (0.2.0)
31
+ dry-logic (0.4.2)
32
+ dry-container (~> 0.2, >= 0.2.6)
33
+ dry-core (~> 0.2)
34
+ dry-equalizer (~> 0.2)
35
+ dry-types (0.10.3)
36
+ concurrent-ruby (~> 1.0)
37
+ dry-configurable (~> 0.1)
38
+ dry-container (~> 0.3)
39
+ dry-core (~> 0.2, >= 0.2.1)
40
+ dry-equalizer (~> 0.2)
41
+ dry-logic (~> 0.4, >= 0.4.0)
42
+ inflecto (~> 0.0.0, >= 0.0.2)
43
+ dry-validation (0.10.7)
44
+ concurrent-ruby (~> 1.0)
45
+ dry-configurable (~> 0.1, >= 0.1.3)
46
+ dry-core (~> 0.2, >= 0.2.1)
47
+ dry-equalizer (~> 0.2)
48
+ dry-logic (~> 0.4, >= 0.4.0)
49
+ dry-types (~> 0.9, >= 0.9.0)
50
+ enumerable-lazy (0.0.2)
51
+ eventmachine (1.2.5)
52
+ filelock (1.1.1)
53
+ find_a_port (1.0.1)
54
+ haml (4.0.7)
55
+ tilt
56
+ httparty (0.15.6)
57
+ multi_xml (>= 0.5.2)
58
+ i18n (0.9.0)
59
+ concurrent-ruby (~> 1.0)
60
+ inflecto (0.0.2)
61
+ json (2.1.0)
62
+ multi_json (1.12.2)
63
+ multi_xml (0.6.0)
64
+ mustermann (1.0.1)
65
+ mustermann19 (0.4.4)
66
+ enumerable-lazy
67
+ mysql2 (0.3.21)
68
+ pact (1.16.1)
69
+ json (> 1.8.5)
70
+ pact-mock_service (~> 2.0)
71
+ pact-support (~> 1.1, >= 1.1.8)
72
+ rack-test (~> 0.6.2)
73
+ randexp (~> 0.1.7)
74
+ rspec (>= 2.14)
75
+ term-ansicolor (~> 1.0)
76
+ thor
77
+ webrick
78
+ pact-mock_service (2.4.0)
79
+ filelock (~> 1.1)
80
+ find_a_port (~> 1.0.1)
81
+ json
82
+ pact-support (~> 1.2, >= 1.2.1)
83
+ rack (~> 2.0)
84
+ rack-test (~> 0.6.2)
85
+ rspec (>= 2.14)
86
+ term-ansicolor (~> 1.0)
87
+ thor (~> 0.19)
88
+ webrick (~> 1.3)
89
+ pact-support (1.2.1)
90
+ awesome_print (~> 1.1)
91
+ find_a_port (~> 1.0.1)
92
+ json
93
+ rack-test (~> 0.6.2)
94
+ randexp (~> 0.1.7)
95
+ rspec (>= 2.14)
96
+ term-ansicolor (~> 1.0)
97
+ thor
98
+ pact_broker (2.5.1)
99
+ dry-types (~> 0.10.3)
100
+ dry-validation (~> 0.10.5)
101
+ haml (~> 4.0)
102
+ httparty (~> 0.14)
103
+ json (> 1.8, < 3.0)
104
+ pact (~> 1.14)
105
+ padrino-core (~> 0.14.1)
106
+ rack (~> 2.0)
107
+ rack-protection (~> 2.0)
108
+ redcarpet (~> 3.3, >= 3.3.2)
109
+ reform (~> 2.2)
110
+ roar (~> 1.1)
111
+ semver2 (~> 3.4.2)
112
+ sequel (~> 4.23)
113
+ sucker_punch (~> 2.0)
114
+ webmachine (= 1.5.0)
115
+ padrino-core (0.14.1.1)
116
+ mustermann19
117
+ padrino-support (= 0.14.1.1)
118
+ rack-protection (>= 1.5.0)
119
+ sinatra (>= 1.4.6)
120
+ thor (~> 0.18)
121
+ padrino-support (0.14.1.1)
122
+ pg (0.21.0)
123
+ rack (2.0.3)
124
+ rack-protection (2.0.0)
125
+ rack
126
+ rack-proxy (0.6.2)
127
+ rack
128
+ rack-reverse-proxy (0.12.0)
129
+ rack (>= 1.0.0)
130
+ rack-proxy (~> 0.6, >= 0.6.1)
131
+ rack-test (0.6.3)
132
+ rack (>= 1.0)
133
+ rake (12.2.1)
134
+ randexp (0.1.7)
135
+ redcarpet (3.4.0)
136
+ reform (2.2.4)
137
+ disposable (>= 0.4.1)
138
+ representable (>= 2.4.0, < 3.1.0)
139
+ representable (3.0.4)
140
+ declarative (< 0.1.0)
141
+ declarative-option (< 0.2.0)
142
+ uber (< 0.2.0)
143
+ roar (1.1.0)
144
+ representable (~> 3.0.0)
145
+ rspec (3.7.0)
146
+ rspec-core (~> 3.7.0)
147
+ rspec-expectations (~> 3.7.0)
148
+ rspec-mocks (~> 3.7.0)
149
+ rspec-core (3.7.0)
150
+ rspec-support (~> 3.7.0)
151
+ rspec-expectations (3.7.0)
152
+ diff-lcs (>= 1.2.0, < 2.0)
153
+ rspec-support (~> 3.7.0)
154
+ rspec-mocks (3.7.0)
155
+ diff-lcs (>= 1.2.0, < 2.0)
156
+ rspec-support (~> 3.7.0)
157
+ rspec-support (3.7.0)
158
+ semver2 (3.4.2)
159
+ sequel (4.49.0)
160
+ sinatra (2.0.0)
161
+ mustermann (~> 1.0)
162
+ rack (~> 2.0)
163
+ rack-protection (= 2.0.0)
164
+ tilt (~> 2.0)
165
+ sqlite3 (1.3.13)
166
+ sucker_punch (2.0.4)
167
+ concurrent-ruby (~> 1.0.0)
168
+ term-ansicolor (1.6.0)
169
+ tins (~> 1.0)
170
+ thin (1.7.2)
171
+ daemons (~> 1.0, >= 1.0.9)
172
+ eventmachine (~> 1.0, >= 1.0.4)
173
+ rack (>= 1, < 3)
174
+ thor (0.20.0)
175
+ tilt (2.0.8)
176
+ tins (1.15.0)
177
+ uber (0.1.0)
178
+ webmachine (1.5.0)
179
+ as-notifications (~> 1.0)
180
+ i18n (>= 0.4.0)
181
+ multi_json
182
+ webrick (1.3.1)
183
+
184
+ PLATFORMS
185
+ ruby
186
+
187
+ DEPENDENCIES
188
+ appraisal
189
+ mysql2 (~> 0.3.15)
190
+ pact_broker (= 2.5.1)
191
+ pg (~> 0.21)
192
+ rack-reverse-proxy (~> 0.12)
193
+ rake (~> 12.0)
194
+ rspec
195
+ sqlite3 (~> 1.3)
196
+ thin (~> 1.3)
197
+
198
+ BUNDLED WITH
199
+ 1.15.4
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../../..
3
3
  specs:
4
- pact_broker (2.4.2)
4
+ pact_broker (2.6.0)
5
5
  dry-types (~> 0.10.3)
6
6
  dry-validation (~> 0.10.5)
7
7
  haml (~> 4.0)
@@ -29,8 +29,8 @@ GEM
29
29
  as-notifications (1.0.1)
30
30
  awesome_print (1.8.0)
31
31
  concurrent-ruby (1.0.5)
32
- daemons (1.2.4)
33
- declarative (0.0.9)
32
+ daemons (1.2.5)
33
+ declarative (0.0.10)
34
34
  declarative-builder (0.1.0)
35
35
  declarative-option (< 0.2.0)
36
36
  declarative-option (0.1.0)
@@ -46,10 +46,10 @@ GEM
46
46
  dry-container (0.6.0)
47
47
  concurrent-ruby (~> 1.0)
48
48
  dry-configurable (~> 0.1, >= 0.1.3)
49
- dry-core (0.3.3)
49
+ dry-core (0.3.4)
50
50
  concurrent-ruby (~> 1.0)
51
51
  dry-equalizer (0.2.0)
52
- dry-logic (0.4.1)
52
+ dry-logic (0.4.2)
53
53
  dry-container (~> 0.2, >= 0.2.6)
54
54
  dry-core (~> 0.2)
55
55
  dry-equalizer (~> 0.2)
@@ -70,12 +70,14 @@ GEM
70
70
  dry-types (~> 0.9, >= 0.9.0)
71
71
  enumerable-lazy (0.0.2)
72
72
  eventmachine (1.2.5)
73
+ filelock (1.1.1)
73
74
  find_a_port (1.0.1)
74
75
  haml (4.0.7)
75
76
  tilt
76
77
  httparty (0.15.6)
77
78
  multi_xml (>= 0.5.2)
78
- i18n (0.8.6)
79
+ i18n (0.9.0)
80
+ concurrent-ruby (~> 1.0)
79
81
  inflecto (0.0.2)
80
82
  json (2.1.0)
81
83
  multi_json (1.12.2)
@@ -84,27 +86,28 @@ GEM
84
86
  mustermann19 (0.4.4)
85
87
  enumerable-lazy
86
88
  mysql2 (0.3.21)
87
- pact (1.15.0)
89
+ pact (1.16.1)
88
90
  json (> 1.8.5)
89
91
  pact-mock_service (~> 2.0)
90
- pact-support (~> 1.1)
92
+ pact-support (~> 1.1, >= 1.1.8)
91
93
  rack-test (~> 0.6.2)
92
94
  randexp (~> 0.1.7)
93
95
  rspec (>= 2.14)
94
96
  term-ansicolor (~> 1.0)
95
97
  thor
96
98
  webrick
97
- pact-mock_service (2.1.0)
99
+ pact-mock_service (2.4.0)
100
+ filelock (~> 1.1)
98
101
  find_a_port (~> 1.0.1)
99
102
  json
100
- pact-support (~> 1.0)
101
- rack
103
+ pact-support (~> 1.2, >= 1.2.1)
104
+ rack (~> 2.0)
102
105
  rack-test (~> 0.6.2)
103
106
  rspec (>= 2.14)
104
107
  term-ansicolor (~> 1.0)
105
- thor
106
- webrick
107
- pact-support (1.1.6)
108
+ thor (~> 0.19)
109
+ webrick (~> 1.3)
110
+ pact-support (1.2.1)
108
111
  awesome_print (~> 1.1)
109
112
  find_a_port (~> 1.0.1)
110
113
  json
@@ -131,7 +134,7 @@ GEM
131
134
  rack-proxy (~> 0.6, >= 0.6.1)
132
135
  rack-test (0.6.3)
133
136
  rack (>= 1.0)
134
- rake (12.0.0)
137
+ rake (12.2.1)
135
138
  randexp (0.1.7)
136
139
  redcarpet (3.4.0)
137
140
  reform (2.2.4)
@@ -143,19 +146,19 @@ GEM
143
146
  uber (< 0.2.0)
144
147
  roar (1.1.0)
145
148
  representable (~> 3.0.0)
146
- rspec (3.6.0)
147
- rspec-core (~> 3.6.0)
148
- rspec-expectations (~> 3.6.0)
149
- rspec-mocks (~> 3.6.0)
150
- rspec-core (3.6.0)
151
- rspec-support (~> 3.6.0)
152
- rspec-expectations (3.6.0)
149
+ rspec (3.7.0)
150
+ rspec-core (~> 3.7.0)
151
+ rspec-expectations (~> 3.7.0)
152
+ rspec-mocks (~> 3.7.0)
153
+ rspec-core (3.7.0)
154
+ rspec-support (~> 3.7.0)
155
+ rspec-expectations (3.7.0)
153
156
  diff-lcs (>= 1.2.0, < 2.0)
154
- rspec-support (~> 3.6.0)
155
- rspec-mocks (3.6.0)
157
+ rspec-support (~> 3.7.0)
158
+ rspec-mocks (3.7.0)
156
159
  diff-lcs (>= 1.2.0, < 2.0)
157
- rspec-support (~> 3.6.0)
158
- rspec-support (3.6.0)
160
+ rspec-support (~> 3.7.0)
161
+ rspec-support (3.7.0)
159
162
  semver2 (3.4.2)
160
163
  sequel (4.49.0)
161
164
  sinatra (2.0.0)
@@ -164,7 +167,7 @@ GEM
164
167
  rack-protection (= 2.0.0)
165
168
  tilt (~> 2.0)
166
169
  sqlite3 (1.3.13)
167
- sucker_punch (2.0.3)
170
+ sucker_punch (2.0.4)
168
171
  concurrent-ruby (~> 1.0.0)
169
172
  term-ansicolor (1.6.0)
170
173
  tins (~> 1.0)
@@ -57,7 +57,7 @@ describe "Code version #{CODE_VERSION} running against database version #{DATABA
57
57
  subject { get path; last_response }
58
58
 
59
59
  it "returns the latest pact" do
60
- expect(subject.headers['X-Pact-Consumer-Version']).to eq '100.100.100'
60
+ expect(subject.headers['X-Pact-Consumer-Version']).to eq CONSUMER_VERSION
61
61
  end
62
62
  end
63
63
 
@@ -0,0 +1,21 @@
1
+ require 'bundler/setup'
2
+ require 'pact_broker/tasks'
3
+
4
+ def create_connection
5
+ require 'sequel'
6
+ database_config = {adapter: "sqlite", database: "pact_broker_database.sqlite3", :encoding => 'utf8'}
7
+ Sequel.connect(database_config)
8
+ end
9
+
10
+ PactBroker::DB::MigrationTask.new do | task |
11
+ task.database_connection = create_connection
12
+ end
13
+
14
+ PactBroker::DB::VersionTask.new do | task |
15
+ task.database_connection = create_connection
16
+ end
17
+
18
+ task 'pact_broker:version' do
19
+ require 'pact_broker/version'
20
+ puts PactBroker::VERSION
21
+ end
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rake", "~>12.0"
4
+ gem "pact_broker", git: "https://github.com/pact-foundation/pact_broker.git", ref: "11d3464a120ed5f76e23241c79992fa04b702701"
5
+ gem "sqlite3", "~>1.3"
6
+ gem "pg"
@@ -4,7 +4,7 @@ require 'pact_broker/api/pact_broker_urls'
4
4
  module PactBroker
5
5
  module Api
6
6
  module Decorators
7
- class MatrixPactDecorator
7
+ class MatrixDecorator
8
8
  include PactBroker::Api::PactBrokerUrls
9
9
 
10
10
  def initialize(lines)
@@ -17,6 +17,10 @@ module PactBroker
17
17
 
18
18
  def to_hash(options)
19
19
  {
20
+ summary: {
21
+ deployable: deployable,
22
+ reason: reason
23
+ },
20
24
  matrix: matrix(lines, options[:user_options][:base_url])
21
25
  }
22
26
  end
@@ -25,6 +29,20 @@ module PactBroker
25
29
 
26
30
  attr_reader :lines
27
31
 
32
+ def deployable
33
+ return nil if lines.any?{ |line| line[:success].nil? }
34
+ lines.any? && lines.all?{ |line| line[:success] }
35
+ end
36
+
37
+ def reason
38
+ case deployable
39
+ when true then "All verification results are published and successful"
40
+ when false then "One or more verifications have failed"
41
+ else
42
+ "Missing one or more verification results"
43
+ end
44
+ end
45
+
28
46
  def matrix(lines, base_url)
29
47
  provider = nil
30
48
  consumer = nil
@@ -0,0 +1,29 @@
1
+ require 'ostruct'
2
+ require 'pact_broker/api/pact_broker_urls'
3
+ require 'table_print'
4
+
5
+ module PactBroker
6
+ module Api
7
+ module Decorators
8
+ class MatrixTextDecorator
9
+ Line = Struct.new(:consumer, :consumer_version, :provider, :provider_version, :success)
10
+
11
+ def initialize(lines)
12
+ @lines = lines
13
+ end
14
+
15
+ def to_text(options)
16
+ data = lines.collect do | line |
17
+ Line.new(line[:consumer_name], line[:consumer_version_number], line[:provider_name], line[:provider_version_number], line[:success])
18
+ end
19
+ printer = TablePrint::Printer.new(data)
20
+ printer.table_print + "\n"
21
+ end
22
+
23
+ private
24
+
25
+ attr_reader :lines
26
+ end
27
+ end
28
+ end
29
+ end
@@ -61,7 +61,7 @@ module PactBroker
61
61
  <span class='value'>#{published_date}</span>
62
62
  </li>
63
63
  <li>
64
- <a href=\"#{json_url}\">View in HAL Browser</a>
64
+ <a href=\"#{json_url}\">View in API Browser</a>
65
65
  </li>
66
66
  <li>
67
67
  <a href=\"/\">Home</a>
@@ -1,14 +1,22 @@
1
1
  require 'pact_broker/api/resources/base_resource'
2
2
  require 'pact_broker/api/decorators/matrix_decorator'
3
- require 'cgi'
3
+ require 'pact_broker/api/decorators/matrix_text_decorator'
4
+ require 'pact_broker/matrix/parse_query'
4
5
 
5
6
  module PactBroker
6
7
  module Api
7
8
  module Resources
8
9
  class Matrix < BaseResource
9
10
 
11
+ def initialize
12
+ @selectors, @options = PactBroker::Matrix::ParseQuery.call(request.uri.query)
13
+ end
14
+
10
15
  def content_types_provided
11
- [["application/hal+json", :to_json]]
16
+ [
17
+ ["application/hal+json", :to_json],
18
+ ["text/plain", :to_text]
19
+ ]
12
20
  end
13
21
 
14
22
  def allowed_methods
@@ -26,21 +34,23 @@ module PactBroker
26
34
  end
27
35
 
28
36
  def to_json
29
- criteria = selected_versions.each_with_object({}) { | version, hash | hash[version.pacticipant.name] = version.number }
30
- lines = matrix_service.find_compatible_pacticipant_versions(criteria)
31
- PactBroker::Api::Decorators::MatrixPactDecorator.new(lines).to_json(user_options: { base_url: base_url })
37
+ PactBroker::Api::Decorators::MatrixDecorator.new(lines).to_json(user_options: { base_url: base_url })
32
38
  end
33
39
 
34
- def selectors
35
- @selectors ||= CGI.parse(CGI.unescape(request.uri.query))['selectors[]']
40
+ def to_text
41
+ PactBroker::Api::Decorators::MatrixTextDecorator.new(lines).to_text(user_options: { base_url: base_url })
36
42
  end
37
43
 
38
- def version_selectors
39
- @version_selectors ||= selectors.select{ | selector| selector.include?("/version/") }
44
+ def lines
45
+ @lines ||= matrix_service.find(selectors, options)
46
+ end
47
+
48
+ def selectors
49
+ @selectors
40
50
  end
41
51
 
42
- def selected_versions
43
- @selected_versions ||= version_service.find_versions_by_selector(version_selectors)
52
+ def options
53
+ @options
44
54
  end
45
55
  end
46
56
  end
@@ -19,8 +19,8 @@ module PactBroker
19
19
  end
20
20
 
21
21
  def to_json
22
- lines = matrix_service.find(identifier_from_path)
23
- PactBroker::Api::Decorators::MatrixPactDecorator.new(lines).to_json(user_options: { base_url: base_url })
22
+ lines = matrix_service.find_for_consumer_and_provider(identifier_from_path)
23
+ PactBroker::Api::Decorators::MatrixDecorator.new(lines).to_json(user_options: { base_url: base_url })
24
24
  end
25
25
 
26
26
  def consumer
@@ -9,6 +9,8 @@ require 'rack/pact_broker/database_transaction'
9
9
  require 'rack/pact_broker/invalid_uri_protection'
10
10
  require 'rack/pact_broker/accepts_html_filter'
11
11
  require 'rack/pact_broker/ui_authentication'
12
+ require 'rack/pact_broker/configurable_make_it_later'
13
+ require 'rack/pact_broker/no_auth'
12
14
  require 'sucker_punch'
13
15
 
14
16
  module PactBroker
@@ -20,6 +22,8 @@ module PactBroker
20
22
  def initialize &block
21
23
  @app_builder = ::Rack::Builder.new
22
24
  @cascade_apps = []
25
+ @make_it_later_api_auth = ::Rack::PactBroker::ConfigurableMakeItLater.new(Rack::PactBroker::NoAuth)
26
+ @make_it_later_ui_auth = ::Rack::PactBroker::ConfigurableMakeItLater.new(Rack::PactBroker::NoAuth)
23
27
  @configuration = PactBroker.configuration
24
28
  yield configuration
25
29
  post_configure
@@ -27,10 +31,25 @@ module PactBroker
27
31
  prepare_app
28
32
  end
29
33
 
34
+ # Allows middleware to be inserted at the bottom of the shared middlware stack
35
+ # (ie just before the cascade is called for diagnostic, UI and API).
36
+ # To insert middleware at the top of the stack, initialize
37
+ # the middleware with the app, and run it manually.
38
+ # eg run MyMiddleware.new(app)
30
39
  def use *args, &block
31
40
  @app_builder.use *args, &block
32
41
  end
33
42
 
43
+ # private API, not sure if this will continue to be supported
44
+ def use_api_auth middleware
45
+ @make_it_later_api_auth.make_it_later(middleware)
46
+ end
47
+
48
+ # private API, not sure if this will continue to be supported
49
+ def use_ui_auth middleware
50
+ @make_it_later_ui_auth.make_it_later(middleware)
51
+ end
52
+
34
53
  def call env
35
54
  running_app.call env
36
55
  end
@@ -73,15 +92,18 @@ module PactBroker
73
92
  def prepare_app
74
93
  configure_middleware
75
94
 
95
+ # need this first so UI login logic is performed before API login logic
96
+ @cascade_apps << build_ui
97
+
76
98
  if configuration.enable_diagnostic_endpoints
77
99
  @cascade_apps << build_diagnostic
78
100
  end
79
101
 
80
- @cascade_apps << build_ui
81
102
  @cascade_apps << build_api
82
103
  end
83
104
 
84
105
  def configure_middleware
106
+ # NOTE THAT NONE OF THIS IS PROTECTED BY AUTH - is that ok?
85
107
  @app_builder.use Rack::Protection, except: [:path_traversal, :remote_token, :session_hijacking, :http_origin]
86
108
  @app_builder.use Rack::PactBroker::InvalidUriProtection
87
109
  @app_builder.use Rack::PactBroker::AddPactBrokerVersionHeader
@@ -102,7 +124,8 @@ module PactBroker
102
124
  require 'pact_broker/ui'
103
125
  builder = ::Rack::Builder.new
104
126
  builder.use Rack::PactBroker::AcceptsHtmlFilter
105
- builder.use Rack::PactBroker::UIAuthentication
127
+ builder.use @make_it_later_ui_auth
128
+ builder.use Rack::PactBroker::UIAuthentication # deprecate?
106
129
  builder.run PactBroker::UI::App.new
107
130
  builder
108
131
  end
@@ -111,6 +134,7 @@ module PactBroker
111
134
  logger.info "Mounting PactBroker::API"
112
135
  require 'pact_broker/api'
113
136
  builder = ::Rack::Builder.new
137
+ builder.use @make_it_later_api_auth
114
138
  builder.use Rack::PactBroker::DatabaseTransaction, configuration.database_connection
115
139
  builder.run PactBroker::API
116
140
  builder
@@ -119,6 +143,7 @@ module PactBroker
119
143
  def build_diagnostic
120
144
  require 'pact_broker/diagnostic/app'
121
145
  builder = ::Rack::Builder.new
146
+ builder.use @make_it_later_api_auth
122
147
  builder.run PactBroker::Diagnostic::App.new
123
148
  builder
124
149
  end
@@ -8,7 +8,7 @@ module PactBroker
8
8
  def self.call database_connection, options = {}
9
9
  db_migrations_dir = PactBroker.project_root.join('db','migrations')
10
10
  puts "Running migrations in directory #{db_migrations_dir}, target=#{options.fetch(:target, 'end')}"
11
- Sequel::Migrator.run(database_connection, db_migrations_dir, options)
11
+ Sequel::TimestampMigrator.new(database_connection, db_migrations_dir, options).run
12
12
  end
13
13
  end
14
14
  end
@@ -2,11 +2,10 @@ module PactBroker
2
2
  module DB
3
3
  class Version
4
4
  def self.call database_connection
5
- # if database_connection.tables.include?(:schema_migrations)
6
- # last_migration_filename = database_connection[:schema_migrations].order(:filename).last[:filename]
7
- # last_migration_filename.split(MIGRATION_SPLITTER, 2).first.to_i
8
-
9
- if database_connection.tables.include?(:schema_info)
5
+ if database_connection.tables.include?(:schema_migrations)
6
+ last_migration_filename = database_connection[:schema_migrations].order(:filename).last[:filename]
7
+ last_migration_filename.split('_', 2).first.to_i
8
+ elsif database_connection.tables.include?(:schema_info)
10
9
  database_connection[:schema_info].first[:version]
11
10
  else
12
11
  0
@@ -18,7 +18,7 @@ module PactBroker
18
18
 
19
19
  def self.run_migrations database_connection
20
20
  Sequel.extension :migration
21
- Sequel::Migrator.run(database_connection, PactBroker::DB::MIGRATIONS_DIR)
21
+ Sequel::TimestampMigrator.new(database_connection, PactBroker::DB::MIGRATIONS_DIR).run
22
22
  end
23
23
 
24
24
  def self.validate_connection_config