avrolution 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c8a01c47fe881645fa084dcf2f50682e8331f8146e6a81cfd0cd603a0fd3fa7
4
- data.tar.gz: 8166c3cfb5bc0d43bd78895d557210cb1b1aee8dab79d050852ff8337f2a1a94
3
+ metadata.gz: 4b3862a46dc91450657388a917173dcbb34f5afde6712d2a851f705024fe4513
4
+ data.tar.gz: ad4f92d05e689c1b5730af204dcabb45b3eaf3473904be2cb099a2063f364f5e
5
5
  SHA512:
6
- metadata.gz: 7ef68aae87ccb46ac5b795ffe2b0f42d7d3decb7a5304b48e51aaf930e31c72997054db6bcc199cc750e236da93112b2a7470f1ee34a09a4bc4260ab72111d44
7
- data.tar.gz: 5a372cf915ff0dd6d0f60b81262bc6819a4f0938a8173344ec21beb770dce2a9bfa2b2b556469547cb4674279eabf525a122e44b844aa7c432add906a5d86654
6
+ metadata.gz: 1474ccedad91e3150272cecc235307694e470ef1c31e8d178b3eb7e8b87d42daf3ff20ee88e47fb61acc9a4981216f42bbcd9422b0554fecd89e57d8f7413808
7
+ data.tar.gz: 4370cfba23e467501af31a88451c5986013b1f9ac8fb53f98988e1cd7f00d9d778056aa5b7f8160604f4c3568fb01849f6d80eef602aaea9f5ddb13697021a53
@@ -0,0 +1 @@
1
+ * @jturkel @tjwp
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .ruby-version
data/CHANGELOG.md CHANGED
@@ -1,8 +1,20 @@
1
1
  # avrolution
2
2
 
3
+ ## v0.8.0
4
+
5
+ - Added the ability to register all schemas found under `Avrolution.root` with the task
6
+ `rake avro:register_all_schemas`.
7
+
8
+ ## v0.7.2
9
+ - Fix a bug related to Ruby 3.0 keyword arguments in
10
+ AvroSchemaRegistry::Client#register_without_lookup.
11
+
12
+ ## v0.7.1
13
+ - Adjust Rake task definitions to work with Ruby 3.0.
14
+
3
15
  ## v0.7.0
4
16
  - Add support for Ruby 3.0.
5
- - Drop support for Ruby < 2.5.
17
+ - Drop support for Ruby < 2.6.
6
18
  - Use frozen string literals.
7
19
 
8
20
  ## v0.6.1
data/README.md CHANGED
@@ -106,6 +106,24 @@ require 'avroluation/rake/register_schemas_task'
106
106
  Avrolution::Rake::RegisterSchemasTask.define
