pub_sub_model_sync 0.2.3 → 0.2.4

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
  SHA256:
3
- metadata.gz: 3016ebc69eba9ccb8b168734db1b947b77a4c9400f48d8228f979a7c1ec9eab8
4
- data.tar.gz: 82187606c0411ece3eb0d78db59a8794019e80acd5374ffd92b95b0eee4368f7
3
+ metadata.gz: 7655730b3b89716b76be52db708b7c93ec64176cc158fc84323d4e811f6dcdf1
4
+ data.tar.gz: 874aa3f5c5c679fd3e7ec02550426f0824481194ebd99b1a0494180df3a22cc6
5
5
  SHA512:
6
- metadata.gz: f4335695f26d69f091a2ea1726221aab4b07b712827318adfe16f2d1275cde21a0860ce7562ed266f6a0661eb2b8d634abea0956a4478ad55f70e6c199c8a364
7
- data.tar.gz: 9252e45ab27b332d9b50afc93da62a0a039c707a1bb3b219ff4e60c1c4f3dae8eb7a85024fc3d1dab87c006e448e60cf3d1f3d953dad8cc8fced24bd375b47cd
6
+ metadata.gz: 9e8406293a7528fa5d697c2a6a30b4cb00cee900b349ef834fad5fd7771ce864a8338ac95bc1bcbe41568d9efa1737111720607cb0f002e684ab532e835ec651
7
+ data.tar.gz: 0f995774ddf1b916db02fed9051c26b106e549261877c72a718e9e23c45544dff6c9757231e094201c9d466b2c4922d8e6364f8167697820db5833d78ee85c85
@@ -0,0 +1,33 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+
10
+ jobs:
11
+ build:
12
+ name: Tests and Code Style
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Set up Ruby 2.6
18
+ uses: actions/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.6.x
21
+
22
+ - name: Install sqlite3
23
+ run: sudo apt-get install libsqlite3-dev
24
+
25
+ - name: Bundle install
26
+ run: |
27
+ gem install bundler
28
+ bundle install --jobs 4 --retry 3
29
+ - name: Tests (rspec)
30
+ run: |
31
+ bundle exec rspec
32
+ - name: Code style (Rubocop)
33
+ run: bundle exec rubocop
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ # 0.2.4 (April 28, 2020)
4
+ - Delegate .publish to the .publisher for better understanding
5
+
3
6
  # 0.2.3 (April 15, 2020)
4
7
  - Improve helper names
5
8
  - feat: perform manual sync with custom settings
@@ -1,58 +1,71 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pub_sub_model_sync (0.2.3)
4
+ pub_sub_model_sync (0.2.4)
5
5
  activesupport
6
6
  rails
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (5.2.4.1)
12
- actionpack (= 5.2.4.1)
11
+ actioncable (6.0.2.2)
12
+ actionpack (= 6.0.2.2)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailer (5.2.4.1)
16
- actionpack (= 5.2.4.1)
17
- actionview (= 5.2.4.1)
18
- activejob (= 5.2.4.1)
15
+ actionmailbox (6.0.2.2)
16
+ actionpack (= 6.0.2.2)
17
+ activejob (= 6.0.2.2)
18
+ activerecord (= 6.0.2.2)
19
+ activestorage (= 6.0.2.2)
20
+ activesupport (= 6.0.2.2)
21
+ mail (>= 2.7.1)
22
+ actionmailer (6.0.2.2)
23
+ actionpack (= 6.0.2.2)
24
+ actionview (= 6.0.2.2)
25
+ activejob (= 6.0.2.2)
19
26
  mail (~> 2.5, >= 2.5.4)
20
27
  rails-dom-testing (~> 2.0)
21
- actionpack (5.2.4.1)
22
- actionview (= 5.2.4.1)
23
- activesupport (= 5.2.4.1)
28
+ actionpack (6.0.2.2)
29
+ actionview (= 6.0.2.2)
30
+ activesupport (= 6.0.2.2)
24
31
  rack (~> 2.0, >= 2.0.8)
25
32
  rack-test (>= 0.6.3)
26
33
  rails-dom-testing (~> 2.0)
27
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (5.2.4.1)
29
- activesupport (= 5.2.4.1)
34
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
+ actiontext (6.0.2.2)
36
+ actionpack (= 6.0.2.2)
37
+ activerecord (= 6.0.2.2)
38
+ activestorage (= 6.0.2.2)
39
+ activesupport (= 6.0.2.2)
40
+ nokogiri (>= 1.8.5)
41
+ actionview (6.0.2.2)
42
+ activesupport (= 6.0.2.2)
30
43
  builder (~> 3.1)
31
44
  erubi (~> 1.4)
32
45
  rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
