activerecord-postgres_pub_sub 2.3.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +5 -39
- data/CHANGELOG.md +9 -0
- data/README.md +9 -0
- data/activerecord-postgres_pub_sub.gemspec +8 -14
- data/gemfiles/{rails_6.1_pg_1.1.gemfile → activerecord_6.1.gemfile} +0 -1
- data/gemfiles/{rails_7.0_pg_1.1.gemfile → activerecord_7.0.gemfile} +0 -1
- data/gemfiles/{rails_5.2_pg_1.2.gemfile → activerecord_7.1.gemfile} +1 -2
- data/gemfiles/{rails_5.2_pg_1.1.gemfile → activerecord_7.2.gemfile} +1 -2
- data/lib/activerecord/postgres_pub_sub/listener.rb +21 -7
- data/lib/activerecord/postgres_pub_sub/version.rb +1 -1
- metadata +20 -42
- data/.github/workflows/codeql.yml +0 -71
- data/gemfiles/rails_5.1.gemfile +0 -8
- data/gemfiles/rails_5.2_pg_0.18.gemfile +0 -8
- data/gemfiles/rails_6.0_pg_0.18.gemfile +0 -8
- data/gemfiles/rails_6.0_pg_1.1.gemfile +0 -8
- data/gemfiles/rails_6.0_pg_1.2.gemfile +0 -8
- data/gemfiles/rails_6.1_pg_1.2.gemfile +0 -8
- data/gemfiles/rails_7.0_pg_1.2.gemfile +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac9d3e5f76638e39f57309154e7f0247542900d890198c34b97f7c4a7fe59617
|
4
|
+
data.tar.gz: 12aecc1fb055da99b65bff2485013098fc21787acec507448eed4a74228f7f7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b73681b59103dca8497335bd2ce30a0af8c64a0b6bd2232af7669290f17d19c6752965c80c7283ae2dac8b1ef97433f085cb4ad63227c9fbf7264dc948b91ce
|
7
|
+
data.tar.gz: 559a89e6ce84ec81e5d57d4e0106746702aa0a7556e0d393e1c3c7ebe91fc25e79ea8690bc9c7f54987df618f71565a106d9ba81519be88418a93238b6a398ba
|
data/Appraisals
CHANGED
@@ -1,51 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
appraise "
|
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 "
|
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
|
7
|
+
appraise "activerecord_7.0" do
|
34
8
|
gem "activerecord", ">= 7.0.0", "< 7.1"
|
35
|
-
gem "pg", "1.1.4"
|
36
9
|
end
|
37
10
|
|
38
|
-
appraise "
|
39
|
-
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
|
11
|
+
appraise "activerecord_7.1" do
|
44
12
|
gem "activerecord", ">= 7.1.0", "< 7.2"
|
45
|
-
gem "pg", "1.1.4"
|
46
13
|
end
|
47
14
|
|
48
|
-
appraise "
|
49
|
-
gem "activerecord", ">= 7.
|
50
|
-
gem "pg", "1.2.0"
|
15
|
+
appraise "activerecord_7.2" do
|
16
|
+
gem "activerecord", ">= 7.2.0", "< 7.3"
|
51
17
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# activerecord-postgres_pub_sub
|
2
2
|
|
3
|
+
## v3.1.0
|
4
|
+
- Add support for ActiveRecord 7.2
|
5
|
+
- Add support for Ruby 3.3
|
6
|
+
|
7
|
+
## v3.0.0
|
8
|
+
- Add support for multiple databases by allowing injection of the base Active Record class.
|
9
|
+
- BREAKING: Drop support for ActiveRecord 5.2, 6.0
|
10
|
+
- BREAKING: Drop support for ruby < 3.0
|
11
|
+
|
3
12
|
## v2.3.0
|
4
13
|
- Add support for Rails 7.1
|
5
14
|
|
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(.
|
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
|
-
.
|
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 = ">=
|
37
|
+
spec.required_ruby_version = ">= 3.0.0"
|
43
38
|
|
44
|
-
spec.add_runtime_dependency "activerecord", ">
|
39
|
+
spec.add_runtime_dependency "activerecord", "> 6.0", "< 7.3"
|
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", "
|
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", "~>
|
48
|
+
spec.add_development_dependency "ezcater_rubocop", "~> 6.1.0"
|
54
49
|
spec.add_development_dependency "overcommit"
|
55
|
-
spec.add_development_dependency "rake", "~>
|
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
|
@@ -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(
|
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(
|
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
|
-
|
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
|
-
|
90
|
+
base_class.with_advisory_lock(lock_name, &block)
|
77
91
|
else
|
78
92
|
yield
|
79
93
|
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:
|
4
|
+
version: 3.1.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:
|
11
|
+
date: 2024-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '7.
|
22
|
+
version: '7.3'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '6.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '7.
|
32
|
+
version: '7.3'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: pg
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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:
|
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:
|
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:
|
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:
|
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: '
|
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: '
|
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,16 @@ 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/
|
230
|
-
- gemfiles/
|
231
|
-
- gemfiles/
|
232
|
-
- gemfiles/
|
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
|
217
|
+
- gemfiles/activerecord_7.2.gemfile
|
240
218
|
- lib/activerecord-postgres_pub_sub.rb
|
241
219
|
- lib/activerecord/postgres_pub_sub/listener.rb
|
242
220
|
- lib/activerecord/postgres_pub_sub/version.rb
|
@@ -255,14 +233,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
255
233
|
requirements:
|
256
234
|
- - ">="
|
257
235
|
- !ruby/object:Gem::Version
|
258
|
-
version:
|
236
|
+
version: 3.0.0
|
259
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
238
|
requirements:
|
261
239
|
- - ">="
|
262
240
|
- !ruby/object:Gem::Version
|
263
241
|
version: '0'
|
264
242
|
requirements: []
|
265
|
-
rubygems_version: 3.
|
243
|
+
rubygems_version: 3.2.33
|
266
244
|
signing_key:
|
267
245
|
specification_version: 4
|
268
246
|
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}}"
|
data/gemfiles/rails_5.1.gemfile
DELETED