107
107
  ```
108
108
 
109
+ ### Avro Register All Schemas Rake Task
110
+
111
+ This rake task allows you to register all schemas discovered under `Avrolution.root`.
112
+
113
+ Similarly to the task `avro:register_schemas`, it will register them against the configured
114
+ registry. Additionally, this task will be auto included for Rails applications.
115
+
116
+ ```bash
117
+ rake avro:register_all_schemas
118
+ ```
119
+
120
+ For non-Rails projects, tasks can be defined as:
121
+
122
+ ```ruby
123
+ require 'avroluation/rake/register_all_schemas_task'
124
+ Avrolution::Rake::RegisterAllSchemasTask.define
125
+ ```
126
+
109
127
  ### Avro Add Compatibility Break Rake Task
110
128
 
111
129
  There is a rake task add an entry to the `Avrolution.compatibility_breaks_file`.
data/avrolution.gemspec CHANGED
@@ -19,13 +19,14 @@ Gem::Specification.new do |spec|
19
19
  # Set 'allowed_push_post' to control where this gem can be published.
20
20
  if spec.respond_to?(:metadata)
21
21
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
22
+ spec.metadata['rubygems_mfa_required'] = 'true'
22
23
  else
23
24
  raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
24
25
  end
25
26
 
26
27
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
- spec.bindir = 'bin'
28
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
28
+ spec.bindir = 'exe'
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
30
  spec.require_paths = ['lib']
30
31
 
31
32
  spec.required_ruby_version = '>= 2.6'
@@ -39,10 +39,7 @@ module Avrolution
39
39
  private
40
40
 
41
41
  def check_schemas(path)
42
- vendor_bundle_path = File.join(path, 'vendor/bundle/')
43
- Dir[File.join(path, '**/*.avsc')].reject do |file|
44
- file.start_with?(vendor_bundle_path)
45
- end.each do |schema_file|
42
+ Avrolution::DiscoverSchemas.discover(path).each do |schema_file|
46
43
  check_schema_compatibility(schema_file)
47
44
  end
48
45
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avrolution
4
+ class DiscoverSchemas
5
+ def self.discover(path)
6
+ vendor_bundle_path = File.join(path, 'vendor/bundle/')
7
+ Dir[File.join(path, '**/*.avsc')].reject do |file|
8
+ file.start_with?(vendor_bundle_path)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -6,7 +6,7 @@ module Avrolution
6
6
  module Rake
7
7
  class AddCompatibilityBreakTask < BaseTask
8
8
 
9
- def initialize(*)
9
+ def initialize(**)
10
10
  super
11
11
  @name ||= :add_compatibility_break
12
12
  @task_desc ||= 'Add an Avro schema compatibility break. Parameters: name, fingerprint, ' \
@@ -6,7 +6,7 @@ module Avrolution
6
6
  module Rake
7
7
  class CheckCompatibilityTask < BaseTask
8
8
 
9
- def initialize(*)
9
+ def initialize(**)
10
10
  super
11
11
  @name ||= :check_compatibility
12
12
  @task_desc ||= 'Check that all Avro schemas are compatible with latest registered in production'
@@ -2,8 +2,10 @@
2
2
 
3
3
  require 'avrolution/rake/check_compatibility_task'
4
4
  require 'avrolution/rake/add_compatibility_break_task'
5
+ require 'avrolution/rake/register_all_schemas_task'
5
6
  require 'avrolution/rake/register_schemas_task'
6
7
 
7
8
  Avrolution::Rake::AddCompatibilityBreakTask.define(dependencies: [:environment])
8
9
  Avrolution::Rake::CheckCompatibilityTask.define(dependencies: [:environment])
10
+ Avrolution::Rake::RegisterAllSchemasTask.define(dependencies: [:environment])
9
11
  Avrolution::Rake::RegisterSchemasTask.define(dependencies: [:environment])
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avrolution/rake/base_task'
4
+
5
+ module Avrolution
6
+ module Rake
7
+ class RegisterAllSchemasTask < BaseTask
8
+
9
+ def initialize(**)
10
+ super
11
+ @name ||= :register_all_schemas
12
+ @task_desc ||= 'Register all discovered Avro JSON schemas (using Avrolution.root)'
13
+ end
14
+
15
+ private
16
+
17
+ def perform
18
+ schemas = Avrolution::DiscoverSchemas.discover(Avrolution.root)
19
+
20
+ if schemas.blank?
21
+ puts 'could not find any schemas'
22
+ exit(1)
23
+ else
24
+ Avrolution::RegisterSchemas.call(schemas)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -6,7 +6,7 @@ module Avrolution
6
6
  module Rake
7
7
  class RegisterSchemasTask < BaseTask
8
8
 
9
- def initialize(*)
9
+ def initialize(**)
10
10
  super
11
11
  @name ||= :register_schemas
12
12
  @task_desc ||= 'Register the specified Avro JSON schemas'
@@ -40,11 +40,15 @@ module Avrolution
40
40
  compatibility_break = compatibility_breaks[[fullname, fingerprint]]
41
41
 
42
42
  begin
43
- schema_registry.register_without_lookup(
44
- fullname,
45
- json,
46
- compatibility_break.try(:register_options) || {}
47
- )
43
+ if compatibility_break
44
+ schema_registry.register_without_lookup(
45
+ fullname,
46
+ json,
47
+ **compatibility_break.register_options
48
+ )
49
+ else
50
+ schema_registry.register_without_lookup(fullname, json)
51
+ end
48
52
  rescue Excon::Error::Conflict
49
53
  raise IncompatibleSchemaError.new(fullname)
50
54
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avrolution
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.0'
5
5
  end
data/lib/avrolution.rb CHANGED
@@ -17,6 +17,7 @@ require 'avrolution/configuration'
17
17
  require 'avrolution/compatibility_break'
18
18
  require 'avrolution/compatibility_breaks_file'
19
19
  require 'avrolution/compatibility_check'
20
+ require 'avrolution/discover_schemas'
20
21
  require 'avrolution/register_schemas'
21
22
 
22
23
  require 'avrolution/railtie' if defined?(Rails)
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.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify, Inc
8
- autorequire:
9
- bindir: bin
8
+ autorequire:
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-15 00:00:00.000000000 Z
11
+ date: 2022-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -237,13 +237,12 @@ dependencies:
237
237
  description: Support for the evolution of Avro schemas stored in a schema registry.
238
238
  email:
239
239
  - engineering@salsify.com
240
- executables:
241
- - console
242
- - setup
240
+ executables: []
243
241
  extensions: []
244
242
  extra_rdoc_files: []
245
243
  files:
246
244
  - ".circleci/config.yml"
245
+ - ".github/CODEOWNERS"
247
246
  - ".gitignore"
248
247
  - ".overcommit.yml"
249
248
  - ".rspec"
@@ -261,11 +260,13 @@ files:
261
260
  - lib/avrolution/compatibility_breaks_file.rb
262
261
  - lib/avrolution/compatibility_check.rb
263
262
  - lib/avrolution/configuration.rb
263
+ - lib/avrolution/discover_schemas.rb
264
264
  - lib/avrolution/railtie.rb
265
265
  - lib/avrolution/rake/add_compatibility_break_task.rb
266
266
  - lib/avrolution/rake/base_task.rb
267
267
  - lib/avrolution/rake/check_compatibility_task.rb
268
268
  - lib/avrolution/rake/rails_avrolution.rake
269
+ - lib/avrolution/rake/register_all_schemas_task.rb
269
270
  - lib/avrolution/rake/register_schemas_task.rb
270
271
  - lib/avrolution/register_schemas.rb
271
272
  - lib/avrolution/version.rb
@@ -276,7 +277,8 @@ licenses:
276
277
  - MIT
277
278
  metadata:
278
279
  allowed_push_host: https://rubygems.org
279
- post_install_message:
280
+ rubygems_mfa_required: 'true'
281
+ post_install_message:
280
282
  rdoc_options: []
281
283
  require_paths:
282
284
  - lib
@@ -291,8 +293,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
293
  - !ruby/object:Gem::Version
292
294
  version: '0'
293
295
  requirements: []
294
- rubygems_version: 3.1.4
295
- signing_key:
296
+ rubygems_version: 3.2.22
297
+ signing_key:
296
298
  specification_version: 4
297
299
  summary: Support for the evolution of Avro schemas stored in a schema registry.
298
300
  test_files: []