avrolution 0.4.0.rc0 → 0.4.0.rc1
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 +3 -0
- data/README.md +8 -8
- data/lib/avrolution/configuration.rb +18 -11
- data/lib/avrolution/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6828c0755e2ea2576aa2b0e5cdcc45cc76e32d04
|
4
|
+
data.tar.gz: 06f859b1c6b91e4b2feb61f7fa30607b66f2c469
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fac16048c96d048c2642c80882cac45f496d4ad779da7b2e8cb75d4fa428bdf42f071b918fcfe6394b2c1c0eddbf28b28a1e9e505c458ee6974496b33230e771
|
7
|
+
data.tar.gz: 14471e54f6de841e73b7f831a1e899ace19df23de9639fcb2a6e9a8ab9877a097c1ec9f147b762f27e1580027ea8e19cfa8377c0fe3c2b7dc53ccad8db7e1fb6
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
## v0.4.0
|
4
4
|
- Support a Proc for the configuration of `compatibility_schema_registry_url`
|
5
5
|
and `deployment_schema_registry_url`.
|
6
|
+
- Environment variables now take priority over assigned values for
|
7
|
+
`Avrolution.compatibility_schema_registry_url` and
|
8
|
+
`Avrolution.deployment_schema_registry_url`.
|
6
9
|
|
7
10
|
## v0.3.0
|
8
11
|
- Add rake task to register new schema versions.
|
data/README.md
CHANGED
@@ -39,11 +39,11 @@ The gem supports the following configuration:
|
|
39
39
|
* `compatibility_breaks_file` - The path to the compability breaks file. Defaults
|
40
40
|
to `#{Avrolution}.root/avro_compatibility_breaks.txt`.
|
41
41
|
* `compatibility_schema_registry_url` - The URL for the schema registry to use
|
42
|
-
for compatibility checking
|
43
|
-
|
42
|
+
for compatibility checking, or a Proc to determine the value.
|
43
|
+
`ENV['COMPATIBILITY_SCHEMA_REGISTRY_URL']` overrides this value if set.
|
44
44
|
* `deployment_schema_registry_url` - The URL for the schema registry to use
|
45
|
-
when registering new schema version.
|
46
|
-
|
45
|
+
when registering new schema version, or a Proc to determine the value.
|
46
|
+
`ENV['DEPLOYMENT_SCHEMA_REGISTRY_URL']` overrides this value if set.
|
47
47
|
* `logger` - A logger used by the rake tasks in this gem. This does _NOT_ default
|
48
48
|
to `Rails.logger` in Rails applications.
|
49
49
|
|
@@ -59,8 +59,8 @@ defined via a Railtie.
|
|
59
59
|
|
60
60
|
This task does not require any arguments. It checks the
|
61
61
|
compatibility of all Avro JSON schemas found recursively under `Avrolution.root`
|
62
|
-
against the schema registry `
|
63
|
-
`
|
62
|
+
against the schema registry `ENV['COMPATIBILITY_SCHEMA_REGISTRY_URL']` or
|
63
|
+
`Avroluion.compatibility_schema_registry_url`.
|
64
64
|
|
65
65
|
```bash
|
66
66
|
rake avro:check_compatibility
|
@@ -92,8 +92,8 @@ rake avro:register_schemas schemas=/app/avro/schemas/one.avsc,/app/avro/schema/t
|
|
92
92
|
```
|
93
93
|
|
94
94
|
Schemas are registered against the schema registry
|
95
|
-
`
|
96
|
-
`
|
95
|
+
`ENV['DEPLOYMENT_SCHEMA_REGISTRY_URL']` or
|
96
|
+
`Avroluion.deployment_schema_registry_url`.
|
97
97
|
|
98
98
|
The `Avrolution.compatibility_breaks_file` is consulted prior to registering the
|
99
99
|
schema, and if an entry is found then the specified compatibility settings are
|
@@ -1,8 +1,5 @@
|
|
1
1
|
module Avrolution
|
2
2
|
|
3
|
-
COMPATIBILITY_SCHEMA_REGISTRY_URL = 'COMPATIBILITY_SCHEMA_REGISTRY_URL'.freeze
|
4
|
-
DEPLOYMENT_SCHEMA_REGISTRY_URL = 'DEPLOYMENT_SCHEMA_REGISTRY_URL'.freeze
|
5
|
-
|
6
3
|
class << self
|
7
4
|
# Root directory to search for schemas, and default location for
|
8
5
|
# compatibility breaks file
|
@@ -21,6 +18,22 @@ module Avrolution
|
|
21
18
|
attr_writer :deployment_schema_registry_url
|
22
19
|
|
23
20
|
attr_accessor :logger
|
21
|
+
|
22
|
+
def fetch_url(label)
|
23
|
+
env_name = "#{label.upcase}_SCHEMA_REGISTRY_URL"
|
24
|
+
ivar_name = "@#{env_name.downcase}"
|
25
|
+
env_value = ENV[env_name]
|
26
|
+
result = if env_value
|
27
|
+
env_value
|
28
|
+
elsif instance_variable_get(ivar_name)
|
29
|
+
ivar_value = instance_variable_get(ivar_name)
|
30
|
+
ivar_value = instance_variable_set(ivar_name, ivar_value.call) if ivar_value.is_a?(Proc)
|
31
|
+
ivar_value
|
32
|
+
end
|
33
|
+
|
34
|
+
raise "#{env_name.downcase} must be set" if result.blank?
|
35
|
+
result
|
36
|
+
end
|
24
37
|
end
|
25
38
|
|
26
39
|
self.logger = Avrolution::PassthruLogger.new($stdout)
|
@@ -34,17 +47,11 @@ module Avrolution
|
|
34
47
|
end
|
35
48
|
|
36
49
|
def self.compatibility_schema_registry_url
|
37
|
-
|
38
|
-
@compatibility_schema_registry_url ||= ENV.fetch(COMPATIBILITY_SCHEMA_REGISTRY_URL) do
|
39
|
-
raise 'compatibility_schema_registry_url must be set'
|
40
|
-
end
|
50
|
+
fetch_url('compatibility')
|
41
51
|
end
|
42
52
|
|
43
53
|
def self.deployment_schema_registry_url
|
44
|
-
|
45
|
-
@deployment_schema_registry_url ||= ENV.fetch(DEPLOYMENT_SCHEMA_REGISTRY_URL) do
|
46
|
-
raise 'deployment_schema_registry_url must be set'
|
47
|
-
end
|
54
|
+
fetch_url('deployment')
|
48
55
|
end
|
49
56
|
|
50
57
|
def self.configure
|
data/lib/avrolution/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avrolution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.0.
|
4
|
+
version: 0.4.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salsify, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|