stance 0.8.3 → 0.9.1

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.
@@ -0,0 +1,295 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ stance (0.9.0)
5
+ rails (>= 7.0, < 9.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (8.0.1)
11
+ actionpack (= 8.0.1)
12
+ activesupport (= 8.0.1)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ zeitwerk (~> 2.6)
16
+ actionmailbox (8.0.1)
17
+ actionpack (= 8.0.1)
18
+ activejob (= 8.0.1)
19
+ activerecord (= 8.0.1)
20
+ activestorage (= 8.0.1)
21
+ activesupport (= 8.0.1)
22
+ mail (>= 2.8.0)
23
+ actionmailer (8.0.1)
24
+ actionpack (= 8.0.1)
25
+ actionview (= 8.0.1)
26
+ activejob (= 8.0.1)
27
+ activesupport (= 8.0.1)
28
+ mail (>= 2.8.0)
29
+ rails-dom-testing (~> 2.2)
30
+ actionpack (8.0.1)
31
+ actionview (= 8.0.1)
32
+ activesupport (= 8.0.1)
33
+ nokogiri (>= 1.8.5)
34
+ rack (>= 2.2.4)
35
+ rack-session (>= 1.0.1)
36
+ rack-test (>= 0.6.3)
37
+ rails-dom-testing (~> 2.2)
38
+ rails-html-sanitizer (~> 1.6)
39
+ useragent (~> 0.16)
40
+ actiontext (8.0.1)
41
+ actionpack (= 8.0.1)
42
+ activerecord (= 8.0.1)
43
+ activestorage (= 8.0.1)
44
+ activesupport (= 8.0.1)
45
+ globalid (>= 0.6.0)
46
+ nokogiri (>= 1.8.5)
47
+ actionview (8.0.1)
48
+ activesupport (= 8.0.1)
49
+ builder (~> 3.1)
50
+ erubi (~> 1.11)
51
+ rails-dom-testing (~> 2.2)
52
+ rails-html-sanitizer (~> 1.6)
53
+ activejob (8.0.1)
54
+ activesupport (= 8.0.1)
55
+ globalid (>= 0.3.6)
56
+ activemodel (8.0.1)
57
+ activesupport (= 8.0.1)
58
+ activerecord (8.0.1)
59
+ activemodel (= 8.0.1)
60
+ activesupport (= 8.0.1)
61
+ timeout (>= 0.4.0)
62
+ activestorage (8.0.1)
63
+ actionpack (= 8.0.1)
64
+ activejob (= 8.0.1)
65
+ activerecord (= 8.0.1)
66
+ activesupport (= 8.0.1)
67
+ marcel (~> 1.0)
68
+ activesupport (8.0.1)
69
+ base64
70
+ benchmark (>= 0.3)
71
+ bigdecimal
72
+ concurrent-ruby (~> 1.0, >= 1.3.1)
73
+ connection_pool (>= 2.2.5)
74
+ drb
75
+ i18n (>= 1.6, < 2)
76
+ logger (>= 1.4.2)
77
+ minitest (>= 5.1)
78
+ securerandom (>= 0.3)
79
+ tzinfo (~> 2.0, >= 2.0.5)
80
+ uri (>= 0.13.1)
81
+ appraisal (2.5.0)
82
+ bundler
83
+ rake
84
+ thor (>= 0.14.0)
85
+ ast (2.4.2)
86
+ autotest-suffix (1.1.0)
87
+ base64 (0.2.0)
88
+ benchmark (0.4.0)
89
+ bigdecimal (3.1.9)
90
+ builder (3.3.0)
91
+ combustion (1.5.0)
92
+ activesupport (>= 3.0.0)
93
+ railties (>= 3.0.0)
94
+ thor (>= 0.14.6)
95
+ concurrent-ruby (1.3.5)
96
+ connection_pool (2.5.0)
97
+ crass (1.0.6)
98
+ date (3.4.1)
99
+ debug (1.10.0)
100
+ irb (~> 1.10)
101
+ reline (>= 0.3.8)
102
+ drb (2.2.1)
103
+ erubi (1.13.1)
104
+ globalid (1.2.1)
105
+ activesupport (>= 6.1)
106
+ i18n (1.14.7)
107
+ concurrent-ruby (~> 1.0)
108
+ io-console (0.8.0)
109
+ irb (1.15.1)
110
+ pp (>= 0.6.0)
111
+ rdoc (>= 4.0.0)
112
+ reline (>= 0.4.2)
113
+ json (2.10.1)
114
+ language_server-protocol (3.17.0.4)
115
+ lint_roller (1.1.0)
116
+ logger (1.6.6)
117
+ loofah (2.24.0)
118
+ crass (~> 1.0.2)
119
+ nokogiri (>= 1.12.0)
120
+ mail (2.8.1)
121
+ mini_mime (>= 0.1.1)
122
+ net-imap
123
+ net-pop
124
+ net-smtp
125
+ marcel (1.0.4)
126
+ mini_mime (1.1.5)
127
+ minitest (5.25.4)
128
+ minitest-autotest (1.1.1)
129
+ minitest-server (~> 1.0)
130
+ path_expander (~> 1.0)
131
+ minitest-focus (1.4.0)
132
+ minitest (>= 4, < 6)
133
+ minitest-server (1.0.8)
134
+ drb (~> 2.0)
135
+ minitest (~> 5.16)
136
+ mocha (2.7.1)
137
+ ruby2_keywords (>= 0.0.5)
138
+ net-imap (0.5.6)
139
+ date
140
+ net-protocol
141
+ net-pop (0.1.2)
142
+ net-protocol
143
+ net-protocol (0.2.2)
144
+ timeout
145
+ net-smtp (0.5.1)
146
+ net-protocol
147
+ nio4r (2.7.4)
148
+ nokogiri (1.18.3-aarch64-linux-gnu)
149
+ racc (~> 1.4)
150
+ nokogiri (1.18.3-aarch64-linux-musl)
151
+ racc (~> 1.4)
152
+ nokogiri (1.18.3-arm-linux-gnu)
153
+ racc (~> 1.4)
154
+ nokogiri (1.18.3-arm-linux-musl)
155
+ racc (~> 1.4)
156
+ nokogiri (1.18.3-arm64-darwin)
157
+ racc (~> 1.4)
158
+ nokogiri (1.18.3-x86_64-darwin)
159
+ racc (~> 1.4)
160
+ nokogiri (1.18.3-x86_64-linux-gnu)
161
+ racc (~> 1.4)
162
+ nokogiri (1.18.3-x86_64-linux-musl)
163
+ racc (~> 1.4)
164
+ parallel (1.26.3)
165
+ parser (3.3.7.1)
166
+ ast (~> 2.4.1)
167
+ racc
168
+ path_expander (1.1.3)
169
+ pp (0.6.2)
170
+ prettyprint
171
+ prettyprint (0.2.0)
172
+ psych (5.2.3)
173
+ date
174
+ stringio
175
+ racc (1.8.1)
176
+ rack (3.1.11)
177
+ rack-session (2.1.0)
178
+ base64 (>= 0.1.0)
179
+ rack (>= 3.0.0)
180
+ rack-test (2.2.0)
181
+ rack (>= 1.3)
182
+ rackup (2.2.1)
183
+ rack (>= 3)
184
+ rails (8.0.1)
185
+ actioncable (= 8.0.1)
186
+ actionmailbox (= 8.0.1)
187
+ actionmailer (= 8.0.1)
188
+ actionpack (= 8.0.1)
189
+ actiontext (= 8.0.1)
190
+ actionview (= 8.0.1)
191
+ activejob (= 8.0.1)
192
+ activemodel (= 8.0.1)
193
+ activerecord (= 8.0.1)
194
+ activestorage (= 8.0.1)
195
+ activesupport (= 8.0.1)
196
+ bundler (>= 1.15.0)
197
+ railties (= 8.0.1)
198
+ rails-dom-testing (2.2.0)
199
+ activesupport (>= 5.0.0)
200
+ minitest
201
+ nokogiri (>= 1.6)
202
+ rails-html-sanitizer (1.6.2)
203
+ loofah (~> 2.21)
204
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
205
+ railties (8.0.1)
206
+ actionpack (= 8.0.1)
207
+ activesupport (= 8.0.1)
208
+ irb (~> 1.13)
209
+ rackup (>= 1.0.0)
210
+ rake (>= 12.2)
211
+ thor (~> 1.0, >= 1.2.2)
212
+ zeitwerk (~> 2.6)
213
+ rainbow (3.1.1)
214
+ rake (13.2.1)
215
+ rdoc (6.12.0)
216
+ psych (>= 4.0.0)
217
+ regexp_parser (2.10.0)
218
+ reline (0.6.0)
219
+ io-console (~> 0.5)
220
+ rubocop (1.73.2)
221
+ json (~> 2.3)
222
+ language_server-protocol (~> 3.17.0.2)
223
+ lint_roller (~> 1.1.0)
224
+ parallel (~> 1.10)
225
+ parser (>= 3.3.0.2)
226
+ rainbow (>= 2.2.2, < 4.0)
227
+ regexp_parser (>= 2.9.3, < 3.0)
228
+ rubocop-ast (>= 1.38.0, < 2.0)
229
+ ruby-progressbar (~> 1.7)
230
+ unicode-display_width (>= 2.4.0, < 4.0)
231
+ rubocop-ast (1.38.1)
232
+ parser (>= 3.3.1.0)
233
+ rubocop-minitest (0.37.1)
234
+ lint_roller (~> 1.1)
235
+ rubocop (>= 1.72.1, < 2.0)
236
+ rubocop-ast (>= 1.38.0, < 2.0)
237
+ rubocop-rake (0.7.1)
238
+ lint_roller (~> 1.1)
239
+ rubocop (>= 1.72.1)
240
+ ruby-progressbar (1.13.0)
241
+ ruby2_keywords (0.0.5)
242
+ securerandom (0.4.1)
243
+ sqlite3 (2.6.0-aarch64-linux-gnu)
244
+ sqlite3 (2.6.0-aarch64-linux-musl)
245
+ sqlite3 (2.6.0-arm-linux-gnu)
246
+ sqlite3 (2.6.0-arm-linux-musl)
247
+ sqlite3 (2.6.0-arm64-darwin)
248
+ sqlite3 (2.6.0-x86_64-darwin)
249
+ sqlite3 (2.6.0-x86_64-linux-gnu)
250
+ sqlite3 (2.6.0-x86_64-linux-musl)
251
+ stringio (3.1.5)
252
+ thor (1.3.2)
253
+ timeout (0.4.3)
254
+ tzinfo (2.0.6)
255
+ concurrent-ruby (~> 1.0)
256
+ unicode-display_width (3.1.4)
257
+ unicode-emoji (~> 4.0, >= 4.0.4)
258
+ unicode-emoji (4.0.4)
259
+ uri (1.0.3)
260
+ useragent (0.16.11)
261
+ websocket-driver (0.7.7)
262
+ base64
263
+ websocket-extensions (>= 0.1.0)
264
+ websocket-extensions (0.1.5)
265
+ zeitwerk (2.7.2)
266
+
267
+ PLATFORMS
268
+ aarch64-linux-gnu
269
+ aarch64-linux-musl
270
+ arm-linux-gnu
271
+ arm-linux-musl
272
+ arm64-darwin
273
+ x86_64-darwin
274
+ x86_64-linux-gnu
275
+ x86_64-linux-musl
276
+
277
+ DEPENDENCIES
278
+ appraisal
279
+ autotest-suffix
280
+ combustion
281
+ debug
282
+ minitest
283
+ minitest-autotest
284
+ minitest-focus
285
+ mocha
286
+ rails (~> 8.0.1)
287
+ rake (~> 13.0)
288
+ rubocop
289
+ rubocop-minitest
290
+ rubocop-rake
291
+ sqlite3
292
+ stance!
293
+
294
+ BUNDLED WITH
295
+ 2.6.5
@@ -13,7 +13,7 @@ module Stance
13
13
 
14
14
  def copy_migration
15
15
  migration_template 'migration.rb', 'db/migrate/create_stance_event_record.rb',
16
- migration_version: migration_version
16
+ migration_version:
17
17
  end
18
18
 
19
19
  def migration_version
data/lib/stance/event.rb CHANGED
@@ -10,18 +10,18 @@ module Stance
10
10
  class << self
11
11
  attr_accessor :callback_methods
12
12
 
13
- def before_create(*methods, &block)
14
- set_callback :create, :before, *methods, &block
13
+ def before_create(*methods, &)
14
+ set_callback(:create, :before, *methods, &)
15
15
  end
16
16
 
17
- def after_create(*methods, &block)
18
- set_callback :create, :after, *methods, &block
17
+ def after_create(*methods, &)
18
+ set_callback(:create, :after, *methods, &)
19
19
  end
20
20
 
21
21
  def method_added(method_name)
22
22
  super
23
23
 
24
- return if self == Stance::Event || !instance_methods(false).include?(method_name)
24
+ return if self == Stance::Event || !method_defined?(method_name, false)
25
25
 
26
26
  self.callback_methods ||= []
27
27
  self.callback_methods << method_name
@@ -34,7 +34,7 @@ module Stance
34
34
  @metadata = metadata
35
35
  @options = { singleton: false, record: true, class: false }.merge(options)
36
36
 
37
- attrs = { name: name, metadata: metadata }
37
+ attrs = { name:, metadata: }
38
38
  if subject.is_a?(ActiveRecord::Base)
39
39
  attrs[:subject] = subject
40
40
  elsif subject.is_a?(Class) && subject < ActiveRecord::Base
@@ -57,7 +57,9 @@ module Stance
57
57
  if self.class.name != 'Stance::Event'
58
58
  Rails.logger.debug "Event: #{full_name}"
59
59
 
60
- self.class.callback_methods&.each { |method| send method }
60
+ self.class.callback_methods&.each do |method|
61
+ send method if public_methods(false).include?(method)
62
+ end
61
63
  end
62
64
 
63
65
  record.save if @options[:record]
@@ -79,7 +81,7 @@ module Stance
79
81
 
80
82
  # Event is a singleton and already exists.
81
83
  def singleton_exists?
82
- options[:singleton] && subject.events.active.exists?(name: name)
84
+ options[:singleton] && subject.events.active.exists?(name:)
83
85
  end
84
86
  end
85
87
  end
data/lib/stance/events.rb CHANGED
@@ -26,12 +26,12 @@ module Stance
26
26
  @events[sname] = options
27
27
  end
28
28
 
29
- def before_create(*methods, &block)
30
- set_callback :create, :before, *methods, &block
29
+ def before_create(*methods, &)
30
+ set_callback(:create, :before, *methods, &)
31
31
  end
32
32
 
33
- def after_create(*methods, &block)
34
- set_callback :create, :after, *methods, &block
33
+ def after_create(*methods, &)
34
+ set_callback(:create, :after, *methods, &)
35
35
  end
36
36
  end
37
37
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stance
4
- VERSION = '0.8.3'
4
+ VERSION = '0.9.1'
5
5
  end
data/stance.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = 'Event System for Rails'
12
12
  spec.homepage = 'https://github.com/joelmoss/stance'
13
13
  spec.license = 'MIT'
14
- spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
14
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.2.0')
15
15
 
16
16
  spec.metadata['homepage_uri'] = spec.homepage
17
17
  spec.metadata['source_code_uri'] = spec.homepage
@@ -25,6 +25,5 @@ Gem::Specification.new do |spec|
25
25
  end
26
26
  spec.require_paths = ['lib']
27
27
 
28
- spec.add_dependency 'multi_json', '~> 1.15'
29
- spec.add_dependency 'rails', ['>= 7.0', '< 8.0']
28
+ spec.add_dependency 'rails', ['>= 7.0', '< 9.0']
30
29
  end
metadata CHANGED
@@ -1,29 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Moss
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-01-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: multi_json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.15'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.15'
27
12
  - !ruby/object:Gem::Dependency
28
13
  name: rails
29
14
  requirement: !ruby/object:Gem::Requirement
@@ -33,7 +18,7 @@ dependencies:
33
18
  version: '7.0'
34
19
  - - "<"
35
20
  - !ruby/object:Gem::Version
36
- version: '8.0'
21
+ version: '9.0'
37
22
  type: :runtime
38
23
  prerelease: false
39
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,8 +28,7 @@ dependencies:
43
28
  version: '7.0'
44
29
  - - "<"
45
30
  - !ruby/object:Gem::Version
46
- version: '8.0'
47
- description:
31
+ version: '9.0'
48
32
  email:
49
33
  - joel@developwithstyle.com
50
34
  executables: []
@@ -52,9 +36,11 @@ extensions: []
52
36
  extra_rdoc_files: []
53
37
  files:
54
38
  - ".autotest"
39
+ - ".github/workflows/main.yml"
55
40
  - ".gitignore"
56
41
  - ".rubocop.yml"
57
- - ".travis.yml"
42
+ - ".ruby-version"
43
+ - Appraisals
58
44
  - CODE_OF_CONDUCT.md
59
45
  - Gemfile
60
46
  - Gemfile.lock
@@ -63,6 +49,14 @@ files:
63
49
  - Rakefile
64
50
  - app/models/stance/event_record.rb
65
51
  - config.ru
52
+ - gemfiles/rails_7.1.gemfile
53
+ - gemfiles/rails_7.1.gemfile.lock
54
+ - gemfiles/rails_7.2.gemfile
55
+ - gemfiles/rails_7.2.gemfile.lock
56
+ - gemfiles/rails_8.1.gemfile
57
+ - gemfiles/rails_8.1.gemfile.lock
58
+ - gemfiles/rails_8.gemfile
59
+ - gemfiles/rails_8.gemfile.lock
66
60
  - lib/generators/stance/install_generator.rb
67
61
  - lib/generators/stance/templates/migration.rb.tt
68
62
  - lib/stance.rb
@@ -82,7 +76,6 @@ metadata:
82
76
  source_code_uri: https://github.com/joelmoss/stance
83
77
  changelog_uri: https://github.com/joelmoss/stance/releases
84
78
  rubygems_mfa_required: 'true'
85
- post_install_message:
86
79
  rdoc_options: []
87
80
  require_paths:
88
81
  - lib
@@ -90,15 +83,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
83
  requirements:
91
84
  - - ">="
92
85
  - !ruby/object:Gem::Version
93
- version: 2.7.0
86
+ version: 3.2.0
94
87
  required_rubygems_version: !ruby/object:Gem::Requirement
95
88
  requirements:
96
89
  - - ">="
97
90
  - !ruby/object:Gem::Version
98
91
  version: '0'
99
92
  requirements: []
100
- rubygems_version: 3.5.3
101
- signing_key:
93
+ rubygems_version: 4.0.3
102
94
  specification_version: 4
103
95
  summary: Event System for Rails
104
96
  test_files: []
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.7.1
6
- before_install: gem install bundler -v 2.1.4