avro-gen-ruby 0.1.0 → 0.1.1
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 +10 -0
- data/lib/avro_gen/upgrader.rb +3 -1
- data/lib/avro_gen/version.rb +1 -1
- data/spec/upgrader_spec.rb +56 -0
- metadata +5 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 47e26cc4677b221fea2ad73e0d6cceda5c2189637c85bc42b0a1611d5213a6a9
|
|
4
|
+
data.tar.gz: 2ae7e653c01ad4d305b14a1013c69e5cb99ed1c5b70f4a25d60c257584c875d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 76c98787b2c2ae3039856fbdda61c379cb23c94fab2a18cc8970c9ef49ed867dc95b3c6cd87f13d06838f3e1648c7f8e2113361fc570bde4dda66792ffeb81c0
|
|
7
|
+
data.tar.gz: 332e3c76debd05087a80a250c7f4437c82f3bd85936ec7adbfaa2be93cff2deabdf11a50d98d1d4ede5922d0d4d0e585c81bb5a00545ec795a4dde6466976853
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## UNRELEASED
|
|
9
|
+
|
|
10
|
+
# 0.1.1 - 2026-06-29
|
data/lib/avro_gen/upgrader.rb
CHANGED
|
@@ -11,7 +11,9 @@ module AvroGen
|
|
|
11
11
|
'Deimos::SchemaClass::Record' => 'AvroGen::SchemaClass::Record',
|
|
12
12
|
'Deimos::SchemaClass::Enum' => 'AvroGen::SchemaClass::Enum',
|
|
13
13
|
'Deimos::SchemaClass::Base' => 'AvroGen::SchemaClass::Base',
|
|
14
|
-
'Deimos::Utils::SchemaClass' => 'AvroGen::SchemaClass'
|
|
14
|
+
'Deimos::Utils::SchemaClass' => 'AvroGen::SchemaClass',
|
|
15
|
+
# The autogenerated-by header that older Deimos-generated files carry.
|
|
16
|
+
'autogenerated by Deimos' => 'autogenerated by AvroGen'
|
|
15
17
|
}.freeze
|
|
16
18
|
|
|
17
19
|
class << self
|
data/lib/avro_gen/version.rb
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'avro_gen/upgrader'
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
|
|
6
|
+
RSpec.describe AvroGen::Upgrader do
|
|
7
|
+
describe '.rewrite' do
|
|
8
|
+
it 'rewrites the Deimos schema-class superclasses' do
|
|
9
|
+
expect(described_class.rewrite('class Foo < Deimos::SchemaClass::Record')).
|
|
10
|
+
to eq('class Foo < AvroGen::SchemaClass::Record')
|
|
11
|
+
expect(described_class.rewrite('class E < Deimos::SchemaClass::Enum')).
|
|
12
|
+
to eq('class E < AvroGen::SchemaClass::Enum')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'rewrites the Deimos::Utils::SchemaClass helper' do
|
|
16
|
+
expect(described_class.rewrite('Deimos::Utils::SchemaClass.instance({}, "Foo")')).
|
|
17
|
+
to eq('AvroGen::SchemaClass.instance({}, "Foo")')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'rewrites the autogenerated-by header' do
|
|
21
|
+
expect(described_class.rewrite('# This file is autogenerated by Deimos, Do NOT modify')).
|
|
22
|
+
to eq('# This file is autogenerated by AvroGen, Do NOT modify')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'leaves already-migrated content untouched' do
|
|
26
|
+
content = "# This file is autogenerated by AvroGen, Do NOT modify\nclass Foo < AvroGen::SchemaClass::Record\nend\n"
|
|
27
|
+
expect(described_class.rewrite(content)).to eq(content)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe '.run' do
|
|
32
|
+
let(:dir) { 'spec/app/upgrade' }
|
|
33
|
+
|
|
34
|
+
before(:each) do
|
|
35
|
+
FileUtils.mkdir_p(dir)
|
|
36
|
+
File.write("#{dir}/foo.rb", <<~RUBY)
|
|
37
|
+
# This file is autogenerated by Deimos, Do NOT modify
|
|
38
|
+
module Schemas
|
|
39
|
+
class Foo < Deimos::SchemaClass::Record; end
|
|
40
|
+
end
|
|
41
|
+
RUBY
|
|
42
|
+
File.write("#{dir}/already.rb", "class Bar < AvroGen::SchemaClass::Record; end\n")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
after(:each) do
|
|
46
|
+
FileUtils.rm_rf('spec/app')
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'rewrites files that need it and returns them' do
|
|
50
|
+
changed = described_class.run(path: dir)
|
|
51
|
+
expect(changed).to eq(["#{dir}/foo.rb"])
|
|
52
|
+
expect(File.read("#{dir}/foo.rb")).to include('autogenerated by AvroGen', 'AvroGen::SchemaClass::Record')
|
|
53
|
+
expect(File.read("#{dir}/foo.rb")).not_to include('Deimos')
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: avro-gen-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Orner
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activesupport
|
|
@@ -136,7 +135,6 @@ dependencies:
|
|
|
136
135
|
- - "~>"
|
|
137
136
|
- !ruby/object:Gem::Version
|
|
138
137
|
version: '3.0'
|
|
139
|
-
description:
|
|
140
138
|
email:
|
|
141
139
|
- daniel.orner@flipp.com
|
|
142
140
|
executables: []
|
|
@@ -148,6 +146,7 @@ files:
|
|
|
148
146
|
- ".gitignore"
|
|
149
147
|
- ".rspec"
|
|
150
148
|
- ".rubocop.yml"
|
|
149
|
+
- CHANGELOG.md
|
|
151
150
|
- Gemfile
|
|
152
151
|
- LICENSE
|
|
153
152
|
- README.md
|
|
@@ -238,12 +237,12 @@ files:
|
|
|
238
237
|
- spec/snapshots/namespace_folders.snap
|
|
239
238
|
- spec/snapshots/namespace_map.snap
|
|
240
239
|
- spec/spec_helper.rb
|
|
240
|
+
- spec/upgrader_spec.rb
|
|
241
241
|
homepage: https://github.com/flipp-oss/avro-gen-ruby
|
|
242
242
|
licenses:
|
|
243
243
|
- MIT
|
|
244
244
|
metadata:
|
|
245
245
|
rubygems_mfa_required: 'true'
|
|
246
|
-
post_install_message:
|
|
247
246
|
rdoc_options: []
|
|
248
247
|
require_paths:
|
|
249
248
|
- lib
|
|
@@ -258,8 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
258
257
|
- !ruby/object:Gem::Version
|
|
259
258
|
version: '0'
|
|
260
259
|
requirements: []
|
|
261
|
-
rubygems_version:
|
|
262
|
-
signing_key:
|
|
260
|
+
rubygems_version: 4.0.10
|
|
263
261
|
specification_version: 4
|
|
264
262
|
summary: Generate Ruby schema classes from Avro schemas.
|
|
265
263
|
test_files: []
|