alarmable 2.0.0 → 2.2.0
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/.github/workflows/release.yml +1 -1
- data/.github/workflows/test.yml +1 -1
- data/.rubocop.yml +5 -39
- data/Appraisals +6 -0
- data/CHANGELOG.md +11 -0
- data/Envfile +1 -0
- data/LICENSE +1 -1
- data/alarmable.gemspec +2 -2
- data/docker-compose.yml +1 -1
- data/gemfiles/rails_8.1.gemfile +23 -0
- data/lib/alarmable/version.rb +1 -1
- data/lib/alarmable.rb +1 -16
- metadata +10 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 956ddc795de786546c175450bbefaa7a5e37129fee88188eaf349f4ca345eeea
|
|
4
|
+
data.tar.gz: ab6ec26509dea630f5dabb4f34153446cc3756d2be9f772eb199c2a7be73a905
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4af5672f56a725fb3ebb9e5822f8a304c27f4a81993d1158fbd870714dbfe141a759973933fcf312bb2c45ac625d9b809e3f1670371b45fc4c69791e897e580a
|
|
7
|
+
data.tar.gz: 7ac47b411bd7036dbcf07ee7600c0f3d7859773ee3658f0446e1c8571c58518bf65e20f052e6608f2d78fbb6894a5a2528be98d80601b181fb1441c1a6a294ab
|
data/.github/workflows/test.yml
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
inherit_from:
|
|
2
|
+
- https://potpourri.hausgold.de/config/rubocop.yml
|
|
3
|
+
- https://potpourri.hausgold.de/config/rubocop-gem.yml
|
|
4
|
+
|
|
1
5
|
plugins:
|
|
2
6
|
- rubocop-rspec
|
|
3
7
|
- rubocop-rails
|
|
@@ -5,58 +9,24 @@ plugins:
|
|
|
5
9
|
Rails:
|
|
6
10
|
Enabled: true
|
|
7
11
|
|
|
8
|
-
Style/Documentation:
|
|
9
|
-
Enabled: true
|
|
10
|
-
|
|
11
12
|
AllCops:
|
|
12
13
|
NewCops: enable
|
|
13
14
|
SuggestExtensions: false
|
|
14
15
|
DisplayCopNames: true
|
|
15
16
|
TargetRubyVersion: 3.2
|
|
16
|
-
TargetRailsVersion:
|
|
17
|
+
TargetRailsVersion: 7.1
|
|
17
18
|
Exclude:
|
|
18
19
|
- bin/**/*
|
|
19
20
|
- vendor/**/*
|
|
20
21
|
- build/**/*
|
|
21
22
|
- gemfiles/**/*
|
|
22
23
|
|
|
23
|
-
Metrics/BlockLength:
|
|
24
|
-
Exclude:
|
|
25
|
-
- Rakefile
|
|
26
|
-
- '*.gemspec'
|
|
27
|
-
- spec/**/*.rb
|
|
28
|
-
- '**/*.rake'
|
|
29
|
-
- doc/**/*.rb
|
|
30
|
-
|
|
31
|
-
# MFA is not yet enabled for our gems yet.
|
|
32
|
-
Gemspec/RequireMFA:
|
|
33
|
-
Enabled: false
|
|
34
|
-
|
|
35
|
-
# Document all the things.
|
|
36
|
-
Style/DocumentationMethod:
|
|
37
|
-
Enabled: true
|
|
38
|
-
RequireForNonPublicMethods: true
|
|
39
|
-
|
|
40
24
|
# It's a deliberate idiom in RSpec.
|
|
41
25
|
# See: https://github.com/bbatsov/rubocop/issues/4222
|
|
42
26
|
Lint/AmbiguousBlockAssociation:
|
|
43
27
|
Exclude:
|
|
44
28
|
- "spec/**/*"
|
|
45
29
|
|
|
46
|
-
# Because +expect_any_instance_of().to have_received()+ is not
|
|
47
|
-
# supported with the +with(hash_including)+ matchers
|
|
48
|
-
RSpec/MessageSpies:
|
|
49
|
-
EnforcedStyle: receive
|
|
50
|
-
|
|
51
|
-
# We stay with the original Ruby Style Guide recommendation.
|
|
52
|
-
Layout/LineLength:
|
|
53
|
-
Max: 80
|
|
54
|
-
|
|
55
|
-
# Because nesting makes sense here to group the feature tests
|
|
56
|
-
# more effective. This increases maintainability.
|
|
57
|
-
RSpec/NestedGroups:
|
|
58
|
-
Max: 4
|
|
59
|
-
|
|
60
30
|
# Disable regular Rails spec paths.
|
|
61
31
|
Rails/FilePath:
|
|
62
32
|
Enabled: false
|
|
@@ -77,7 +47,3 @@ Rails/ApplicationJob:
|
|
|
77
47
|
# so when first evaluated it won't change.
|
|
78
48
|
RSpec/ExpectChange:
|
|
79
49
|
Enabled: false
|
|
80
|
-
|
|
81
|
-
# We highly depend on memoized helpers across the specs.
|
|
82
|
-
RSpec/MultipleMemoizedHelpers:
|
|
83
|
-
Enabled: false
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
* TODO: Replace this bullet point with an actual description of a change.
|
|
4
4
|
|
|
5
|
+
### 2.2.0 (19 December 2025)
|
|
6
|
+
|
|
7
|
+
* Upgraded PostgreSQL to 18.1. ([#26](https://github.com/hausgold/alarmable/pull/26))
|
|
8
|
+
* Migrated to a shared Rubocop configuration for HAUSGOLD gems ([#27](https://github.com/hausgold/alarmable/pull/27))
|
|
9
|
+
|
|
10
|
+
### 2.1.0 (24 October 2025)
|
|
11
|
+
|
|
12
|
+
* Upgraded PostgreSQL to 17.6. ([#23](https://github.com/hausgold/alarmable/pull/23))
|
|
13
|
+
* Dropped Reek. ([#24](https://github.com/hausgold/alarmable/pull/24))
|
|
14
|
+
* Added support for Rails 8.1 ([#25](https://github.com/hausgold/alarmable/pull/25))
|
|
15
|
+
|
|
5
16
|
### 2.0.0 (28 June 2025)
|
|
6
17
|
|
|
7
18
|
* Upgraded PostgreSQL to 17.5. ([#20](https://github.com/hausgold/alarmable/pull/20))
|
data/Envfile
CHANGED
data/LICENSE
CHANGED
data/alarmable.gemspec
CHANGED
|
@@ -40,9 +40,9 @@ Gem::Specification.new do |spec|
|
|
|
40
40
|
spec.add_dependency 'activejob-cancel', '~> 0.3'
|
|
41
41
|
spec.add_dependency 'activerecord', '>= 7.1'
|
|
42
42
|
spec.add_dependency 'activesupport', '>= 7.1'
|
|
43
|
-
spec.add_dependency 'base64', '
|
|
43
|
+
spec.add_dependency 'base64', '>= 0.3'
|
|
44
44
|
spec.add_dependency 'bigdecimal', '~> 3.1'
|
|
45
45
|
spec.add_dependency 'hashdiff', '~> 1.0'
|
|
46
|
-
spec.add_dependency 'mutex_m', '
|
|
46
|
+
spec.add_dependency 'mutex_m', '>= 0.3'
|
|
47
47
|
spec.add_dependency 'zeitwerk', '~> 2.6'
|
|
48
48
|
end
|
data/docker-compose.yml
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file was generated by Appraisal
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gem "appraisal", "~> 2.4"
|
|
6
|
+
gem "bundler", "~> 2.6"
|
|
7
|
+
gem "countless", "~> 2.0"
|
|
8
|
+
gem "guard-rspec", "~> 4.7"
|
|
9
|
+
gem "pg", "~> 1.4"
|
|
10
|
+
gem "railties", ">= 7.1"
|
|
11
|
+
gem "rake", "~> 13.0"
|
|
12
|
+
gem "rspec", "~> 3.12"
|
|
13
|
+
gem "rubocop"
|
|
14
|
+
gem "rubocop-rails"
|
|
15
|
+
gem "rubocop-rspec"
|
|
16
|
+
gem "simplecov", ">= 0.22"
|
|
17
|
+
gem "yard", ">= 0.9.28"
|
|
18
|
+
gem "yard-activesupport-concern", ">= 0.0.1"
|
|
19
|
+
gem "activejob", "~> 8.1.0"
|
|
20
|
+
gem "activerecord", "~> 8.1.0"
|
|
21
|
+
gem "activesupport", "~> 8.1.0"
|
|
22
|
+
|
|
23
|
+
gemspec path: "../"
|
data/lib/alarmable/version.rb
CHANGED
data/lib/alarmable.rb
CHANGED
|
@@ -66,12 +66,9 @@ module Alarmable
|
|
|
66
66
|
|
|
67
67
|
class_methods do
|
|
68
68
|
# Getter/Setter
|
|
69
|
-
#
|
|
70
|
-
# :reek:Attribute because thats what this thing is about
|
|
71
69
|
attr_accessor :alarm_job, :alarm_base_date_property
|
|
72
70
|
end
|
|
73
71
|
|
|
74
|
-
# rubocop:disable Metrics/BlockLength -- because Active Support like it
|
|
75
72
|
included do
|
|
76
73
|
# Hooks
|
|
77
74
|
after_initialize :validate_alarm_settings, :alarm_defaults
|
|
@@ -107,7 +104,6 @@ module Alarmable
|
|
|
107
104
|
# setting.
|
|
108
105
|
#
|
|
109
106
|
# rubocop:disable Style/GuardClause -- because its fine like this
|
|
110
|
-
# :reek:NilCheck because we validate concern usage
|
|
111
107
|
def validate_alarm_settings
|
|
112
108
|
raise 'Alarmable +alarm_job+ is not configured' if alarm_job.nil?
|
|
113
109
|
unless alarm_job.is_a? Class
|
|
@@ -124,15 +120,13 @@ module Alarmable
|
|
|
124
120
|
|
|
125
121
|
# Generate a unique and recalculatable identifier for a given alarm
|
|
126
122
|
# object. We build a hash of the primary keys (before_minutes and
|
|
127
|
-
# channel) to
|
|
123
|
+
# channel) to achieve this. Afterwards, this alarm id is used to
|
|
128
124
|
# reference dedicated scheduled jobs and track their updates. (Or cancel
|
|
129
125
|
# them accordingly)
|
|
130
126
|
#
|
|
131
127
|
# @param channel [String] The alarm channel
|
|
132
128
|
# @param before_minutes [Integer] The minutes before the alarm starts
|
|
133
129
|
# @return [String] The unique alarm id
|
|
134
|
-
#
|
|
135
|
-
# :reek:UtilityFunction because its a utility, for sure
|
|
136
130
|
def alarm_id(channel, before_minutes)
|
|
137
131
|
(Digest::MD5.new << "#{channel}#{before_minutes}").to_s
|
|
138
132
|
end
|
|
@@ -146,11 +140,6 @@ module Alarmable
|
|
|
146
140
|
# @param alarm [Hash] The alarm object
|
|
147
141
|
# @return [Object] The new alarm_jobs instance (partial)
|
|
148
142
|
# Example: { "alarm id": "job id" }
|
|
149
|
-
#
|
|
150
|
-
# rubocop:disable Metrics/AbcSize -- because its already broken down
|
|
151
|
-
# :reek:TooManyStatements because see above
|
|
152
|
-
# :reek:NilCheck because we dont want to cancel 'nil' job id
|
|
153
|
-
# :reek:DuplicateMethodCall because hash access is fast
|
|
154
143
|
def reschedule_alarm_job(alarm)
|
|
155
144
|
# Symbolize the hash keys (just to be sure).
|
|
156
145
|
alarm = alarm.symbolize_keys
|
|
@@ -177,12 +166,9 @@ module Alarmable
|
|
|
177
166
|
# Construct a new alarm_jobs partial instance for this job
|
|
178
167
|
{ id => job.job_id }
|
|
179
168
|
end
|
|
180
|
-
# rubocop:enable Metrics/AbcSize
|
|
181
169
|
|
|
182
170
|
# Initiate a reschedule for each alarm in the alarm settings and
|
|
183
171
|
# cancel all left-overs.
|
|
184
|
-
#
|
|
185
|
-
# :reek:TooManyStatements because its already broken down
|
|
186
172
|
def reschedule_alarm_jobs
|
|
187
173
|
# Perform the reschedule of all the current alarms.
|
|
188
174
|
new_alarm_jobs = alarms.each_with_object({}) do |alarm, memo|
|
|
@@ -214,5 +200,4 @@ module Alarmable
|
|
|
214
200
|
alarm_jobs.each_value { |job_id| alarm_job.cancel(job_id) }
|
|
215
201
|
end
|
|
216
202
|
end
|
|
217
|
-
# rubocop:enable Metrics/BlockLength
|
|
218
203
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: alarmable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hermann Mayer
|
|
@@ -69,16 +69,16 @@ dependencies:
|
|
|
69
69
|
name: base64
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
|
-
- - "
|
|
72
|
+
- - ">="
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: 0.
|
|
74
|
+
version: '0.3'
|
|
75
75
|
type: :runtime
|
|
76
76
|
prerelease: false
|
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
|
-
- - "
|
|
79
|
+
- - ">="
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: 0.
|
|
81
|
+
version: '0.3'
|
|
82
82
|
- !ruby/object:Gem::Dependency
|
|
83
83
|
name: bigdecimal
|
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -111,16 +111,16 @@ dependencies:
|
|
|
111
111
|
name: mutex_m
|
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements:
|
|
114
|
-
- - "
|
|
114
|
+
- - ">="
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: 0.3
|
|
116
|
+
version: '0.3'
|
|
117
117
|
type: :runtime
|
|
118
118
|
prerelease: false
|
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
120
|
requirements:
|
|
121
|
-
- - "
|
|
121
|
+
- - ">="
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: 0.3
|
|
123
|
+
version: '0.3'
|
|
124
124
|
- !ruby/object:Gem::Dependency
|
|
125
125
|
name: zeitwerk
|
|
126
126
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -174,6 +174,7 @@ files:
|
|
|
174
174
|
- gemfiles/rails_7.1.gemfile
|
|
175
175
|
- gemfiles/rails_7.2.gemfile
|
|
176
176
|
- gemfiles/rails_8.0.gemfile
|
|
177
|
+
- gemfiles/rails_8.1.gemfile
|
|
177
178
|
- lib/alarmable.rb
|
|
178
179
|
- lib/alarmable/version.rb
|
|
179
180
|
licenses:
|