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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 410b45f7e4abd1faea1d95f0e2449512de445627fc3488d0cbe69167fa8a48d8
4
- data.tar.gz: 5e254b9e0e3985423e9dcf2e40f3ba454a9afbb363276a8c796122ce1c488eaa
3
+ metadata.gz: 956ddc795de786546c175450bbefaa7a5e37129fee88188eaf349f4ca345eeea
4
+ data.tar.gz: ab6ec26509dea630f5dabb4f34153446cc3756d2be9f772eb199c2a7be73a905
5
5
  SHA512:
6
- metadata.gz: 8cfaf52562fedd1817f3d82ff2671b10646fa7a9aedbb71fe96a6caf82746c116302a0091df7d34a51eebe31aaf258cd8bddcc00266257d78f8ee219cb0342d8
7
- data.tar.gz: 33982315842bc5d00eefdc5b1d283a764e2a72ee606d3477ceebb8e1f58cbf4278098ae1ecae07443bd7662707977f1b54463cacb03a2109f08112c95f2ff5de
6
+ metadata.gz: 4af5672f56a725fb3ebb9e5822f8a304c27f4a81993d1158fbd870714dbfe141a759973933fcf312bb2c45ac625d9b809e3f1670371b45fc4c69791e897e580a
7
+ data.tar.gz: 7ac47b411bd7036dbcf07ee7600c0f3d7859773ee3658f0446e1c8571c58518bf65e20f052e6608f2d78fbb6894a5a2528be98d80601b181fb1441c1a6a294ab
@@ -16,7 +16,7 @@ jobs:
16
16
  docs:
17
17
  name: Release the gem
18
18
  runs-on: ubuntu-22.04
19
- timeout-minutes: 5
19
+ timeout-minutes: 10
20
20
  steps:
21
21
  - uses: actions/checkout@v4
22
22
 
@@ -19,7 +19,7 @@ jobs:
19
19
  fail-fast: false
20
20
  matrix:
21
21
  ruby: ['3.2', '3.3', '3.4']
22
- rails: ['7.1', '7.2', '8.0']
22
+ rails: ['7.1', '7.2', '8.0', '8.1']
23
23
  env:
24
24
  BUNDLE_GEMFILE: 'gemfiles/rails_${{ matrix.rails }}.gemfile'
25
25
  steps:
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: 6.1
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
@@ -17,3 +17,9 @@ appraise 'rails-8.0' do
17
17
  gem 'activerecord', '~> 8.0.0'
18
18
  gem 'activesupport', '~> 8.0.0'
19
19
  end
20
+
21
+ appraise 'rails-8.1' do
22
+ gem 'activejob', '~> 8.1.0'
23
+ gem 'activerecord', '~> 8.1.0'
24
+ gem 'activesupport', '~> 8.1.0'
25
+ end
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
@@ -1,3 +1,4 @@
1
1
  LANG=en_US.UTF-8
2
2
  LANGUAGE=en_US.UTF-8
3
3
  LC_ALL=en_US.UTF-8
4
+ RUBOCOP_CACHE_ROOT=/app/tmp
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 HAUSGOLD | talocasa GmbH
3
+ Copyright (c) 2025 HAUSGOLD | talocasa GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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', '~> 0.2.0'
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', '~> 0.3.0'
46
+ spec.add_dependency 'mutex_m', '>= 0.3'
47
47
  spec.add_dependency 'zeitwerk', '~> 2.6'
48
48
  end
data/docker-compose.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  services:
2
2
  db:
3
- image: hausgold/postgres:17.5
3
+ image: hausgold/postgres:18.1
4
4
  network_mode: bridge
5
5
  ports: ["5432"]
6
6
  volumes:
@@ -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: "../"
@@ -3,7 +3,7 @@
3
3
  # The gem version details.
4
4
  module Alarmable
5
5
  # The version of the +alarmable+ gem
6
- VERSION = '2.0.0'
6
+ VERSION = '2.2.0'
7
7
 
8
8
  class << self
9
9
  # Returns the version of gem as a string.
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 achive this. Afterwards, this alarm id is used 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.0.0
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.2.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.2.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.0
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.0
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: