activerecord-postgres_pub_sub 2.3.0 → 3.0.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: ab5807899dcfd7a9aa7b51233366b26742bee55276024aeb92c796e1fe6ef59b
4
- data.tar.gz: 3e7a055319a847476d2c3f32bca43245cdf1d9f633ab3142b365ce0f3a2d9a1f
3
+ metadata.gz: 0a86f260c16eb56f145eec2011339d8f22115c990fe26d39f4be505fa9d687ad
4
+ data.tar.gz: 1053e77f1bb10c2ff5a5b0d48a7bd5c13855ec39bba841971880862f96b52e9e
5
5
  SHA512:
6
- metadata.gz: d7b51388aaddb2ed46258e3515a0a49b6f30413701b899c2b6f725cbf2e44f18a7257c71fa7dd864493c716f49bfaed06e5080735c4e17ec4b0efca0cf5391d2
7
- data.tar.gz: 1f87512ac9faef62475c133f288d39e2f46e7d6a465b37c19556e21976dff57be72e898b3a0ffac8000a0dc8956a119d8f6aaa3295fbbaec3eaba859d22ebd16
6
+ metadata.gz: 5f4ca541c2f9e2016314534874e207e94a3b1c707d903c5c65cff84acc0e90cf049c37b6636c7acd78b276f12db2435ac34fd9942c026ec189d7c948f5887e9a
7
+ data.tar.gz: f7170043ceb5a1b1ad23374a51137e4d307a0ff8771cdb0b3bbcab40ff0dab29fec3bd4f45367ff1b6505e00424eec8daeefa984f21c51ecac0731624464abdd
data/Appraisals CHANGED
@@ -1,51 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise "rails-5.2_pg-1.1" do
4
- gem "activerecord", "5.2.1"
5
- gem "pg", "1.1.4"
6
- end
7
-
8
- appraise "rails-5.2_pg-1.2" do
9
- gem "activerecord", "5.2.1"
10
- gem "pg", "1.2.0"
11
- end
12
-
13
- appraise "rails-6.0_pg-1.1" do
14
- gem "activerecord", ">= 6.0.0", "< 6.1"
15
- gem "pg", "1.1.4"
16
- end
17
-
18
- appraise "rails-6.0_pg-1.2" do
19
- gem "activerecord", ">= 6.0.0", "< 6.1"
20
- gem "pg", "1.2.0"
21
- end
22
-
23
- appraise "rails-6.1_pg-1.1" do
3
+ appraise "activerecord_6.1" do
24
4
  gem "activerecord", ">= 6.1.0", "< 6.2"
25
- gem "pg", "1.1.4"
26
5
  end
27
6
 
28
- appraise "rails-6.1_pg-1.2" do
29
- gem "activerecord", ">= 6.1.0", "< 6.2"
30
- gem "pg", "1.2.0"
31
- end
32
-
33
- appraise "rails-7.0_pg-1.1" do
34
- gem "activerecord", ">= 7.0.0", "< 7.1"
35
- gem "pg", "1.1.4"
36
- end
37
-
38
- appraise "rails-7.0_pg-1.2" do
7
+ appraise "activerecord_7.0" do
39
8
  gem "activerecord", ">= 7.0.0", "< 7.1"
40
- gem "pg", "1.2.0"
41
- end
42
-
43
- appraise "rails-7.1_pg-1.1" do
44
- gem "activerecord", ">= 7.1.0", "< 7.2"
45
- gem "pg", "1.1.4"
46
9
  end
47
10
 
48
- appraise "rails-7.1_pg-1.2" do
11
+ appraise "activerecord_7.1" do
49
12
  gem "activerecord", ">= 7.1.0", "< 7.2"
50
- gem "pg", "1.2.0"
51
13
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # activerecord-postgres_pub_sub
2
2
 
3
+ ## v3.0.0
4
+ - Add support for multiple databases by allowing injection of the base Active Record class.
5
+ - BREAKING: Drop support for ActiveRecord 5.2, 6.0
6
+ - BREAKING: Drop support for ruby < 3.0
7
+
3
8
  ## v2.3.0
4
9
  - Add support for Rails 7.1
5
10
 
data/README.md CHANGED
@@ -41,6 +41,8 @@ When creating a listener, the following configuration is supported:
41
41
  the listener ignores the payload and coalesces multiple notifications into a
42
42
  single call. When this option is `false`, the `on_notify` block is called with
