deimos-ruby 1.13.2 → 1.13.3
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 +4 -0
- data/lib/deimos/schema_class/base.rb +17 -0
- data/lib/deimos/test_helpers.rb +1 -1
- data/lib/deimos/version.rb +1 -1
- data/lib/generators/deimos/active_record/templates/migration.rb.tt +5 -3
- data/lib/generators/deimos/active_record_generator.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59719a901339d9ebf5806a71e960fc68a7e75a1a217e6003215a42db04edb261
|
4
|
+
data.tar.gz: f9e8f274825a78298779061cf279b563d7ec40948e34ceff4458a51f51dea6b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62489d41c135b8141b45cf2a3b71717fc41bed0a22b26cfadd5ad22635d1f3a4ca770f7321cf5205159dd0a1f879ea6a9628623b3c5c3d9205a533d179ba7b52
|
7
|
+
data.tar.gz: 689f66152efe31e6b65c0eea5db5471c2a927708ca2bdcad9a859b32b85ecf1f789efefbee71059d9351c2b7a332b90be093330fd3e5be375d3c0a92b44c7837
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## UNRELEASED
|
9
9
|
|
10
|
+
- Some cleanup on the active_record generator
|
11
|
+
- Fix crash with `test_consume_message` when using schema classes
|
12
|
+
- Add `[]=` and `merge` methods on the base schema class
|
13
|
+
|
10
14
|
# 1.13.2 - 2022-04-07
|
11
15
|
|
12
16
|
- Fix an issue with generating schema classes for schemas containing an enum with default value
|
@@ -29,6 +29,23 @@ module Deimos
|
|
29
29
|
raise NotImplementedError
|
30
30
|
end
|
31
31
|
|
32
|
+
# @param key [String|Symbol]
|
33
|
+
# @param val [Object]
|
34
|
+
def []=(key, val)
|
35
|
+
self.send("#{key}=", val)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Merge a hash or an identical schema object with this one and return a new object.
|
39
|
+
# @param other_hash [Hash|SchemaClasses::Base]
|
40
|
+
# @return [SchemaClasses::Base]
|
41
|
+
def merge(other_hash)
|
42
|
+
obj = self.class.new(**self.to_h.symbolize_keys)
|
43
|
+
other_hash.to_h.each do |k, v|
|
44
|
+
obj.send("#{k}=", v)
|
45
|
+
end
|
46
|
+
obj
|
47
|
+
end
|
48
|
+
|
32
49
|
# :nodoc:
|
33
50
|
def ==(other)
|
34
51
|
comparison = other
|
data/lib/deimos/test_helpers.rb
CHANGED
@@ -188,7 +188,7 @@ module Deimos
|
|
188
188
|
&block)
|
189
189
|
raise 'Cannot have both call_original and be given a block!' if call_original && block_given?
|
190
190
|
|
191
|
-
payload
|
191
|
+
payload.stringify_keys! if payload.respond_to?(:stringify_keys!)
|
192
192
|
handler_class = if handler_class_or_topic.is_a?(String)
|
193
193
|
_get_handler_class_from_topic(handler_class_or_topic)
|
194
194
|
else
|
data/lib/deimos/version.rb
CHANGED
@@ -6,7 +6,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version
|
|
6
6
|
end
|
7
7
|
create_table :<%= table_name %> do |t|
|
8
8
|
<%- fields.each do |key| -%>
|
9
|
-
<%- next if %w(id message_id timestamp).include?(key.name) -%>
|
9
|
+
<%- next if %w(id message_id timestamp updated_at created_at).include?(key.name) -%>
|
10
10
|
<%- sql_type = schema_base.sql_type(key)
|
11
11
|
if %w(record array map).include?(sql_type)
|
12
12
|
conn = ActiveRecord::Base.connection
|
@@ -15,9 +15,11 @@ class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version
|
|
15
15
|
-%>
|
16
16
|
t.<%= sql_type %> :<%= key.name %>
|
17
17
|
<%- end -%>
|
18
|
-
end
|
19
18
|
|
20
|
-
|
19
|
+
t.timestamps
|
20
|
+
|
21
|
+
# TODO add indexes as necessary
|
22
|
+
end
|
21
23
|
end
|
22
24
|
|
23
25
|
def down
|
@@ -72,7 +72,7 @@ module Deimos
|
|
72
72
|
# :nodoc:
|
73
73
|
def generate
|
74
74
|
migration_template('migration.rb', "db/migrate/create_#{table_name.underscore}.rb")
|
75
|
-
template('model.rb', "app/models/#{table_name.underscore}.rb")
|
75
|
+
template('model.rb', "app/models/#{table_name.underscore.singularize}.rb")
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deimos-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.13.
|
4
|
+
version: 1.13.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Orner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro_turf
|