avromatic 0.1.2 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fb8a0d7d39b418c61b1e3200850528efe63e2c9
4
- data.tar.gz: 81205cfdbbf98d916391bc6078bc1ad00493df22
3
+ metadata.gz: e1da7b6df955352305598cea4f26f57f5caf2f18
4
+ data.tar.gz: 6644ededff6d0b7a74c76d88927235195d491049
5
5
  SHA512:
6
- metadata.gz: 9f999fb95a2c7d5542a7f9dce09b657e5f053927725cbdd927f9fde8fc07c66cc3093ffcc009fd0caa7adf57164a923091e9b100f5e55784b8444ee07e016419
7
- data.tar.gz: 862f360cfa99a1be15a36589e0101750a33c8fcb1cf8ad5037c0248383ebe1121c8fb2adf755549703716f64c321df666bd523da8b673989d45d0017302f7499
6
+ metadata.gz: f0c6b0617485d61017ba84dff71e711d987c1e3fffa6c8ae12334c0c4690149a2cb988f0503b9f8e2e84bedcb191574fd1bbbb00eac51cf2986210a97001c906
7
+ data.tar.gz: 0129ad7d75d3c2a6ef332a82f31d7794cde344954bf643e508729954add5bfa50a3274b73ed7998e0e54de6f47df25f2cfd37fbe49657b2b59b088cfcef618a0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # avromatic changelog
2
2
 
3
+ ## v0.2.0
4
+ - Allow a module level schema registry to be configured.
5
+
3
6
  ## v0.1.2
4
7
  - Do not build an `AvroTurf::Messaging` object for each model class.
5
8
 
data/README.md CHANGED
@@ -29,8 +29,12 @@ Or install it yourself as:
29
29
 
30
30
  `Avromatic` supports the following configuration:
31
31
 
32
+ * schema_registry: An `AvroTurf::SchemaRegistry` object used to store Avro schemas
33
+ so that they can be referenced by id. Either `schema_registry` or
34
+ `registry_url` must be configured.
32
35
  * registry_url: URL for the schema registry. The schema registry is used to store
33
- Avro schemas so that they can be referenced by id.
36
+ Avro schemas so that they can be referenced by id. Either `schema_registry` or
37
+ `registry_url` must be configured.
34
38
  * schema_store: The schema store is used to load Avro schemas from the filesystem.
35
39
  It should be an object that responds to `find(name, namespace = nil)` and
36
40
  returns an `Avro::Schema` object.
data/lib/avromatic.rb CHANGED
@@ -5,7 +5,7 @@ require 'avro_turf/messaging'
5
5
 
6
6
  module Avromatic
7
7
  class << self
8
- attr_accessor :registry_url, :schema_store, :logger, :messaging
8
+ attr_accessor :schema_registry, :registry_url, :schema_store, :logger, :messaging
9
9
  end
10
10
 
11
11
  self.logger = Logger.new($stdout)
@@ -21,12 +21,11 @@ module Avromatic
21
21
  end
22
22
 
23
23
  def self.build_messaging
24
- raise 'Avromatic must be configured with a registry_url' unless registry_url
25
24
  raise 'Avromatic must be configured with a schema_store' unless schema_store
26
25
  AvroTurf::Messaging.new(
27
- registry_url: Avromatic.registry_url,
28
- schema_store: Avromatic.schema_store,
29
- logger: Avromatic.logger)
26
+ registry: schema_registry || build_schema_registry,
27
+ schema_store: schema_store,
28
+ logger: logger)
30
29
  end
31
30
 
32
31
  def self.build_messaging!
@@ -46,6 +46,7 @@ module Avromatic
46
46
  @model_map = build_model_map(models)
47
47
  @schema_names_by_id = {}
48
48
  @schema_registry = schema_registry ||
49
+ Avromatic.schema_registry ||
49
50
  (registry_url && AvroTurf::SchemaRegistry.new(registry_url, logger: Avromatic.logger)) ||
50
51
  Avromatic.build_schema_registry
51
52
  end
@@ -1,3 +1,3 @@
1
1
  module Avromatic
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avromatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-09 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
242
  version: '0'
243
243
  requirements: []
244
244
  rubyforge_project:
245
- rubygems_version: 2.4.8
245
+ rubygems_version: 2.4.7
246
246
  signing_key:
247
247
  specification_version: 4
248
248
  summary: Generate Ruby models from Avro schemas