pact_broker 1.6.0 → 1.7.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 +4 -0
- data/lib/pact_broker/api/contracts/consumer_version_number_validation.rb +2 -7
- data/lib/pact_broker/api/contracts/put_pact_params_contract.rb +0 -1
- data/lib/pact_broker/app.rb +1 -1
- data/lib/pact_broker/configuration.rb +4 -2
- data/lib/pact_broker/domain/group.rb +1 -3
- data/lib/pact_broker/domain/order_versions.rb +3 -3
- data/lib/pact_broker/locale/en.yml +2 -2
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/versions/parse_semantic_version.rb +17 -0
- data/spec/lib/pact_broker/api/contracts/put_pact_params_contract_spec.rb +1 -1
- data/spec/lib/pact_broker/domain/order_versions_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d2bef5e5437959448b15a75ea7b521c759230ea
|
4
|
+
data.tar.gz: b160d8c66c450e5fd20d0a9c629c819249967191
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe2da2b3ccd031e076334878f8e23fc543d17147e1a2ebf3bd209d20a55d2693826febadd760962514c20ee42bb5ed89f862128308fa541320a40479c900ef4a
|
7
|
+
data.tar.gz: 31f2080bbed54f778972966987629973738ed2e4e9f0a6808f1a184b7bbb6d1bb7c525e38febc9bdc486702cc19c53f65d3b86b30e2e9eb008796473e5cd332c
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@ Do this to generate your change history
|
|
2
2
|
|
3
3
|
$ git log --pretty=format:' * %h - %s (%an, %ad)' vX.Y.Z..HEAD
|
4
4
|
|
5
|
+
#### 1.7.0 (2015-03-20)
|
6
|
+
|
7
|
+
* a26402c - Allow configuration of version parsing. (Beth Skurrie, Tue Apr 14 09:39:05 2015 +1000)
|
8
|
+
|
5
9
|
#### 1.6.0 (2015-03-20)
|
6
10
|
|
7
11
|
* e20e657 - Added support for JSON contracts that are not in the Pact format (e.g. top level is an array) (Beth Skurrie, Fri Mar 20 19:12:46 2015 +1100)
|
@@ -18,14 +18,9 @@ module PactBroker
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def invalid_consumer_version_number?
|
21
|
-
|
22
|
-
|
23
|
-
false
|
24
|
-
rescue Versionomy::Errors::ParseError => e
|
25
|
-
true
|
26
|
-
end
|
21
|
+
parsed_version_number = PactBroker.configuration.version_parser.call consumer_version_number
|
22
|
+
parsed_version_number.nil?
|
27
23
|
end
|
28
|
-
|
29
24
|
end
|
30
25
|
end
|
31
26
|
end
|
data/lib/pact_broker/app.rb
CHANGED
@@ -7,7 +7,7 @@ module PactBroker
|
|
7
7
|
class Configuration
|
8
8
|
|
9
9
|
attr_accessor :log_dir, :database_connection, :auto_migrate_db, :use_hal_browser, :html_pact_renderer
|
10
|
-
attr_accessor :validate_database_connection_config, :enable_diagnostic_endpoints
|
10
|
+
attr_accessor :validate_database_connection_config, :enable_diagnostic_endpoints, :version_parser
|
11
11
|
attr_writer :logger
|
12
12
|
|
13
13
|
def logger
|
@@ -15,6 +15,7 @@ module PactBroker
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.default_configuration
|
18
|
+
require 'pact_broker/versions/parse_semantic_version'
|
18
19
|
config = Configuration.new
|
19
20
|
config.log_dir = File.expand_path("./log")
|
20
21
|
config.auto_migrate_db = true
|
@@ -22,6 +23,7 @@ module PactBroker
|
|
22
23
|
config.html_pact_renderer = default_html_pact_render
|
23
24
|
config.validate_database_connection_config = true
|
24
25
|
config.enable_diagnostic_endpoints = true
|
26
|
+
config.version_parser = PactBroker::Versions::ParseSemanticVersion
|
25
27
|
config
|
26
28
|
end
|
27
29
|
|
@@ -47,4 +49,4 @@ module PactBroker
|
|
47
49
|
|
48
50
|
end
|
49
51
|
|
50
|
-
end
|
52
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'pact_broker/configuration'
|
2
2
|
|
3
3
|
module PactBroker
|
4
4
|
module Domain
|
@@ -15,7 +15,7 @@ module PactBroker
|
|
15
15
|
|
16
16
|
def initialize version_model
|
17
17
|
@version_model = version_model
|
18
|
-
@sortable_number =
|
18
|
+
@sortable_number = PactBroker.configuration.version_parser.call version_model.number
|
19
19
|
end
|
20
20
|
|
21
21
|
def <=> other
|
@@ -30,4 +30,4 @@ module PactBroker
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
-
end
|
33
|
+
end
|
@@ -8,8 +8,8 @@ en:
|
|
8
8
|
invalid_url: "Invalid URL '%{url}'. Expected format: http://example.org"
|
9
9
|
pact_missing_pacticipant_name: "was not found at expected path $.%{pacticipant}.name in the submitted pact file."
|
10
10
|
consumer_version_number_missing: "Please specify the consumer version number by setting the X-Pact-Consumer-Version header."
|
11
|
-
consumer_version_number_header_invalid: "X-Pact-Consumer-Version '%{consumer_version_number}'
|
12
|
-
consumer_version_number_invalid: "Consumer version number '%{consumer_version_number}'
|
11
|
+
consumer_version_number_header_invalid: "X-Pact-Consumer-Version '%{consumer_version_number}' cannot be parsed to a version number. The expected format (unless this configuration has been overridden) is a semantic version. eg. 1.3.0 or 2.0.4.rc1"
|
12
|
+
consumer_version_number_invalid: "Consumer version number '%{consumer_version_number}' cannot be parsed to a version number. The expected format (unless this configuration has been overridden) is a semantic version. eg. 1.3.0 or 2.0.4.rc1"
|
13
13
|
pacticipant_name_mismatch: "in pact ('%{name_in_pact}') does not match %{pacticipant} name in path ('%{name}')."
|
14
14
|
connection_encoding_not_utf8: "The Sequel connection encoding (%{encoding}) is strongly recommended to be \"utf8\". If you need to set it to %{encoding} for some particular reason, then disable this check by setting config.validate_database_connection_config = false"
|
15
15
|
duplicate_pacticipant: |
|
data/lib/pact_broker/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'versionomy'
|
2
|
+
|
3
|
+
module PactBroker
|
4
|
+
module Versions
|
5
|
+
class ParseSemanticVersion
|
6
|
+
|
7
|
+
def self.call string_version
|
8
|
+
begin
|
9
|
+
::Versionomy.parse(string_version)
|
10
|
+
rescue ::Versionomy::Errors::ParseError => e
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -62,7 +62,7 @@ module PactBroker
|
|
62
62
|
let(:attributes) { {consumer_version_number: 'blah'} }
|
63
63
|
|
64
64
|
it "returns an error" do
|
65
|
-
expect(subject.errors[:base]).to include "Consumer version number 'blah'
|
65
|
+
expect(subject.errors[:base].first).to include "Consumer version number 'blah' cannot be parsed to a version number."
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
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: 1.
|
4
|
+
version: 1.7.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: 2015-
|
13
|
+
date: 2015-04-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
@@ -522,6 +522,7 @@ files:
|
|
522
522
|
- lib/pact_broker/ui/views/layouts/main.haml
|
523
523
|
- lib/pact_broker/ui/views/relationships/show.haml
|
524
524
|
- lib/pact_broker/version.rb
|
525
|
+
- lib/pact_broker/versions/parse_semantic_version.rb
|
525
526
|
- lib/rack/hal_browser.rb
|
526
527
|
- lib/rack/hal_browser/redirect.rb
|
527
528
|
- lib/rack/pact_broker/convert_file_extension_to_accept_header.rb
|