pbbuilder 0.13.1 → 0.13.3

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: 723b6cc8d707629dbdc6452a4b87cc3789cf53c9a1297385d36d6f9d96754dbd
4
- data.tar.gz: 385d5ef697c559167a05a3952323823d688cd6b8ce3ae8287071ad2f59094ea8
3
+ metadata.gz: 10736ed13e1665f1bf45095973eb464ab2bcef87f3d69fe4bb8f89e3f35e0474
4
+ data.tar.gz: a2a8522c756cdf99638d7aef7f3ad7ed9d009ab24b46e499f2f7e0d4a3427b5e
5
5
  SHA512:
6
- metadata.gz: 22726723278482ac876dda06bde71419520b007302ea8e377f64473a1118cde6e5947d3b640e29b869743996758309c667b6d40df037582609285fdc338f5ebe
7
- data.tar.gz: 2f2164afc66e60e37483fc99442ed8983843eeb77c88e01c99196199539c3957e19a77bb787f6fb12098a462f5a455f14773890f649af9c9e5b6efe88702d8ff
6
+ metadata.gz: 366ce4bf8ef0195f67f9961cd15b5ebc8311b3c15c192d54a5a064a33a34e9e7696a2114afab7f4734bb1e89d61769ae823a91567562741bfc4bb0e9a41a4d3d
7
+ data.tar.gz: 88d5bc81285ac6e48531328b03a2194b5939dd40ca8bfe003502486f7009c22bb55f1a18c2767f28153942801c7f913526d5a5c18294373a00fcffbfd6daeef4
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  This format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## 0.13.2 2023.02.3
7
+ ### Fixed
8
+ - In case ActiveSupport::Cache::FileStore in Rails is used as a cache, File.atomic_write can have a race condition and fail to rename temporary file. We're attempting to recover from that, by catching this specific error and returning a value.
9
+
6
10
  ## 0.13.1 2023.01.24
7
11
  ### Added
8
12
  - #merge! to support boolean values
@@ -108,11 +108,22 @@ class PbbuilderTemplate < Pbbuilder
108
108
  # @param key string
109
109
  # @params options hash
110
110
  #
111
- # @return string
111
+ # @return string contents of a cache
112
112
  def _write_fragment_cache(key, options = nil)
113
- @context.controller.instrument_fragment_cache :_write_fragment, key do
113
+ @context.controller.instrument_fragment_cache :write_fragment, key do
114
114
  yield.tap do |value|
115
- ::Rails.cache.write(key, value, options)
115
+ begin
116
+ ::Rails.cache.write(key, value, options)
117
+ rescue ::SystemCallError
118
+ # In case ActiveSupport::Cache::FileStore in Rails is used as a cache,
119
+ # File.atomic_write can have a race condition and fail to rename temporary
120
+ # file. We're attempting to recover from that, by catching this specific
121
+ # error and returning a value.
122
+ #
123
+ # @see https://github.com/rails/rails/pull/44151
124
+ # @see https://github.com/rails/rails/blob/main/activesupport/lib/active_support/core_ext/file/atomic.rb#L50
125
+ value
126
+ end
116
127
  end
117
128
  end
118
129
  end
data/pbbuilder.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "pbbuilder"
3
- spec.version = "0.13.1"
3
+ spec.version = "0.13.3"
4
4
  spec.authors = ["Bouke van der Bijl"]
5
5
  spec.email = ["bouke@cheddar.me"]
6
6
  spec.homepage = "https://github.com/cheddar-me/pbbuilder"
@@ -120,10 +120,10 @@ class PbbuilderTemplateTest < ActiveSupport::TestCase
120
120
  result = nil
121
121
 
122
122
  assert_nothing_raised do
123
- result = render(<<-JBUILDER)
123
+ result = render(<<-PBBUILDER)
124
124
  pb.name "suslik"
125
125
  pb.cache! "nothing" do; end
126
- JBUILDER
126
+ PBBUILDER
127
127
  end
128
128
 
129
129
  assert_equal "suslik", result["name"]
@@ -197,7 +197,7 @@ class PbbuilderTemplateTest < ActiveSupport::TestCase
197
197
  end
198
198
 
199
199
  test "conditional object fragment caching" do
200
- render(<<-JBUILDER)
200
+ render(<<-PBBUILDER)
201
201
  pb.cache_if! true, "cache-key" do
202
202
  pb.name "Hit"
203
203
  end
@@ -205,9 +205,9 @@ class PbbuilderTemplateTest < ActiveSupport::TestCase
205
205
  pb.cache_if! false, "cache-key" do
206
206
  pb.last_name "Hit"
207
207
  end
208
- JBUILDER
208
+ PBBUILDER
209
209
 
210
- result = render(<<-JBUILDER)
210
+ result = render(<<-PBBUILDER)
211
211
  pb.cache_if! true, "cache-key" do
212
212
  pb.name "Miss"
213
213
  end
@@ -215,7 +215,7 @@ class PbbuilderTemplateTest < ActiveSupport::TestCase
215
215
  pb.cache_if! false, "cache-key" do
216
216
  pb.last_name "Miss"
217
217
  end
218
- JBUILDER
218
+ PBBUILDER
219
219
 
220
220
  assert_equal "Hit", result["name"]
221
221
  assert_equal "Miss", result["last_name"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pbbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bouke van der Bijl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-24 00:00:00.000000000 Z
11
+ date: 2023-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf