paranoia 2.5.0 → 2.5.3

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: 722efe26008fec67396f31b78997d981323a85ded9232369e36b06f9c6a2c254
4
- data.tar.gz: 4262aeee60d6beb99958ffe43032f47cab4b9ce556663daf7c6d9b34c9a17d7e
3
+ metadata.gz: 5a82e404509dd15068040f391a794122bc66343af8def462f0eb4e37851b670f
4
+ data.tar.gz: fe04b171c8d485c18a4d41b2603780dfe15efebe1b3fd72d2a9074d0463642ae
5
5
  SHA512:
6
- metadata.gz: 1e39832dc8d08052777e4c750a6481d4eb2280823561d2adfc6844426b7a23caf79eeb97fc9d98931da5f30142af0b241f6e3cc920ff82362bd5a605abc1b1f3
7
- data.tar.gz: 684e92dc3ff1a24cd965ae4d03ef43b22e6ccc3c6a8cf73b41062d50d98568b1393ddfcc54a3f9e5630f65eba474b87ab202e03c9ca3613f82b470e434c5d12c
6
+ metadata.gz: e797a325e51bd15605087eae81c27c622df6b2b3e2c46466b6a3d2f4509e612a3712871e4140abb0530993b6773f59765cab1c10672572f3176c7e32401ecaab
7
+ data.tar.gz: b040f4ea08e809a827172755f7913da31a93aa5a9f7207ac9626fa9dadf848e36b352eb7084687cbee3a553c7f33124e434d291c900ffca3cfbe1dba340d0fb3
@@ -16,7 +16,8 @@ jobs:
16
16
  fail-fast: false
17
17
  matrix:
18
18
  ruby:
19
- # - 3.0 # incompatible with rubysl
19
+ - 3.1
20
+ - '3.0'
20
21
  - 2.7
21
22
  - 2.6
22
23
  - 2.5
@@ -41,9 +42,13 @@ jobs:
41
42
  ruby: 2.5
42
43
  # Legacy Rails with newer rubies
43
44
  - rails: '~> 5.1.0'
44
- ruby: 3.0
45
+ ruby: '3.0'
45
46
  - rails: '~> 5.2.0'
46
- ruby: 3.0
47
+ ruby: '3.0'
48
+ - rails: '~> 5.1.0'
49
+ ruby: 3.1
50
+ - rails: '~> 5.2.0'
51
+ ruby: 3.1
47
52
 
48
53
  env:
49
54
  RAILS: ${{ matrix.rails }}
data/CHANGELOG.md CHANGED
@@ -1,12 +1,46 @@
1
1
  # paranoia Changelog
2
2
 
