kithe 2.11.0 → 2.13.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: c501b48a3f6f517f1fd6906a357aba0004717c94f8b40bd20996efd696bcaff2
4
- data.tar.gz: b29ffa367832a02a78a94641c6bf37c5bac03cda23c7db80325806bcc151d3f5
3
+ metadata.gz: d25b8c631517c19dd562ad64b83e8460593cade4360d4623598a883d18271e87
4
+ data.tar.gz: c1b0efd1169fff35fc0685bfb8a7db93386fe418a0d795ace01a7a1a398cfdd4
5
5
  SHA512:
6
- metadata.gz: a1e75a34696381c7564e2f2484a991dff65a97e2d7dde3d4132ecb48eb5ba5c3967d665241dd1b4c9de82bc8a205f42238fbe2c410ad5019c878851e4e35c938
7
- data.tar.gz: c68de2016880101aef6ed61dcf0752e62a68dc79ac9633aa9b74ad478e5daa2af1f49a94a4445d77d0e1c13a303b722eb6ec6a74affbacd59d301b7d77811dd0
6
+ metadata.gz: b905f4aab0f2f944551e503d0f68c2ebfc4aa527c88e9c576d6cbe1d0575c499225e856e0343fd9f2edaadf88a78d159345bba1f9b2d9de5ad56c2ae06c71158
7
+ data.tar.gz: 62e1dbfe5759afa181c2dad7522277392eb19b1013f4303e69459f6d5fda570f51d6e9b8acc8ffe2eececb4d7a79b0d558091abaf4742642d3a9bf69e253bcd9
@@ -27,6 +27,13 @@ class Kithe::Model < ActiveRecord::Base
27
27
 
28
28
  attr_json_config(default_accepts_nested_attributes: { reject_if: :all_blank })
29
29
 
30
+ # keep json_attributes column out of #inspect display of model shown in logs and
31
+ # console -- because it can be huge, and is generally duplicated by individual
32
+ # attributes already included. filter_attributes only supported in Rails 6+
33
+ if self.respond_to?(:filter_attributes)
34
+ self.filter_attributes += [:json_attributes]
35
+ end
36
+
30
37
  validates_presence_of :title
31
38
 
32
39
  # this should only apply to Works, but we define it here so we can preload it
@@ -147,6 +154,40 @@ class Kithe::Model < ActiveRecord::Base
147
154
  self.leaf_representative_id = result
148
155
  end
149
156
 
157
+ # Insert an after_commit hook that will run BEFORE any existing after_commit hooks,
158
+ # regardless of Rails version and run_after_transaction_callbacks_in_order_defined configuration.
159
+ #
160
+ # Sometimes you need to insert an after_commit hook that goes BEFORE shrine's after_commit
161
+ # callbacks for promotion in activerecord after_commit
162
+ #
163
+ # In Rails prior to 7.1, that happens automatically just by adding an after_commit.
164
+ # But Rails 7.1 by default changes the order of after_commit AND removes the ability
165
+ # to alter it with prepend! https://github.com/rails/rails/issues/50118
166
+ #
167
+ # We add this method, that will do the right thing -- making sure the new hook we are adding
168
+ # is run BEFORE any existing ones -- in both Rails < 7.1 and Rails 7.1 with
169
+ # run_after_transaction_callbacks_in_order_defined
170
+ #
171
+ # @example
172
+ #
173
+ # class MyAsset < Kithe::Asset
174
+ # kithe_earlier_after_commit :some_method_to_run_first
175
+ #
176
+ # kithe_earlier_after_commit do
177
+ # # This code will be in an after_commit that comes BEFORE
178
+ # # any existing ones
179
+ # end
180
+ # end
181
+ #
182
+ def self.kithe_earlier_after_commit(*args, &block)
183
+ # confusingly in this state, we need prepend FALSE to have this new callback be registered to go
184
+ # FIRST. And this actually is correct and works whether or not run_after_transaction_callbacks_in_order_defined
185
+ # Very confusing, we test thorougly.
186
+ set_options_for_callbacks!(args, {prepend: false})
187
+
188
+ set_callback(:commit, :after, *args, &block)
189
+ end
190
+
150
191
  private
151
192
 
152
193
 
data/lib/kithe/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kithe
2
- VERSION = '2.11.0'
2
+ VERSION = '2.13.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kithe
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.0
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-19 00:00:00.000000000 Z
11
+ date: 2023-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,34 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.1
19
+ version: '6.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.1'
22
+ version: '7.2'
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: 5.2.1
29
+ version: '6.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.1'
32
+ version: '7.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: attr_json
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "<"
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 3.0.0
39
+ version: '2.0'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "<"
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 3.0.0
46
+ version: '2.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: simple_form
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -334,6 +334,20 @@ dependencies:
334
334
  - - "<"
335
335
  - !ruby/object:Gem::Version
336
336
  version: '2'
337
+ - !ruby/object:Gem::Dependency
338
+ name: rspec-rails
339
+ requirement: !ruby/object:Gem::Requirement
340
+ requirements:
341
+ - - ">="
342
+ - !ruby/object:Gem::Version
343
+ version: '0'
344
+ type: :development
345
+ prerelease: false
346
+ version_requirements: !ruby/object:Gem::Requirement
347
+ requirements:
348
+ - - ">="
349
+ - !ruby/object:Gem::Version
350
+ version: '0'
337
351
  description:
338
352
  email:
339
353
  - jrochkind@sciencehistory.org
@@ -428,7 +442,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
428
442
  - !ruby/object:Gem::Version
429
443
  version: '0'
430
444
  requirements: []
431
- rubygems_version: 3.3.26
445
+ rubygems_version: 3.4.21
432
446
  signing_key:
433
447
  specification_version: 4
434
448
  summary: Shareable tools/components for building a digital collections app in Rails.