acts_as_removable 3.0.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/workflow.yml +29 -0
- data/.rubocop.yml +24 -0
- data/Changelog.md +19 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/Rakefile +4 -2
- data/acts_as_removable.gemspec +13 -7
- data/gemfiles/{rails50 → rails52} +1 -1
- data/gemfiles/{rails40 → rails60} +1 -1
- data/gemfiles/{rails41 → rails61} +1 -1
- data/gemfiles/{rails42 → rails70} +1 -1
- data/lib/acts_as_removable/version.rb +3 -1
- data/lib/acts_as_removable.rb +13 -7
- data/spec/acts_as_removable_spec.rb +5 -3
- data/spec/spec_helper.rb +2 -0
- metadata +52 -22
- data/.travis.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e90331337f2511a5fd68294c5c57097bc4327dc0e6a8e76d05ca6583ddcec9f2
|
4
|
+
data.tar.gz: 9308d8ca6f08d3e841fe9b8012b5997248901087f8ab9463593f132b7ade549c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69892a74121499b980b647603f7719b9278cb76861cc5a95b725f5b05dce6cdf9fcb41b1f5702fdda402b8fa7f8f165c4173e88ed8bc8fbebadf263f4c1d7600
|
7
|
+
data.tar.gz: 9676d149163d49dab74d9ba843817130b74b58554ff37cb5f6e89f12ce080f158fe66fff03dcd696eaad0210248c6d9db68780521809a23ebd08a7650ccfbc8b
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: atcs_as_removable specs
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
rspec:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
7
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [2.6, 2.7, 3.0]
|
11
|
+
gemfile:
|
12
|
+
- rails52
|
13
|
+
- rails60
|
14
|
+
- rails61
|
15
|
+
- rails70
|
16
|
+
exclude:
|
17
|
+
- ruby: 2.6
|
18
|
+
gemfile: rails70
|
19
|
+
- ruby: 3.0
|
20
|
+
gemfile: rails52
|
21
|
+
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v2
|
24
|
+
- uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: ${{ matrix.ruby }}
|
27
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
28
|
+
- name: Run tests
|
29
|
+
run: bundle exec rake spec
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
TargetRubyVersion: 2.6
|
6
|
+
|
7
|
+
Layout/HashAlignment:
|
8
|
+
EnforcedHashRocketStyle: table
|
9
|
+
EnforcedColonStyle: table
|
10
|
+
|
11
|
+
Layout/LineLength:
|
12
|
+
Max: 120
|
13
|
+
|
14
|
+
Metrics/AbcSize:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Metrics/MethodLength:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Metrics/BlockLength:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Style/Documentation:
|
24
|
+
Enabled: false
|
data/Changelog.md
CHANGED
@@ -3,6 +3,25 @@ Changelog
|
|
3
3
|
|
4
4
|
#### Unreleased
|
5
5
|
|
6
|
+
#### 3.2.0 (2021-12-16)
|
7
|
+
* Support for Rails 7.0
|
8
|
+
* (Update travis config) -> see below
|
9
|
+
* Replace Travis CI with github actions
|
10
|
+
* Require Ruby >= 2.6.0
|
11
|
+
* Fix renamed rubocop cops
|
12
|
+
* Update copyright year
|
13
|
+
|
14
|
+
#### 3.1.1 (2021-01-08)
|
15
|
+
* Add workaround for new argument handling in ruby 3
|
16
|
+
|
17
|
+
#### 3.1.0 (2020-12-10)
|
18
|
+
* Support for Rails 6.1.0
|
19
|
+
* Update travis config
|
20
|
+
* Reduce travis build matrix to save time and speed up CI
|
21
|
+
|
22
|
+
#### 3.0.1 (2019-11-06)
|
23
|
+
* Fix support for Rails 6.0.X patch level releases
|
24
|
+
|
6
25
|
#### 3.0.0 (2019-08-26)
|
7
26
|
* Support for Rails 6.0.0
|
8
27
|
* Drop support for Rails < 5.0.0
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/Rakefile
CHANGED
data/acts_as_removable.gemspec
CHANGED
@@ -1,28 +1,34 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'English'
|
4
6
|
require 'acts_as_removable/version'
|
5
7
|
|
6
8
|
Gem::Specification.new do |spec|
|
7
9
|
spec.name = 'acts_as_removable'
|
8
10
|
spec.version = ActsAsRemovable::VERSION
|
9
11
|
spec.authors = ['Florian Schwab', 'Erik-B. Ernst']
|
10
|
-
spec.email = ['florian.schwab@sic
|
12
|
+
spec.email = ['florian.schwab@sic.software', 'erik.ernst@sic.software']
|
11
13
|
spec.description = 'Simplifies handling of pseudo removed records.'
|
12
14
|
spec.summary = 'Simplifies handling of pseudo removed records.'
|
13
15
|
spec.homepage = 'https://github.com/SICSoftwareGmbH/acts_as_removable'
|
14
16
|
spec.license = 'MIT'
|
15
17
|
|
16
|
-
spec.files = `git ls-files`.split(
|
18
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
21
|
spec.require_paths = ['lib']
|
20
22
|
|
21
|
-
spec.
|
22
|
-
|
23
|
+
spec.required_ruby_version = '>= 2.6.0'
|
24
|
+
|
25
|
+
spec.add_dependency 'activerecord', '>= 5.0', '< 7.1'
|
26
|
+
spec.add_dependency 'activesupport', '>= 5.0', '< 7.1'
|
23
27
|
|
24
|
-
spec.add_development_dependency 'bundler', '
|
28
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
25
29
|
spec.add_development_dependency 'rake'
|
26
30
|
spec.add_development_dependency 'rspec'
|
31
|
+
spec.add_development_dependency 'rubocop'
|
32
|
+
spec.add_development_dependency 'rubocop-performance'
|
27
33
|
spec.add_development_dependency 'sqlite3'
|
28
34
|
end
|
data/lib/acts_as_removable.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_support/concern'
|
2
4
|
require 'active_record'
|
3
|
-
require
|
5
|
+
require 'acts_as_removable/version'
|
4
6
|
|
5
7
|
module ActsAsRemovable
|
6
8
|
extend ActiveSupport::Concern
|
@@ -17,11 +19,11 @@ module ActsAsRemovable
|
|
17
19
|
def acts_as_removable(options = {})
|
18
20
|
_acts_as_removable_options.merge!(options)
|
19
21
|
|
20
|
-
scope :removed,
|
22
|
+
scope :removed, lambda {
|
21
23
|
where(all.table[_acts_as_removable_options[:column_name]].not_eq(nil).to_sql)
|
22
24
|
}
|
23
25
|
|
24
|
-
scope :actives,
|
26
|
+
scope :actives, lambda {
|
25
27
|
where(all.table[_acts_as_removable_options[:column_name]].eq(nil).to_sql)
|
26
28
|
}
|
27
29
|
|
@@ -68,7 +70,13 @@ module ActsAsRemovable
|
|
68
70
|
self.class.transaction do
|
69
71
|
run_callbacks callback.to_sym do
|
70
72
|
send("#{self.class._acts_as_removable_options[:column_name]}=", value)
|
71
|
-
|
73
|
+
|
74
|
+
# workaround for new argument handling
|
75
|
+
if RUBY_VERSION.to_i < 3
|
76
|
+
with_bang ? save!(options) : save(options)
|
77
|
+
else
|
78
|
+
with_bang ? save!(**options) : save(**options)
|
79
|
+
end
|
72
80
|
end
|
73
81
|
end
|
74
82
|
end
|
@@ -76,9 +84,7 @@ module ActsAsRemovable
|
|
76
84
|
end
|
77
85
|
|
78
86
|
def _acts_as_removable_options
|
79
|
-
@_acts_as_removable_options ||= {
|
80
|
-
column_name: 'removed_at'
|
81
|
-
}
|
87
|
+
@_acts_as_removable_options ||= { column_name: 'removed_at' }
|
82
88
|
end
|
83
89
|
end
|
84
90
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe 'acts_as_removable' do
|
@@ -26,10 +28,10 @@ describe 'acts_as_removable' do
|
|
26
28
|
before do
|
27
29
|
# setup database
|
28
30
|
db_file = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'acts_as_removable.db'))
|
29
|
-
Dir
|
31
|
+
Dir.mkdir(File.dirname(db_file)) unless File.exist?(File.dirname(db_file))
|
30
32
|
ActiveRecord::Base.establish_connection(
|
31
|
-
:
|
32
|
-
:
|
33
|
+
adapter: 'sqlite3',
|
34
|
+
database: "#{File.expand_path(File.join(File.dirname(__FILE__), '..'))}/tmp/acts_as_removable.db"
|
33
35
|
)
|
34
36
|
ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS 'my_models'")
|
35
37
|
ActiveRecord::Base.connection.create_table(:my_models) do |t|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_removable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Schwab
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -18,9 +18,9 @@ dependencies:
|
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '5.0'
|
21
|
-
- - "
|
21
|
+
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '7.1'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -28,9 +28,9 @@ dependencies:
|
|
28
28
|
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '5.0'
|
31
|
-
- - "
|
31
|
+
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '7.1'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: activesupport
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,9 +38,9 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.0'
|
41
|
-
- - "
|
41
|
+
- - "<"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
43
|
+
version: '7.1'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -48,23 +48,23 @@ dependencies:
|
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '5.0'
|
51
|
-
- - "
|
51
|
+
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '7.1'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: bundler
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '2.0'
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '2.0'
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
69
|
name: rake
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,6 +93,34 @@ dependencies:
|
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rubocop
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rubocop-performance
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
type: :development
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
96
124
|
- !ruby/object:Gem::Dependency
|
97
125
|
name: sqlite3
|
98
126
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,23 +137,25 @@ dependencies:
|
|
109
137
|
version: '0'
|
110
138
|
description: Simplifies handling of pseudo removed records.
|
111
139
|
email:
|
112
|
-
- florian.schwab@sic
|
140
|
+
- florian.schwab@sic.software
|
141
|
+
- erik.ernst@sic.software
|
113
142
|
executables: []
|
114
143
|
extensions: []
|
115
144
|
extra_rdoc_files: []
|
116
145
|
files:
|
146
|
+
- ".github/workflows/workflow.yml"
|
117
147
|
- ".gitignore"
|
118
|
-
- ".
|
148
|
+
- ".rubocop.yml"
|
119
149
|
- Changelog.md
|
120
150
|
- Gemfile
|
121
151
|
- LICENSE
|
122
152
|
- README.md
|
123
153
|
- Rakefile
|
124
154
|
- acts_as_removable.gemspec
|
125
|
-
- gemfiles/
|
126
|
-
- gemfiles/
|
127
|
-
- gemfiles/
|
128
|
-
- gemfiles/
|
155
|
+
- gemfiles/rails52
|
156
|
+
- gemfiles/rails60
|
157
|
+
- gemfiles/rails61
|
158
|
+
- gemfiles/rails70
|
129
159
|
- lib/acts_as_removable.rb
|
130
160
|
- lib/acts_as_removable/version.rb
|
131
161
|
- spec/acts_as_removable_spec.rb
|
@@ -142,14 +172,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
172
|
requirements:
|
143
173
|
- - ">="
|
144
174
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
175
|
+
version: 2.6.0
|
146
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
177
|
requirements:
|
148
178
|
- - ">="
|
149
179
|
- !ruby/object:Gem::Version
|
150
180
|
version: '0'
|
151
181
|
requirements: []
|
152
|
-
rubygems_version: 3.
|
182
|
+
rubygems_version: 3.2.32
|
153
183
|
signing_key:
|
154
184
|
specification_version: 4
|
155
185
|
summary: Simplifies handling of pseudo removed records.
|
data/.travis.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
|
3
|
-
language: ruby
|
4
|
-
|
5
|
-
rvm:
|
6
|
-
- 2.2.5
|
7
|
-
- 2.3.1
|
8
|
-
|
9
|
-
gemfile:
|
10
|
-
- gemfiles/rails40
|
11
|
-
- gemfiles/rails41
|
12
|
-
- gemfiles/rails42
|
13
|
-
- gemfiles/rails50
|
14
|
-
|
15
|
-
script: bundle exec rake spec
|
16
|
-
|
17
|
-
before_install:
|
18
|
-
- gem install bundler -v '~> 1.12'
|