- activejob (5.2.4.1)
35
- activesupport (= 5.2.4.1)
46
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
+ activejob (6.0.2.2)
48
+ activesupport (= 6.0.2.2)
36
49
  globalid (>= 0.3.6)
37
- activemodel (5.2.4.1)
38
- activesupport (= 5.2.4.1)
39
- activerecord (5.2.4.1)
40
- activemodel (= 5.2.4.1)
41
- activesupport (= 5.2.4.1)
42
- arel (>= 9.0)
43
- activestorage (5.2.4.1)
44
- actionpack (= 5.2.4.1)
45
- activerecord (= 5.2.4.1)
50
+ activemodel (6.0.2.2)
51
+ activesupport (= 6.0.2.2)
52
+ activerecord (6.0.2.2)
53
+ activemodel (= 6.0.2.2)
54
+ activesupport (= 6.0.2.2)
55
+ activestorage (6.0.2.2)
56
+ actionpack (= 6.0.2.2)
57
+ activejob (= 6.0.2.2)
58
+ activerecord (= 6.0.2.2)
46
59
  marcel (~> 0.3.1)
47
- activesupport (5.2.4.1)
60
+ activesupport (6.0.2.2)
48
61
  concurrent-ruby (~> 1.0, >= 1.0.2)
49
62
  i18n (>= 0.7, < 2)
50
63
  minitest (~> 5.1)
51
64
  tzinfo (~> 1.1)
65
+ zeitwerk (~> 2.2)
52
66
  addressable (2.7.0)
53
67
  public_suffix (>= 2.0.2, < 5.0)
54
68
  amq-protocol (2.3.0)
55
- arel (9.0.0)
56
69
  ast (2.4.0)
57
70
  builder (3.2.4)
58
71
  bunny (2.14.3)
@@ -106,7 +119,7 @@ GEM
106
119
  concurrent-ruby (~> 1.0)
107
120
  jaro_winkler (1.5.4)
108
121
  jwt (2.2.1)
109
- loofah (2.4.0)
122
+ loofah (2.5.0)
110
123
  crass (~> 1.0.2)
111
124
  nokogiri (>= 1.5.9)
112
125
  mail (2.7.1)
@@ -114,7 +127,7 @@ GEM
114
127
  marcel (0.3.3)
115
128
  mimemagic (~> 0.3.2)
116
129
  memoist (0.16.2)
117
- method_source (0.9.2)
130
+ method_source (1.0.0)
118
131
  mimemagic (0.3.4)
119
132
  mini_mime (1.0.2)
120
133
  mini_portile2 (2.4.0)
@@ -132,30 +145,32 @@ GEM
132
145
  rack (2.2.2)
133
146
  rack-test (1.1.0)
134
147
  rack (>= 1.0, < 3)
135
- rails (5.2.4.1)
136
- actioncable (= 5.2.4.1)
137
- actionmailer (= 5.2.4.1)
138
- actionpack (= 5.2.4.1)
139
- actionview (= 5.2.4.1)
140
- activejob (= 5.2.4.1)
141
- activemodel (= 5.2.4.1)
142
- activerecord (= 5.2.4.1)
143
- activestorage (= 5.2.4.1)
144
- activesupport (= 5.2.4.1)
148
+ rails (6.0.2.2)
149
+ actioncable (= 6.0.2.2)
150
+ actionmailbox (= 6.0.2.2)
151
+ actionmailer (= 6.0.2.2)
152
+ actionpack (= 6.0.2.2)
153
+ actiontext (= 6.0.2.2)
154
+ actionview (= 6.0.2.2)
155
+ activejob (= 6.0.2.2)
156
+ activemodel (= 6.0.2.2)
157
+ activerecord (= 6.0.2.2)
158
+ activestorage (= 6.0.2.2)
159
+ activesupport (= 6.0.2.2)
145
160
  bundler (>= 1.3.0)
146
- railties (= 5.2.4.1)
161
+ railties (= 6.0.2.2)
147
162
  sprockets-rails (>= 2.0.0)
148
163
  rails-dom-testing (2.0.3)
149
164
  activesupport (>= 4.2.0)
150
165
  nokogiri (>= 1.6)
151
166
  rails-html-sanitizer (1.3.0)
152
167
  loofah (~> 2.3)
153
- railties (5.2.4.1)
154
- actionpack (= 5.2.4.1)
155
- activesupport (= 5.2.4.1)
168
+ railties (6.0.2.2)
169
+ actionpack (= 6.0.2.2)
170
+ activesupport (= 6.0.2.2)
156
171
  method_source
157
172
  rake (>= 0.8.7)
158
- thor (>= 0.19.0, < 2.0)
173
+ thor (>= 0.20.3, < 2.0)
159
174
  rainbow (3.0.0)
160
175
  rake (13.0.1)
161
176
  rexml (3.2.4)
@@ -189,7 +204,7 @@ GEM
189
204
  faraday (~> 0.9)