3
+ ## 2.5.3
4
+
5
+ * [#532](https://github.com/rubysherpas/paranoia/pull/532) Fix: correct bug when sentinel_value is not a timestamp
6
+ [Hassanin Ahmed](https://github.com/sas1ni69)
7
+ * [#531](https://github.com/rubysherpas/paranoia/pull/531) Added test case to reproduce bug introduce in v2.5.1
8
+ [Sherif Elkassaby](https://github.com/sherif-nedap)
9
+ * [#529](https://github.com/rubysherpas/paranoia/pull/529) Fix: Do not define a RSpec matcher when RSpec isn't present
10
+ [Sebastian Welther](https://github.com/swelther)
11
+
12
+ ## 2.5.2
13
+
14
+ * [#526](https://github.com/rubysherpas/paranoia/pull/526) Do not include tests files in packaged gem
15
+
16
+ [Jason Fleetwood-Boldt](https://github.com/jasonfb)
17
+ * [#492](https://github.com/rubysherpas/paranoia/pull/492) Warn if acts_as_paranoid is called more than once on the same model
18
+
19
+ [Ignatius Reza](https://github.com/ignatiusreza)
20
+
21
+ ## 2.5.1
22
+
23
+ * [#481](https://github.com/rubysherpas/paranoia/pull/481) Replaces hard coded `deleted_at` with `paranoia_column`.
24
+
25
+ [Hassanin Ahmed](https://github.com/sas1ni69)
26
+
27
+ ## 2.5.0
28
+
29
+ * [#516](https://github.com/rubysherpas/paranoia/pull/516) Add support for ActiveRecord 7.0, drop support for EOL Ruby < 2.5 and Rails < 5.1
30
+ adding support for Rails 7
31
+
32
+ [Mathieu Jobin](https://github.com/mathieujobin)
33
+ * [#515](https://github.com/rubysherpas/paranoia/pull/515) Switch from Travis CI to GitHub Actions
34
+
35
+ [Shinichi Maeshima](https://github.com/willnet)
36
+
3
37
  ## 2.4.3
4
38
 
5
39
  * [#503](https://github.com/rubysherpas/paranoia/pull/503) Bump activerecord dependency for Rails 6.1
6
40
 
7
41
  [Jörg Schiller](https://github.com/joergschiller)
8
42
 
9
- * [#483](https://github.com/rubysherpas/paranoia/pull/483) Update JRuby version to 9.2.8.0 + remove EOL Ruby 2.2
43
+ * [#483](https://github.com/rubysherpas/paranoia/pull/483) Update JRuby version to 9.2.8.0 + remove EOL Ruby 2.2
10
44
 
11
45
  [Uwe Kubosch](https://github.com/donv)
12
46
 
data/Gemfile CHANGED
@@ -12,10 +12,12 @@ platforms :jruby do
12
12
  gem 'activerecord-jdbcsqlite3-adapter'
13
13
  end
14
14
 
15
- platforms :rbx do
16
- gem 'rubinius-developer_tools'
17
- gem 'rubysl', '~> 2.0'
18
- gem 'rubysl-test-unit'
15
+ if RUBY_ENGINE == 'rbx'
16
+ platforms :rbx do
17
+ gem 'rubinius-developer_tools'
18
+ gem 'rubysl', '~> 2.0'
19
+ gem 'rubysl-test-unit'
20
+ end
19
21
  end
20
22
 
21
23
  rails = ENV['RAILS'] || '~> 5.2.0'
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/paranoia.svg)](https://badge.fury.io/rb/paranoia)
2
+ [![build](https://github.com/rubysherpas/paranoia/actions/workflows/build.yml/badge.svg)](https://github.com/rubysherpas/paranoia/actions/workflows/build.yml)
2
3
 
3
4
  **Notice:**
4
5
 
@@ -1,23 +1,26 @@
1
- require 'rspec/expectations'
1
+ if defined?(RSpec)
2
+ require 'rspec/expectations'
2
3
 
3
- # Validate the subject's class did call "acts_as_paranoid"
4
- RSpec::Matchers.define :act_as_paranoid do
5
- match { |subject| subject.class.ancestors.include?(Paranoia) }
4
+ # Validate the subject's class did call "acts_as_paranoid"
5
+ RSpec::Matchers.define :act_as_paranoid do
6
+ match { |subject| subject.class.ancestors.include?(Paranoia) }
6
7
 
7
- failure_message_proc = lambda do
8
- "expected #{subject.class} to use `acts_as_paranoid`"
9
- end
8
+ failure_message_proc = lambda do
9
+ "expected #{subject.class} to use `acts_as_paranoid`"
10
+ end
10
11
 
11
- failure_message_when_negated_proc = lambda do
12
- "expected #{subject.class} not to use `acts_as_paranoid`"
13
- end
12
+ failure_message_when_negated_proc = lambda do
13
+ "expected #{subject.class} not to use `acts_as_paranoid`"
14
+ end
14
15
 
15
- if respond_to?(:failure_message_when_negated)
16
- failure_message(&failure_message_proc)
17
- failure_message_when_negated(&failure_message_when_negated_proc)
18
- else
19
- # RSpec 2 compatibility:
20
- failure_message_for_should(&failure_message_proc)
21
- failure_message_for_should_not(&failure_message_when_negated_proc)
16
+ if respond_to?(:failure_message_when_negated)
17
+ failure_message(&failure_message_proc)
18
+ failure_message_when_negated(&failure_message_when_negated_proc)
19
+ else
20
+ # RSpec 2 compatibility:
21
+ failure_message_for_should(&failure_message_proc)
22
+ failure_message_for_should_not(&failure_message_when_negated_proc)
23
+ end
22
24
  end
25
+
23
26
  end
@@ -1,3 +1,3 @@
1
1
  module Paranoia
2
- VERSION = '2.5.0'.freeze
2
+ VERSION = '2.5.3'.freeze
3
3
  end
data/lib/paranoia.rb CHANGED
@@ -129,16 +129,16 @@ module Paranoia
129
129
  def get_recovery_window_range(opts)
130
130
  return opts[:recovery_window_range] if opts[:recovery_window_range]
131
131
  return unless opts[:recovery_window]
132
- (deleted_at - opts[:recovery_window]..deleted_at + opts[:recovery_window])
132
+ (deletion_time - opts[:recovery_window]..deletion_time + opts[:recovery_window])
133
133
  end
134
134
 
135
135
  def within_recovery_window?(recovery_window_range)
136
136
  return true unless recovery_window_range
137
- recovery_window_range.cover?(deleted_at)
137
+ recovery_window_range.cover?(deletion_time)
138
138
  end
139
139
 
140
140
  def paranoia_destroyed?
141
- send(paranoia_column) != paranoia_sentinel_value
141
+ paranoia_column_value != paranoia_sentinel_value
142
142
  end
143
143
  alias :deleted? :paranoia_destroyed?
144
144
 
@@ -242,6 +242,12 @@ end
242
242
  ActiveSupport.on_load(:active_record) do
243
243
  class ActiveRecord::Base
244
244
  def self.acts_as_paranoid(options={})
245
+ if included_modules.include?(Paranoia)
246
+ puts "[WARN] #{self.name} is calling acts_as_paranoid more than once!"
247
+
248
+ return
249
+ end
250
+
245
251
  define_model_callbacks :restore, :real_destroy
246
252
 
247
253
  alias_method :really_destroyed?, :destroyed?
@@ -290,9 +296,17 @@ ActiveSupport.on_load(:active_record) do
290
296
  self.class.paranoia_column
291
297
  end
292
298
 
299
+ def paranoia_column_value
300
+ send(paranoia_column)
301
+ end
302
+
293
303
  def paranoia_sentinel_value
294
304
  self.class.paranoia_sentinel_value
295
305
  end
306
+
307
+ def deletion_time
308
+ paranoia_column_value.acts_like?(:time) ? paranoia_column_value : deleted_at
309
+ end
296
310
  end
297
311
  end
298
312
 
data/paranoia.gemspec CHANGED
@@ -29,7 +29,12 @@ Gem::Specification.new do |s|
29
29
  s.add_development_dependency "bundler", ">= 1.0.0"
30
30
  s.add_development_dependency "rake"
31
31
 
32
- s.files = `git ls-files`.split("\n")
32
+
33
+ s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
34
+ files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)}) }
35
+ files
36
+ end
37
+
33
38
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
34
39
  s.require_path = 'lib'
35
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paranoia
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - radarlistener@gmail.com
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-18 00:00:00.000000000 Z
11
+ date: 2022-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -87,12 +87,11 @@ files:
87
87
  - lib/paranoia/rspec.rb
88
88
  - lib/paranoia/version.rb
89
89
  - paranoia.gemspec
90
- - test/paranoia_test.rb
91
90
  homepage: https://github.com/rubysherpas/paranoia
92
91
  licenses:
93
92
  - MIT
94
93
  metadata: {}
95
- post_install_message:
94
+ post_install_message:
96
95
  rdoc_options: []
97
96
  require_paths:
98
97
  - lib
@@ -107,8 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
106
  - !ruby/object:Gem::Version
108
107
  version: 1.3.6
109
108
  requirements: []
110
- rubygems_version: 3.2.11
111
- signing_key:
109
+ rubygems_version: 3.2.32
110
+ signing_key:
112
111
  specification_version: 4
113
112
  summary: Paranoia is a re-implementation of acts_as_paranoid for Rails 3, 4, and 5,
114
113
  using much, much, much less code.