table_sync 6.0.4 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -2
- data/.rubocop.yml +12 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +152 -138
- data/README.md +1 -7
- data/lib/table_sync/errors.rb +3 -2
- data/lib/table_sync/instrument.rb +24 -2
- data/lib/table_sync/orm_adapter/active_record.rb +4 -4
- data/lib/table_sync/orm_adapter/base.rb +6 -4
- data/lib/table_sync/orm_adapter/sequel.rb +6 -6
- data/lib/table_sync/publishing/data/raw.rb +9 -5
- data/lib/table_sync/publishing/message/raw.rb +8 -9
- data/lib/table_sync/publishing/params/raw.rb +3 -1
- data/lib/table_sync/publishing/raw.rb +3 -1
- data/lib/table_sync/receiving/config.rb +2 -2
- data/lib/table_sync/receiving/handler.rb +3 -3
- data/lib/table_sync/receiving/model/active_record.rb +2 -2
- data/lib/table_sync/receiving/model/sequel.rb +1 -1
- data/lib/table_sync/setup/active_record.rb +1 -1
- data/lib/table_sync/setup/base.rb +1 -1
- data/lib/table_sync/setup/sequel.rb +1 -1
- data/lib/table_sync/version.rb +1 -1
- data/lib/table_sync.rb +12 -1
- data/table_sync.gemspec +1 -1
- metadata +4 -11
- data/docs/message_protocol.md +0 -24
- data/docs/notifications.md +0 -45
- data/docs/publishing/configuration.md +0 -143
- data/docs/publishing/manual.md +0 -155
- data/docs/publishing/publishers.md +0 -162
- data/docs/publishing.md +0 -80
- data/docs/receiving.md +0 -346
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10bb9ae0cf3986bb7feba1c61403b8d459a7bc8efc3dc3bcbf3db47306efee5e
|
4
|
+
data.tar.gz: 1d3d5b855d79efb73e2816ac617b8b73c1a85cc2a3e0cb9b2f975f07c86e0de3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f569ca939a161a9e1a17f998066cbdf86483b28f4742efd1fd614a33689cbe7e6aa5cadba85e973b271337cc3207e9535e1ddcb42949f53948d444121d107d32
|
7
|
+
data.tar.gz: 78ab27afcdb65a1dd0baaafe8f83f5812822bb5cdf002b3b9b31c3619c6ccc74d331e130f2170aa1d9063e36c88c05e24c8f8dc8dbeb2d08241a90cdd4a85603
|
data/.github/workflows/ci.yml
CHANGED
@@ -30,7 +30,7 @@ jobs:
|
|
30
30
|
strategy:
|
31
31
|
fail-fast: false
|
32
32
|
matrix:
|
33
|
-
ruby: ["2.
|
33
|
+
ruby: ["2.7", "3.0", "3.1"]
|
34
34
|
|
35
35
|
name: ${{ matrix.ruby }}
|
36
36
|
|
@@ -47,6 +47,6 @@ jobs:
|
|
47
47
|
- run: bundle exec rubocop
|
48
48
|
- run: bundle exec rspec
|
49
49
|
|
50
|
-
- uses: coverallsapp/github-action@
|
50
|
+
- uses: coverallsapp/github-action@master
|
51
51
|
with:
|
52
52
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
data/.rubocop.yml
CHANGED
@@ -2,7 +2,7 @@ inherit_gem:
|
|
2
2
|
rubocop-config-umbrellio: lib/rubocop.yml
|
3
3
|
|
4
4
|
AllCops:
|
5
|
-
TargetRubyVersion: 2.
|
5
|
+
TargetRubyVersion: 2.7
|
6
6
|
Include:
|
7
7
|
- bin/*
|
8
8
|
- lib/**/*.rb
|
@@ -35,3 +35,14 @@ Lint/MissingSuper:
|
|
35
35
|
|
36
36
|
Style/MissingRespondToMissing:
|
37
37
|
Enabled: false
|
38
|
+
|
39
|
+
Style/HashConversion:
|
40
|
+
Exclude:
|
41
|
+
- spec/**/*
|
42
|
+
|
43
|
+
Style/OpenStructUse:
|
44
|
+
Exclude:
|
45
|
+
- spec/**/*
|
46
|
+
|
47
|
+
RSpec/PendingWithoutReason:
|
48
|
+
Enabled: false # Many false positives
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [6.1.0] - 2022-11-24
|
5
|
+
### Changed
|
6
|
+
|
7
|
+
- Instead of using `object_class` for `TableSync::Publishing::Raw`, use `model_name`,
|
8
|
+
which accepts `String` instead of `Class`.
|
9
|
+
- Can manually disable notifications by setting `TableSync.notify = false`.
|
10
|
+
- `TableSync::Publishing::Raw` accepts two additional optional arguments: `table_name` and `schema`,
|
11
|
+
this attributes only used to fill information for the notification.
|
12
|
+
|
4
13
|
## [6.0.4] - 2022-02-05
|
5
14
|
### Fixed
|
6
15
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
table_sync (6.0
|
4
|
+
table_sync (6.1.0)
|
5
5
|
memery
|
6
6
|
rabbit_messaging
|
7
7
|
rails
|
@@ -10,107 +10,127 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actioncable (
|
14
|
-
actionpack (=
|
15
|
-
activesupport (=
|
13
|
+
actioncable (7.0.4.2)
|
14
|
+
actionpack (= 7.0.4.2)
|
15
|
+
activesupport (= 7.0.4.2)
|
16
16
|
nio4r (~> 2.0)
|
17
17
|
websocket-driver (>= 0.6.1)
|
18
|
-
actionmailbox (
|
19
|
-
actionpack (=
|
20
|
-
activejob (=
|
21
|
-
activerecord (=
|
22
|
-
activestorage (=
|
23
|
-
activesupport (=
|
18
|
+
actionmailbox (7.0.4.2)
|
19
|
+
actionpack (= 7.0.4.2)
|
20
|
+
activejob (= 7.0.4.2)
|
21
|
+
activerecord (= 7.0.4.2)
|
22
|
+
activestorage (= 7.0.4.2)
|
23
|
+
activesupport (= 7.0.4.2)
|
24
24
|
mail (>= 2.7.1)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
net-imap
|
26
|
+
net-pop
|
27
|
+
net-smtp
|
28
|
+
actionmailer (7.0.4.2)
|
29
|
+
actionpack (= 7.0.4.2)
|
30
|
+
actionview (= 7.0.4.2)
|
31
|
+
activejob (= 7.0.4.2)
|
32
|
+
activesupport (= 7.0.4.2)
|
30
33
|
mail (~> 2.5, >= 2.5.4)
|
34
|
+
net-imap
|
35
|
+
net-pop
|
36
|
+
net-smtp
|
31
37
|
rails-dom-testing (~> 2.0)
|
32
|
-
actionpack (
|
33
|
-
actionview (=
|
34
|
-
activesupport (=
|
35
|
-
rack (~> 2.0, >= 2.0
|
38
|
+
actionpack (7.0.4.2)
|
39
|
+
actionview (= 7.0.4.2)
|
40
|
+
activesupport (= 7.0.4.2)
|
41
|
+
rack (~> 2.0, >= 2.2.0)
|
36
42
|
rack-test (>= 0.6.3)
|
37
43
|
rails-dom-testing (~> 2.0)
|
38
44
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
39
|
-
actiontext (
|
40
|
-
actionpack (=
|
41
|
-
activerecord (=
|
42
|
-
activestorage (=
|
43
|
-
activesupport (=
|
45
|
+
actiontext (7.0.4.2)
|
46
|
+
actionpack (= 7.0.4.2)
|
47
|
+
activerecord (= 7.0.4.2)
|
48
|
+
activestorage (= 7.0.4.2)
|
49
|
+
activesupport (= 7.0.4.2)
|
50
|
+
globalid (>= 0.6.0)
|
44
51
|
nokogiri (>= 1.8.5)
|
45
|
-
actionview (
|
46
|
-
activesupport (=
|
52
|
+
actionview (7.0.4.2)
|
53
|
+
activesupport (= 7.0.4.2)
|
47
54
|
builder (~> 3.1)
|
48
55
|
erubi (~> 1.4)
|
49
56
|
rails-dom-testing (~> 2.0)
|
50
57
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
51
|
-
activejob (
|
52
|
-
activesupport (=
|
58
|
+
activejob (7.0.4.2)
|
59
|
+
activesupport (= 7.0.4.2)
|
53
60
|
globalid (>= 0.3.6)
|
54
|
-
activemodel (
|
55
|
-
activesupport (=
|
56
|
-
activerecord (
|
57
|
-
activemodel (=
|
58
|
-
activesupport (=
|
59
|
-
activestorage (
|
60
|
-
actionpack (=
|
61
|
-
activejob (=
|
62
|
-
activerecord (=
|
63
|
-
activesupport (=
|
64
|
-
marcel (~> 1.0
|
61
|
+
activemodel (7.0.4.2)
|
62
|
+
activesupport (= 7.0.4.2)
|
63
|
+
activerecord (7.0.4.2)
|
64
|
+
activemodel (= 7.0.4.2)
|
65
|
+
activesupport (= 7.0.4.2)
|
66
|
+
activestorage (7.0.4.2)
|
67
|
+
actionpack (= 7.0.4.2)
|
68
|
+
activejob (= 7.0.4.2)
|
69
|
+
activerecord (= 7.0.4.2)
|
70
|
+
activesupport (= 7.0.4.2)
|
71
|
+
marcel (~> 1.0)
|
65
72
|
mini_mime (>= 1.1.0)
|
66
|
-
activesupport (
|
73
|
+
activesupport (7.0.4.2)
|
67
74
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
68
75
|
i18n (>= 1.6, < 2)
|
69
76
|
minitest (>= 5.1)
|
70
77
|
tzinfo (~> 2.0)
|
71
|
-
zeitwerk (~> 2.3)
|
72
78
|
amq-protocol (2.3.2)
|
73
79
|
ast (2.4.2)
|
74
80
|
builder (3.2.4)
|
75
|
-
bundler-audit (0.
|
81
|
+
bundler-audit (0.9.1)
|
76
82
|
bundler (>= 1.2.0, < 3)
|
77
83
|
thor (~> 1.0)
|
78
|
-
bunny (2.
|
84
|
+
bunny (2.20.3)
|
79
85
|
amq-protocol (~> 2.3, >= 2.3.1)
|
80
86
|
sorted_set (~> 1, >= 1.0.2)
|
81
87
|
coderay (1.1.3)
|
82
|
-
concurrent-ruby (1.
|
88
|
+
concurrent-ruby (1.2.0)
|
83
89
|
crass (1.0.6)
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
90
|
+
date (3.3.3)
|
91
|
+
diff-lcs (1.5.0)
|
92
|
+
docile (1.4.0)
|
93
|
+
erubi (1.12.0)
|
94
|
+
globalid (1.1.0)
|
88
95
|
activesupport (>= 5.0)
|
89
|
-
i18n (1.
|
96
|
+
i18n (1.12.0)
|
90
97
|
concurrent-ruby (~> 1.0)
|
91
|
-
|
98
|
+
json (2.6.3)
|
99
|
+
lamian (1.7.0)
|
92
100
|
rails (>= 4.2)
|
93
|
-
loofah (2.
|
101
|
+
loofah (2.19.1)
|
94
102
|
crass (~> 1.0.2)
|
95
103
|
nokogiri (>= 1.5.9)
|
96
|
-
mail (2.
|
104
|
+
mail (2.8.1)
|
97
105
|
mini_mime (>= 0.1.1)
|
106
|
+
net-imap
|
107
|
+
net-pop
|
108
|
+
net-smtp
|
98
109
|
marcel (1.0.2)
|
99
110
|
memery (1.4.1)
|
100
111
|
ruby2_keywords (~> 0.0.2)
|
101
112
|
method_source (1.0.0)
|
102
113
|
mini_mime (1.1.2)
|
103
|
-
mini_portile2 (2.
|
104
|
-
minitest (5.
|
114
|
+
mini_portile2 (2.8.1)
|
115
|
+
minitest (5.17.0)
|
116
|
+
net-imap (0.3.4)
|
117
|
+
date
|
118
|
+
net-protocol
|
119
|
+
net-pop (0.1.2)
|
120
|
+
net-protocol
|
121
|
+
net-protocol (0.2.1)
|
122
|
+
timeout
|
123
|
+
net-smtp (0.3.3)
|
124
|
+
net-protocol
|
105
125
|
nio4r (2.5.8)
|
106
|
-
nokogiri (1.
|
107
|
-
mini_portile2 (~> 2.
|
126
|
+
nokogiri (1.14.2)
|
127
|
+
mini_portile2 (~> 2.8.0)
|
108
128
|
racc (~> 1.4)
|
109
|
-
parallel (1.
|
110
|
-
parser (3.
|
129
|
+
parallel (1.22.1)
|
130
|
+
parser (3.2.1.0)
|
111
131
|
ast (~> 2.4.1)
|
112
|
-
pg (1.
|
113
|
-
pry (0.14.
|
132
|
+
pg (1.4.5)
|
133
|
+
pry (0.14.2)
|
114
134
|
coderay (~> 1.1)
|
115
135
|
method_source (~> 1.0)
|
116
136
|
rabbit_messaging (0.12.1)
|
@@ -119,101 +139,101 @@ GEM
|
|
119
139
|
rails (>= 5.2)
|
120
140
|
sneakers (~> 2.0)
|
121
141
|
tainbox
|
122
|
-
racc (1.6.
|
123
|
-
rack (2.2.
|
124
|
-
rack-test (
|
125
|
-
rack (>= 1.
|
126
|
-
rails (
|
127
|
-
actioncable (=
|
128
|
-
actionmailbox (=
|
129
|
-
actionmailer (=
|
130
|
-
actionpack (=
|
131
|
-
actiontext (=
|
132
|
-
actionview (=
|
133
|
-
activejob (=
|
134
|
-
activemodel (=
|
135
|
-
activerecord (=
|
136
|
-
activestorage (=
|
137
|
-
activesupport (=
|
142
|
+
racc (1.6.2)
|
143
|
+
rack (2.2.6.2)
|
144
|
+
rack-test (2.0.2)
|
145
|
+
rack (>= 1.3)
|
146
|
+
rails (7.0.4.2)
|
147
|
+
actioncable (= 7.0.4.2)
|
148
|
+
actionmailbox (= 7.0.4.2)
|
149
|
+
actionmailer (= 7.0.4.2)
|
150
|
+
actionpack (= 7.0.4.2)
|
151
|
+
actiontext (= 7.0.4.2)
|
152
|
+
actionview (= 7.0.4.2)
|
153
|
+
activejob (= 7.0.4.2)
|
154
|
+
activemodel (= 7.0.4.2)
|
155
|
+
activerecord (= 7.0.4.2)
|
156
|
+
activestorage (= 7.0.4.2)
|
157
|
+
activesupport (= 7.0.4.2)
|
138
158
|
bundler (>= 1.15.0)
|
139
|
-
railties (=
|
140
|
-
sprockets-rails (>= 2.0.0)
|
159
|
+
railties (= 7.0.4.2)
|
141
160
|
rails-dom-testing (2.0.3)
|
142
161
|
activesupport (>= 4.2.0)
|
143
162
|
nokogiri (>= 1.6)
|
144
|
-
rails-html-sanitizer (1.
|
145
|
-
loofah (~> 2.
|
146
|
-
railties (
|
147
|
-
actionpack (=
|
148
|
-
activesupport (=
|
163
|
+
rails-html-sanitizer (1.5.0)
|
164
|
+
loofah (~> 2.19, >= 2.19.1)
|
165
|
+
railties (7.0.4.2)
|
166
|
+
actionpack (= 7.0.4.2)
|
167
|
+
activesupport (= 7.0.4.2)
|
149
168
|
method_source
|
150
|
-
rake (>=
|
169
|
+
rake (>= 12.2)
|
151
170
|
thor (~> 1.0)
|
152
|
-
|
171
|
+
zeitwerk (~> 2.5)
|
172
|
+
rainbow (3.1.1)
|
153
173
|
rake (13.0.6)
|
154
|
-
rbtree (0.4.
|
155
|
-
regexp_parser (2.
|
174
|
+
rbtree (0.4.6)
|
175
|
+
regexp_parser (2.7.0)
|
156
176
|
rexml (3.2.5)
|
157
|
-
rspec (3.
|
158
|
-
rspec-core (~> 3.
|
159
|
-
rspec-expectations (~> 3.
|
160
|
-
rspec-mocks (~> 3.
|
161
|
-
rspec-core (3.
|
162
|
-
rspec-support (~> 3.
|
163
|
-
rspec-expectations (3.
|
177
|
+
rspec (3.12.0)
|
178
|
+
rspec-core (~> 3.12.0)
|
179
|
+
rspec-expectations (~> 3.12.0)
|
180
|
+
rspec-mocks (~> 3.12.0)
|
181
|
+
rspec-core (3.12.1)
|
182
|
+
rspec-support (~> 3.12.0)
|
183
|
+
rspec-expectations (3.12.2)
|
164
184
|
diff-lcs (>= 1.2.0, < 2.0)
|
165
|
-
rspec-support (~> 3.
|
166
|
-
rspec-mocks (3.
|
185
|
+
rspec-support (~> 3.12.0)
|
186
|
+
rspec-mocks (3.12.3)
|
167
187
|
diff-lcs (>= 1.2.0, < 2.0)
|
168
|
-
rspec-support (~> 3.
|
169
|
-
rspec-support (3.
|
170
|
-
rubocop (1.
|
188
|
+
rspec-support (~> 3.12.0)
|
189
|
+
rspec-support (3.12.0)
|
190
|
+
rubocop (1.43.0)
|
191
|
+
json (~> 2.3)
|
171
192
|
parallel (~> 1.10)
|
172
|
-
parser (>= 3.
|
193
|
+
parser (>= 3.2.0.0)
|
173
194
|
rainbow (>= 2.2.2, < 4.0)
|
174
195
|
regexp_parser (>= 1.8, < 3.0)
|
175
|
-
rexml
|
176
|
-
rubocop-ast (>= 1.
|
196
|
+
rexml (>= 3.2.5, < 4.0)
|
197
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
177
198
|
ruby-progressbar (~> 1.7)
|
178
|
-
unicode-display_width (>=
|
179
|
-
rubocop-ast (1.
|
180
|
-
parser (>= 2.
|
181
|
-
rubocop-config-umbrellio (1.
|
182
|
-
rubocop (
|
183
|
-
rubocop-performance (
|
184
|
-
rubocop-rails (
|
185
|
-
rubocop-rake (
|
186
|
-
rubocop-rspec (
|
187
|
-
rubocop-sequel (
|
188
|
-
rubocop-performance (1.
|
189
|
-
rubocop (>=
|
199
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
200
|
+
rubocop-ast (1.26.0)
|
201
|
+
parser (>= 3.2.1.0)
|
202
|
+
rubocop-config-umbrellio (1.43.0.81)
|
203
|
+
rubocop (~> 1.43.0)
|
204
|
+
rubocop-performance (~> 1.15.0)
|
205
|
+
rubocop-rails (~> 2.17.0)
|
206
|
+
rubocop-rake (~> 0.6.0)
|
207
|
+
rubocop-rspec (~> 2.16.0)
|
208
|
+
rubocop-sequel (~> 0.3.3)
|
209
|
+
rubocop-performance (1.15.2)
|
210
|
+
rubocop (>= 1.7.0, < 2.0)
|
190
211
|
rubocop-ast (>= 0.4.0)
|
191
|
-
rubocop-rails (2.
|
212
|
+
rubocop-rails (2.17.4)
|
192
213
|
activesupport (>= 4.2.0)
|
193
214
|
rack (>= 1.1)
|
194
|
-
rubocop (>=
|
195
|
-
rubocop-rake (0.
|
196
|
-
rubocop
|
197
|
-
rubocop-rspec (2.2.0)
|
215
|
+
rubocop (>= 1.33.0, < 2.0)
|
216
|
+
rubocop-rake (0.6.0)
|
198
217
|
rubocop (~> 1.0)
|
199
|
-
|
200
|
-
|
218
|
+
rubocop-rspec (2.16.0)
|
219
|
+
rubocop (~> 1.33)
|
220
|
+
rubocop-sequel (0.3.4)
|
201
221
|
rubocop (~> 1.0)
|
202
222
|
ruby-progressbar (1.11.0)
|
203
223
|
ruby2_keywords (0.0.5)
|
204
|
-
self_data (1.
|
205
|
-
sequel (5.
|
224
|
+
self_data (1.3.0)
|
225
|
+
sequel (5.65.0)
|
206
226
|
serverengine (2.0.7)
|
207
227
|
sigdump (~> 0.2.2)
|
208
|
-
set (1.0.
|
228
|
+
set (1.0.3)
|
209
229
|
sigdump (0.2.4)
|
210
|
-
simplecov (0.
|
230
|
+
simplecov (0.22.0)
|
211
231
|
docile (~> 1.1)
|
212
232
|
simplecov-html (~> 0.11)
|
213
233
|
simplecov_json_formatter (~> 0.1)
|
214
234
|
simplecov-html (0.12.3)
|
215
235
|
simplecov-lcov (0.8.0)
|
216
|
-
simplecov_json_formatter (0.1.
|
236
|
+
simplecov_json_formatter (0.1.4)
|
217
237
|
sneakers (2.11.0)
|
218
238
|
bunny (~> 2.12)
|
219
239
|
concurrent-ruby (~> 1.0)
|
@@ -223,24 +243,18 @@ GEM
|
|
223
243
|
sorted_set (1.0.3)
|
224
244
|
rbtree
|
225
245
|
set (~> 1.0)
|
226
|
-
sprockets (4.0.2)
|
227
|
-
concurrent-ruby (~> 1.0)
|
228
|
-
rack (> 1, < 3)
|
229
|
-
sprockets-rails (3.4.2)
|
230
|
-
actionpack (>= 5.2)
|
231
|
-
activesupport (>= 5.2)
|
232
|
-
sprockets (>= 3.0.0)
|
233
246
|
tainbox (2.1.2)
|
234
247
|
activesupport
|
235
248
|
thor (1.2.1)
|
236
|
-
timecop (0.9.
|
237
|
-
|
249
|
+
timecop (0.9.6)
|
250
|
+
timeout (0.3.1)
|
251
|
+
tzinfo (2.0.6)
|
238
252
|
concurrent-ruby (~> 1.0)
|
239
|
-
unicode-display_width (2.
|
253
|
+
unicode-display_width (2.4.2)
|
240
254
|
websocket-driver (0.7.5)
|
241
255
|
websocket-extensions (>= 0.1.0)
|
242
256
|
websocket-extensions (0.1.5)
|
243
|
-
zeitwerk (2.
|
257
|
+
zeitwerk (2.6.7)
|
244
258
|
|
245
259
|
PLATFORMS
|
246
260
|
ruby
|
@@ -262,4 +276,4 @@ DEPENDENCIES
|
|
262
276
|
timecop
|
263
277
|
|
264
278
|
BUNDLED WITH
|
265
|
-
2.
|
279
|
+
2.4.6
|
data/README.md
CHANGED
@@ -20,13 +20,7 @@ require 'table_sync'
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
24
|
-
- [Publishing](docs/publishing.md)
|
25
|
-
- [Publishers](docs/publishing/publishers.md)
|
26
|
-
- [Configuration](docs/publishing/configuration.md)
|
27
|
-
- [Manual Sync (examples)](docs/publishing/manual.md)
|
28
|
-
- [Receiving](docs/receiving.md)
|
29
|
-
- [Notifications](docs/notifications.md)
|
23
|
+
Usage information available in the [Wiki](https://github.com/umbrellio/table_sync/wiki).
|
30
24
|
|
31
25
|
## Contributing
|
32
26
|
|
data/lib/table_sync/errors.rb
CHANGED
@@ -4,6 +4,7 @@ module TableSync
|
|
4
4
|
Error = Class.new(StandardError)
|
5
5
|
|
6
6
|
NoObjectsForSyncError = Class.new(Error)
|
7
|
+
InvalidConfig = Class.new(Error)
|
7
8
|
|
8
9
|
class EventError < Error
|
9
10
|
def initialize(event)
|
@@ -61,9 +62,9 @@ module TableSync
|
|
61
62
|
|
62
63
|
case type
|
63
64
|
when :req
|
64
|
-
|
65
|
+
# :nocov:
|
65
66
|
name.to_s
|
66
|
-
|
67
|
+
# :nocov:
|
67
68
|
when :keyreq
|
68
69
|
"#{name}:"
|
69
70
|
when :block
|
@@ -1,9 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module TableSync::Instrument
|
4
|
-
|
4
|
+
NOTIFIER_REQUIRED_ARGS = %i[table schema event count direction].freeze
|
5
|
+
|
6
|
+
extend self
|
5
7
|
|
6
8
|
def notify(**args)
|
7
|
-
TableSync.
|
9
|
+
return unless TableSync.notify?
|
10
|
+
raise(TableSync::InvalidConfig, error_message) if TableSync.notifier.nil?
|
11
|
+
validate_args!(**args)
|
12
|
+
|
13
|
+
TableSync.notifier.notify(**args)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def error_message
|
19
|
+
<<~MSG.squish
|
20
|
+
Notifications are enabled, but no notifier is set in the config.
|
21
|
+
Need to setup notifier by specifying TableSync#notifier setting.
|
22
|
+
MSG
|
23
|
+
end
|
24
|
+
|
25
|
+
def validate_args!(**args)
|
26
|
+
missing_keywords = NOTIFIER_REQUIRED_ARGS - args.compact.keys
|
27
|
+
return if missing_keywords.blank?
|
28
|
+
|
29
|
+
raise ArgumentError, "Missing keywords: #{missing_keywords.join(', ')}."
|
8
30
|
end
|
9
31
|
end
|
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
module TableSync::ORMAdapter
|
4
4
|
class ActiveRecord < Base
|
5
|
+
def self.model_naming(object_class)
|
6
|
+
TableSync::NamingResolver::ActiveRecord.new(table_name: object_class.table_name)
|
7
|
+
end
|
8
|
+
|
5
9
|
def find
|
6
10
|
@object = object_class.find_by(needle)
|
7
11
|
|
@@ -17,9 +21,5 @@ module TableSync::ORMAdapter
|
|
17
21
|
def attributes
|
18
22
|
object.attributes.symbolize_keys
|
19
23
|
end
|
20
|
-
|
21
|
-
def self.model_naming(object_class)
|
22
|
-
TableSync::NamingResolver::ActiveRecord.new(table_name: object_class.table_name)
|
23
|
-
end
|
24
24
|
end
|
25
25
|
end
|
@@ -4,6 +4,12 @@ module TableSync::ORMAdapter
|
|
4
4
|
class Base
|
5
5
|
attr_reader :object, :object_class, :object_data
|
6
6
|
|
7
|
+
# :nocov:
|
8
|
+
def self.model_naming
|
9
|
+
raise NotImplementedError
|
10
|
+
end
|
11
|
+
# :nocov:
|
12
|
+
|
7
13
|
def initialize(object_class, object_data)
|
8
14
|
@object_class = object_class
|
9
15
|
@object_data = object_data.symbolize_keys
|
@@ -83,10 +89,6 @@ module TableSync::ORMAdapter
|
|
83
89
|
def attributes
|
84
90
|
raise NotImplementedError
|
85
91
|
end
|
86
|
-
|
87
|
-
def self.model_naming
|
88
|
-
raise NotImplementedError
|
89
|
-
end
|
90
92
|
# :nocov:
|
91
93
|
end
|
92
94
|
end
|
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
module TableSync::ORMAdapter
|
4
4
|
class Sequel < Base
|
5
|
+
def self.model_naming(object_class)
|
6
|
+
TableSync::NamingResolver::Sequel.new(
|
7
|
+
table_name: object_class.table_name, db: object_class.db,
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
5
11
|
def attributes
|
6
12
|
object.values
|
7
13
|
end
|
@@ -19,11 +25,5 @@ module TableSync::ORMAdapter
|
|
19
25
|
|
20
26
|
super
|
21
27
|
end
|
22
|
-
|
23
|
-
def self.model_naming(object_class)
|
24
|
-
TableSync::NamingResolver::Sequel.new(
|
25
|
-
table_name: object_class.table_name, db: object_class.db,
|
26
|
-
)
|
27
|
-
end
|
28
28
|
end
|
29
29
|
end
|
@@ -2,24 +2,28 @@
|
|
2
2
|
|
3
3
|
module TableSync::Publishing::Data
|
4
4
|
class Raw
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :model_name, :attributes_for_sync, :event
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
@
|
7
|
+
def initialize(model_name:, attributes_for_sync:, event:)
|
8
|
+
@model_name = model_name
|
9
9
|
@attributes_for_sync = attributes_for_sync
|
10
10
|
@event = TableSync::Event.new(event)
|
11
11
|
end
|
12
12
|
|
13
13
|
def construct
|
14
14
|
{
|
15
|
-
model:
|
16
|
-
attributes:
|
15
|
+
model: model_name,
|
16
|
+
attributes: wrapped_attributes_for_sync,
|
17
17
|
version: version,
|
18
18
|
event: event.resolve,
|
19
19
|
metadata: event.metadata,
|
20
20
|
}
|
21
21
|
end
|
22
22
|
|
23
|
+
def wrapped_attributes_for_sync
|
24
|
+
attributes_for_sync.is_a?(Array) ? attributes_for_sync : [attributes_for_sync]
|
25
|
+
end
|
26
|
+
|
23
27
|
def version
|
24
28
|
Time.current.to_f
|
25
29
|
end
|