190
205
  jwt (>= 1.5, < 3.0)
191
206
  multi_json (~> 1.10)
192
- sprockets (3.7.2)
207
+ sprockets (4.0.0)
193
208
  concurrent-ruby (~> 1.0)
194
209
  rack (> 1, < 3)
195
210
  sprockets-rails (3.2.1)
@@ -199,12 +214,13 @@ GEM
199
214
  sqlite3 (1.4.2)
200
215
  thor (1.0.1)
201
216
  thread_safe (0.3.6)
202
- tzinfo (1.2.6)
217
+ tzinfo (1.2.7)
203
218
  thread_safe (~> 0.1)
204
219
  unicode-display_width (1.6.1)
205
220
  websocket-driver (0.7.1)
206
221
  websocket-extensions (>= 0.1.0)
207
222
  websocket-extensions (0.1.4)
223
+ zeitwerk (2.3.0)
208
224
 
209
225
  PLATFORMS
210
226
  ruby
@@ -221,4 +237,4 @@ DEPENDENCIES
221
237
  sqlite3
222
238
 
223
239
  BUNDLED WITH
224
- 2.0.2
240
+ 2.1.4
@@ -3,13 +3,15 @@
3
3
  module PubSubModelSync
4
4
  class Publisher
5
5
  attr_accessor :connector
6
+ delegate :publish, to: :connector
7
+
6
8
  def initialize
7
9
  @connector = PubSubModelSync::Connector.new
8
10
  end
9
11
 
10
12
  def publish_data(klass, data, action)
11
13
  attributes = self.class.build_attrs(klass, action)
12
- connector.publish(data, attributes)
14
+ publish(data, attributes)
13
15
  end
14
16
 
15
17
  # @param settings (Hash): { attrs: [], as_klass: nil, id: nil }
@@ -23,7 +25,7 @@ module PubSubModelSync
23
25
  res_before = model.ps_before_sync(action, data)
24
26
  return if res_before == :cancel
25
27
 
26
- connector.publish(data.symbolize_keys, attributes)
28
+ publish(data.symbolize_keys, attributes)
27
29
  model.ps_after_sync(action, data)
28
30
  end
29
31
 
@@ -31,7 +31,7 @@ module PubSubModelSync
31
31
  end
32
32
 
33
33
  module ClassMethods
34
- # Permit to publish crud actions (:create, :update, :destroy)
34
+ # Permit to configure to publish crud actions (:create, :update, :destroy)
35
35
  # @param settings (Hash): { actions: nil, as_klass: nil, id: nil }
36
36
  def ps_publish(attrs, settings = {})
37
37
  actions = settings.delete(:actions) || %i[create update destroy]
@@ -42,6 +42,12 @@ module PubSubModelSync
42
42
  end
43
43
  end
44
44
 
45
+ # On demand class level publisher
46
+ def ps_class_publish(data, action:, as_klass: nil)
47
+ as_klass = (as_klass || name).to_s
48
+ ps_publisher_service.publish_data(as_klass, data, action.to_sym)
49
+ end
50
+
45
51
  # Publisher info for specific action
46
52
  def ps_publisher_info(action = :create)
47
53
  PubSubModelSync::Config.publishers.select do |listener|
@@ -49,12 +55,6 @@ module PubSubModelSync
49
55
  end.last
50
56
  end
51
57
 
52
- # On demand class level publisher
53
- def ps_class_publish(data, action:, as_klass: nil)
54
- as_klass = (as_klass || name).to_s
55
- ps_publisher_service.publish_data(as_klass, data, action.to_sym)
56
- end
57
-
58
58
  def ps_publisher_service
59
59
  PubSubModelSync::Publisher.new
60
60
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PubSubModelSync
4
- VERSION = '0.2.3'
4
+ VERSION = '0.2.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pub_sub_model_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-15 00:00:00.000000000 Z
11
+ date: 2020-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -101,10 +101,10 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - ".github/workflows/ruby.yml"
104
105
  - ".gitignore"
105
106
  - ".rspec"
106
107
  - ".rubocop.yml"
107
- - ".travis.yml"
108
108
  - CHANGELOG.md
109
109
  - CODE_OF_CONDUCT.md
110
110
  - Gemfile
@@ -155,8 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  requirements: []
158
- rubyforge_project:
159
- rubygems_version: 2.7.7
158
+ rubygems_version: 3.0.8
160
159
  signing_key:
161
160
  specification_version: 4
162
161
  summary: Permit to sync models between apps through pub/sub
@@ -1,13 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.3.1
7
- before_install: gem install bundler
8
-
9
- script:
10
- - bundle install
11
- # disabled cause of: An error occurred while Style/PercentLiteralDelimiters cop
12
- # - bundle exec rubocop
13
- - bundle exec rspec