43
43
  the payload for each notification. (Default `true`).
44
+ * **base_class**: An Active Record class should you need to use a different base
45
+ class (e.g. for multiple database support). (Default `ActiveRecord::Base`).
44
46
  * **exclusive_lock**: Acquire a lock using
45
47
  [with_advisory_lock](https://github.com/ClosureTree/with_advisory_lock) prior to listening.
46
48
  This option ensures that a process as a singleton listener. (Default `true`).
@@ -77,6 +79,13 @@ rails generate active_record:postgres_pub_sub:notify_on_insert --model_name Name
77
79
  In this example, notification events would be generated for the channel named `"name_space_entity"` based
78
80
  on inserts to the `name_space_entities` table.
79
81
 
82
+ ## Supported dependencies
83
+
84
+ This gem will not support versions of ruby and activerecord which no
85
+ longer receive security updates. It will support the latest major
86
+ version of the pg gem and it will be tested against the latest minor /
87
+ patch version of that gem.
88
+
80
89
  ## Development
81
90
 
82
91
  After checking out the repo, run `bin/setup` to install dependencies. Then,
@@ -21,39 +21,33 @@ Gem::Specification.new do |spec|
21
21
  raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
22
  end
23
23
 
24
- excluded_files = %w(.github/workflows/ci.yml
25
- .github/PULL_REQUEST_TEMPLATE.md
26
- .gitignore
24
+ excluded_files = %w(.gitignore
27
25
  .rspec
28
26
  .rubocop.yml
29
27
  .ruby-gemset
30
- .ruby-version
31
- .travis.yml
32
- bin/console
33
- bin/setup
28
+ .tool-versions
34
29
  Rakefile)
35
30
 
36
31
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
37
- f.match(/^(test|spec|features)\//)
32
+ f.match(/^(bin|test|spec|features|.github)\//)
38
33
  end - excluded_files
39
34
  spec.bindir = "bin"
40
35
  spec.executables = []
41
36
  spec.require_paths = ["lib"]
42
- spec.required_ruby_version = ">= 2.7.0"
37
+ spec.required_ruby_version = ">= 3.0.0"
43
38
 
44
- spec.add_runtime_dependency "activerecord", "> 5.1", "< 7.2"
39
+ spec.add_runtime_dependency "activerecord", "> 6.0", "< 7.2"
45
40
  spec.add_runtime_dependency "pg", "~> 1.1"
46
41
  spec.add_runtime_dependency "private_attr"
47
42
  spec.add_runtime_dependency "with_advisory_lock"
48
43
 
49
44
  spec.add_development_dependency "appraisal"
50
- spec.add_development_dependency "bundler", ">= 1.3.0"
45
+ spec.add_development_dependency "bundler", "~> 2.2"
51
46
  spec.add_development_dependency "database_cleaner"
52
47
  spec.add_development_dependency "ezcater_matchers"
53
- spec.add_development_dependency "ezcater_rubocop", "~> 3.0"
48
+ spec.add_development_dependency "ezcater_rubocop", "~> 6.1.0"
54
49
  spec.add_development_dependency "overcommit"
55
- spec.add_development_dependency "rake", "~> 10.0"
50
+ spec.add_development_dependency "rake", "~> 13.1"
56
51
  spec.add_development_dependency "rspec", "~> 3.4"
57
- spec.add_development_dependency "rspec_junit_formatter", "0.2.2"
58
52
  spec.add_development_dependency "simplecov"
59
53
  end
@@ -3,6 +3,5 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", ">= 6.1.0", "< 6.2"
6
- gem "pg", "1.1.4"
7
6
 
8
7
  gemspec path: "../"
@@ -3,6 +3,5 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", ">= 7.0.0", "< 7.1"
6
- gem "pg", "1.1.4"
7
6
 
8
7
  gemspec path: "../"
@@ -2,7 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "5.2.1"
6
- gem "pg", "1.2.0"
5
+ gem "activerecord", ">= 7.1.0", "< 7.2"
7
6
 
8
7
  gemspec path: "../"
@@ -9,22 +9,36 @@ module ActiveRecord
9
9
  extend PrivateAttr
10
10
 
11
11
  private_attr_reader :on_notify_blk, :on_start_blk, :on_timeout_blk,
12
- :channels, :listen_timeout, :exclusive_lock, :notify_only
13
-
14
- def self.listen(*channels, listen_timeout: nil, exclusive_lock: true, notify_only: true)
12
+ :channels, :listen_timeout, :exclusive_lock, :notify_only, :base_class
13
+
14
+ def self.listen(
15
+ *channels,
16
+ listen_timeout: nil,
17
+ exclusive_lock: true,
18
+ notify_only: true,
19
+ base_class: ActiveRecord::Base
20
+ )
15
21
  listener = new(*channels,
16
22
  listen_timeout: listen_timeout,
17
23
  exclusive_lock: exclusive_lock,
18
- notify_only: notify_only)
24
+ notify_only: notify_only,
25
+ base_class: base_class)
19
26
  yield(listener) if block_given?
20
27
  listener.listen
21
28
  end
22
29
 
23
- def initialize(*channels, listen_timeout: nil, exclusive_lock: true, notify_only: true)
30
+ def initialize(
31
+ *channels,
32
+ listen_timeout: nil,
33
+ exclusive_lock: true,
34
+ notify_only: true,
35
+ base_class: ActiveRecord::Base
36
+ )
24
37
  @channels = channels
25
38
  @listen_timeout = listen_timeout
26
39
  @exclusive_lock = exclusive_lock
27
40
  @notify_only = notify_only
41
+ @base_class = base_class
28
42
  end
29
43
 
30
44
  def on_notify(&blk)
@@ -54,7 +68,7 @@ module ActiveRecord
54
68
  private
55
69
 
56
70
  def with_connection
57
- ActiveRecord::Base.connection_pool.with_connection do |connection|
71
+ base_class.connection_pool.with_connection do |connection|
58
72
  with_optional_lock do
59
73
  channels.each do |channel|
60
74
  connection.execute("LISTEN #{channel};")
@@ -73,7 +87,7 @@ module ActiveRecord
73
87
 
74
88
  def with_optional_lock(&block)
75
89
  if exclusive_lock
76
- ActiveRecord::Base.with_advisory_lock(lock_name, &block)
90
+ base_class.with_advisory_lock(lock_name, &block)
77
91
  else
78
92
  yield
79
93
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module PostgresPubSub
5
- VERSION = "2.3.0"
5
+ VERSION = "3.0.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgres_pub_sub
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ezCater, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-07 00:00:00.000000000 Z
11
+ date: 2024-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.1'
19
+ version: '6.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '7.2'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">"
28
28
  - !ruby/object:Gem::Version
29
- version: '5.1'
29
+ version: '6.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '7.2'
@@ -90,16 +90,16 @@ dependencies:
90
90
  name: bundler
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 1.3.0
95
+ version: '2.2'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">="
100
+ - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 1.3.0
102
+ version: '2.2'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: database_cleaner
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '3.0'
137
+ version: 6.1.0
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '3.0'
144
+ version: 6.1.0
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: overcommit
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -162,14 +162,14 @@ dependencies:
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: '10.0'
165
+ version: '13.1'
166
166
  type: :development
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: '10.0'
172
+ version: '13.1'
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: rspec
175
175
  requirement: !ruby/object:Gem::Requirement
@@ -184,20 +184,6 @@ dependencies:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
186
  version: '3.4'
187
- - !ruby/object:Gem::Dependency
188
- name: rspec_junit_formatter
189
- requirement: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - '='
192
- - !ruby/object:Gem::Version
193
- version: 0.2.2
194
- type: :development
195
- prerelease: false
196
- version_requirements: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - '='
199
- - !ruby/object:Gem::Version
200
- version: 0.2.2
201
187
  - !ruby/object:Gem::Dependency
202
188
  name: simplecov
203
189
  requirement: !ruby/object:Gem::Requirement
@@ -219,24 +205,15 @@ executables: []
219
205
  extensions: []
220
206
  extra_rdoc_files: []
221
207
  files:
222
- - ".github/workflows/codeql.yml"
223
208
  - Appraisals
224
209
  - CHANGELOG.md
225
210
  - Gemfile
226
211
  - LICENSE.txt
227
212
  - README.md
228
213
  - activerecord-postgres_pub_sub.gemspec
229
- - gemfiles/rails_5.1.gemfile
230
- - gemfiles/rails_5.2_pg_0.18.gemfile
231
- - gemfiles/rails_5.2_pg_1.1.gemfile
232
- - gemfiles/rails_5.2_pg_1.2.gemfile
233
- - gemfiles/rails_6.0_pg_0.18.gemfile
234
- - gemfiles/rails_6.0_pg_1.1.gemfile
235
- - gemfiles/rails_6.0_pg_1.2.gemfile
236
- - gemfiles/rails_6.1_pg_1.1.gemfile
237
- - gemfiles/rails_6.1_pg_1.2.gemfile
238
- - gemfiles/rails_7.0_pg_1.1.gemfile
239
- - gemfiles/rails_7.0_pg_1.2.gemfile
214
+ - gemfiles/activerecord_6.1.gemfile
215
+ - gemfiles/activerecord_7.0.gemfile
216
+ - gemfiles/activerecord_7.1.gemfile
240
217
  - lib/activerecord-postgres_pub_sub.rb
241
218
  - lib/activerecord/postgres_pub_sub/listener.rb
242
219
  - lib/activerecord/postgres_pub_sub/version.rb
@@ -255,14 +232,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
255
232
  requirements:
256
233
  - - ">="
257
234
  - !ruby/object:Gem::Version
258
- version: 2.7.0
235
+ version: 3.0.0
259
236
  required_rubygems_version: !ruby/object:Gem::Requirement
260
237
  requirements:
261
238
  - - ">="
262
239
  - !ruby/object:Gem::Version
263
240
  version: '0'
264
241
  requirements: []
265
- rubygems_version: 3.1.6
242
+ rubygems_version: 3.2.33
266
243
  signing_key:
267
244
  specification_version: 4
268
245
  summary: Support for Postgres Notify/Listen
@@ -1,71 +0,0 @@
1
- name: "CodeQL"
2
-
3
- on:
4
- push:
5
- branches: [ "main" ]
6
- pull_request:
7
- # The branches below must be a subset of the branches above
8
- branches: [ "main" ]
9
- # https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning#avoiding-unnecessary-scans-of-pull-requests
10
- paths-ignore:
11
- - '**/*.md'
12
- - '**/*.txt'
13
- schedule:
14
- - cron: '41 22 * * 2'
15
-
16
- jobs:
17
- scan:
18
- name: Scan
19
- runs-on: [ ubuntu-latest ]
20
- permissions:
21
- actions: read
22
- contents: read
23
- security-events: write
24
-
25
- strategy:
26
- # Setting fail-fast to false to prevent a failed scan in
27
- # any of the matrix.language's from stopping the other scans
28
- # If there are multiple offenses, better to find/report them
29
- # all at once
30
- fail-fast: false
31
- matrix:
32
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
33
- # https://aka.ms/codeql-docs/language-support
34
- language: [ 'ruby' ]
35
-
36
-
37
- steps:
38
- - name: Checkout repository
39
- uses: actions/checkout@v3
40
-
41
- # Initializes the CodeQL tools for scanning.
42
- - name: Initialize CodeQL
43
- uses: github/codeql-action/init@v2
44
- with:
45
- languages: ${{ matrix.language }}
46
- # If you wish to specify custom queries, you can do so here or in a config file.
47
- # By default, queries listed here will override any specified in a config file.
48
- # Prefix the list here with "+" to use these queries and those in the config file.
49
-
50
- # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
51
- # queries: security-extended,security-and-quality
52
-
53
- # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
54
- # If this step fails, then you should remove it and run the build manually (see below)
55
- - name: Autobuild
56
- uses: github/codeql-action/autobuild@v2
57
-
58
- # ℹ️ Command-line programs to run using the OS shell.
59
- # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
60
-
61
- # If the Autobuild fails above, remove it and uncomment the following three lines.
62
- # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
63
-
64
- # - run: |
65
- # echo "Run, Build Application using script"
66
- # ./location_of_script_within_repo/buildscript.sh
67
-
68
- - name: Perform CodeQL Analysis
69
- uses: github/codeql-action/analyze@v2
70
- with:
71
- category: "/language:${{matrix.language}}"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "5.1.6"
6
- gem "pg", "0.18.4"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "5.2.1"
6
- gem "pg", "0.18.4"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "5.2.1"
6
- gem "pg", "1.1.4"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", ">= 6.0.0", "< 6.1"
6
- gem "pg", "0.18.4"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", ">= 6.0.0", "< 6.1"
6
- gem "pg", "1.1.4"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", ">= 6.0.0", "< 6.1"
6
- gem "pg", "1.2.0"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", ">= 6.1.0", "< 6.2"
6
- gem "pg", "1.2.0"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", ">= 7.0.0", "< 7.1"
6
- gem "pg", "1.2.0"
7
-
8
- gemspec path: "../"