operator_recordable 1.4.0 → 2.0.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: 17d5261fe9e0dde7d722753e707a2a5210bc183866be7d9509b6670e2187e432
4
- data.tar.gz: 7c569a64a127e3b293ac7d5ed66ba0762774163ef7395d16acd49bd7e30bba85
3
+ metadata.gz: 313756319e4b168ea81a2781e3fe8827fe7ad7c47392d1467caf9bbacc4e481f
4
+ data.tar.gz: afc26539434ef49d7516955ebf278bfa7e7929247f3eb23f2662932eb32b0047
5
5
  SHA512:
6
- metadata.gz: 6e5d5deec10df7399288037211bf9de8d53ec2b21b4763818e74759de35e84704ee8857945d2afc603fe156aa9bdd541f364e74d871643665dc96adaa8cb8cae
7
- data.tar.gz: 6d9ea5667096bd04be4705fc97fe0beccd34aa5d37b1925ede9c7868bd6558a1812db6b798ce1b871505b7461b954fee356bd9cc810a42d2e05ffac3385002ad
6
+ metadata.gz: ad44e97fa9df294202c37e709f9bdb0935096d5948d97b8722998b19372413136f181988c9fa0796abab1a81ba73e9a7face67b233376cf4def5a92f4c03b882
7
+ data.tar.gz: 84a9728733758c2afa4788821f0767855605ba56b4648cdb8220c9e4d674840dc861d675c9aff4226208b7db7a0072b8c5d78641b21b32f8815a9671ca02c942
@@ -14,60 +14,10 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  strategy:
16
16
  matrix:
17
- ruby: ['2.5', '2.6', '2.7', '3.0', '3.1']
18
- activerecord: ['5.2', '6.0', '6.1', '7.0']
17
+ ruby: ['2.7', '3.0', '3.1']
18
+ activerecord: ['6.0', '6.1', '7.0']
19
19
  plugin: ['', '_with_request_store']
20
20
  experimental: [false]
21
- exclude:
22
- - ruby: '2.5'
23
- activerecord: '7.0'
24
- plugin: ''
25
- experimental: false
26
- - ruby: '2.5'
27
- activerecord: '7.0'
28
- plugin: '_with_request_store'
29
- experimental: false
30
- - ruby: '2.6'
31
- activerecord: '7.0'
32
- plugin: ''
33
- experimental: false
34
- - ruby: '2.6'
35
- activerecord: '7.0'
36
- plugin: '_with_request_store'
37
- experimental: false
38
- - ruby: '2.7'
39
- activerecord: '5.2'
40
- plugin: ''
41
- experimental: false
42
- - ruby: '2.7'
43
- activerecord: '5.2'
44
- plugin: '_with_request_store'
45
- experimental: false
46
- - ruby: '3.0'
47
- activerecord: '5.2'
48
- plugin: ''
49
- experimental: false
50
- - ruby: '3.0'
51
- activerecord: '5.2'
52
- plugin: '_with_request_store'
53
- experimental: false
54
- - ruby: '3.1'
55
- activerecord: '5.2'
56
- plugin: ''
57
- experimental: false
58
- - ruby: '3.1'
59
- activerecord: '5.2'
60
- plugin: '_with_request_store'
61
- experimental: false
62
- include:
63
- - ruby: '2.7'
64
- activerecord: '5.2'
65
- plugin: ''
66
- experimental: true
67
- - ruby: '2.7'
68
- activerecord: '5.2'
69
- plugin: '_with_request_store'
70
- experimental: true
71
21
  continue-on-error: ${{ matrix.experimental }}
72
22
  env:
73
23
  APPRAISAL: activerecord_${{ matrix.activerecord }}${{ matrix.plugin }}
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  AllCops:
2
2
  Exclude:
3
3
  - gemfiles/**/*
4
- TargetRubyVersion: 2.5
4
+ TargetRubyVersion: 2.7
5
5
  NewCops: enable
6
6
 
7
7
  Style/AsciiComments:
data/Appraisals CHANGED
@@ -1,43 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise "activerecord_5.2" do
4
- gem "activerecord", "~> 5.2.0"
5
- end
6
-
7
- appraise "activerecord_5.2_with_request_store" do
8
- gem "activerecord", "~> 5.2.0"
9
- gem "request_store"
10
- end
11
-
12
3
  appraise "activerecord_6.0" do
13
4
  gem "activerecord", "~> 6.0.0"
14
- gem "sqlite3", "~> 1.4"
15
5
  end
16
6
 
17
7
  appraise "activerecord_6.0_with_request_store" do
18
8
  gem "activerecord", "~> 6.0.0"
19
9
  gem "request_store"
20
- gem "sqlite3", "~> 1.4"
21
10
  end
22
11
 
23
12
  appraise "activerecord_6.1" do
24
13
  gem "activerecord", "~> 6.1.0"
25
- gem "sqlite3", "~> 1.4"
26
14
  end
27
15
 
28
16
  appraise "activerecord_6.1_with_request_store" do
29
17
  gem "activerecord", "~> 6.1.0"
30
18
  gem "request_store"
31
- gem "sqlite3", "~> 1.4"
32
19
  end
33
20
 
34
21
  appraise "activerecord_7.0" do
35
22
  gem "activerecord", "~> 7.0.1"
36
- gem "sqlite3", "~> 1.4"
37
23
  end
38
24
 
39
25
  appraise "activerecord_7.0_with_request_store" do
40
26
  gem "activerecord", "~> 7.0.1"
41
27
  gem "request_store"
42
- gem "sqlite3", "~> 1.4"
43
28
  end
data/CHANGELOG.md CHANGED
@@ -1,6 +1,25 @@
1
1
  ## Unreleased
2
2
 
3
3
 
4
+ ## 2.0.0 (2022-08-27)
5
+
6
+ ### Breaking changes
7
+
8
+ * Remove `:thread_store` and change the default store to `:current_attributes_store`
9
+ + [PR#37](https://github.com/yujideveloper/operator_recordable/pull/37)
10
+
11
+ ### Misc
12
+
13
+ * Test with paranoia gem
14
+ + [PR#38](https://github.com/yujideveloper/operator_recordable/pull/38)
15
+ * Add code of conduct
16
+ + [PR#39](https://github.com/yujideveloper/operator_recordable/pull/39)
17
+ * Drop Ruby 2.5 and 2.6 support
18
+ + [PR#40](https://github.com/yujideveloper/operator_recordable/pull/40)
19
+ * Drop ActiveRecord 5.2 support
20
+ + [PR#40](https://github.com/yujideveloper/operator_recordable/pull/40)
21
+
22
+
4
23
  ## 1.4.0 (2022-08-18)
5
24
 
6
25
  ### Changes
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ yuji.developer@gmail.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
data/README.md CHANGED
@@ -66,7 +66,7 @@ OperatorRecordable.config = {
66
66
  | `discarder_association_name` | String | association name of discarder. | `"discarder"` |
67
67
  | `operator_association_options` | Hash | options of operator associations. e.g. `{ touch: true }` | `{}` |
68
68
  | `operator_association_scope` | Proc | The scope of operator associations. e.g. `-> { with_deleted }` | `nil` |
69
- | `store` | Enum | operator store. any value of `:thread_store`, `:request_store` or `:current_attributes_store` | `:thread_store` |
69
+ | `store` | Enum | operator store. any value of `:current_attributes_store` or `:request_store` | `:current_attributes_store` |
70
70
 
71
71
  #### Include `OperatorRecordable` in your model
72
72
 
@@ -94,11 +94,10 @@ OperatorRecordable.operator = current_operator
94
94
 
95
95
  ### Stores
96
96
 
97
- #### `:thread_store`
98
-
99
- This store is implemented by `Thread.current`.
100
- This is default store. **But this is deprecated and will be removed in v2.0. Please consider using `:current_attributes_store` instead.**
97
+ #### `:current_attributes_store`
101
98
 
99
+ This store is implemented by using [`ActiveSupport::CurrentAttributes`](https://api.rubyonrails.org/v5.2.0/classes/ActiveSupport/CurrentAttributes.html).
100
+ This is the default store.
102
101
 
103
102
  #### `:request_store`
104
103
 
@@ -123,11 +122,6 @@ Otherwise, you need to load it yourself.
123
122
  require "operator_recordable/store/request_store"
124
123
  ```
125
124
 
126
- #### `:current_attributes_store`
127
-
128
- This store is implemented by using [`ActiveSupport::CurrentAttributes`](https://api.rubyonrails.org/v5.2.0/classes/ActiveSupport/CurrentAttributes.html).
129
-
130
-
131
125
  ## Development
132
126
 
133
127
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -3,6 +3,5 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 6.0.0"
6
- gem "sqlite3", "~> 1.4"
7
6
 
8
7
  gemspec path: "../"
@@ -4,6 +4,5 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 6.0.0"
6
6
  gem "request_store"
7
- gem "sqlite3", "~> 1.4"
8
7
 
9
8
  gemspec path: "../"
@@ -3,6 +3,5 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 6.1.0"
6
- gem "sqlite3", "~> 1.4"
7
6
 
8
7
  gemspec path: "../"
@@ -4,6 +4,5 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 6.1.0"
6
6
  gem "request_store"
7
- gem "sqlite3", "~> 1.4"
8
7
 
9
8
  gemspec path: "../"
@@ -3,6 +3,5 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 7.0.1"
6
- gem "sqlite3", "~> 1.4"
7
6
 
8
7
  gemspec path: "../"
@@ -4,6 +4,5 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 7.0.1"
6
6
  gem "request_store"
7
- gem "sqlite3", "~> 1.4"
8
7
 
9
8
  gemspec path: "../"
@@ -44,7 +44,7 @@ module OperatorRecordable
44
44
  discarder_association_name: "discarder",
45
45
  operator_association_options: {},
46
46
  operator_association_scope: nil,
47
- store: :thread_store
47
+ store: :current_attributes_store
48
48
  }.merge!(config || {}).freeze
49
49
  end
50
50
 
@@ -13,6 +13,5 @@ module OperatorRecordable
13
13
  end
14
14
  end
15
15
 
16
- require "operator_recordable/store/thread_store"
17
- require "operator_recordable/store/request_store" if defined? ::RequestStore
18
16
  require "operator_recordable/store/current_attributes_store"
17
+ require "operator_recordable/store/request_store" if defined? ::RequestStore
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OperatorRecordable
4
- VERSION = "1.4.0"
4
+ VERSION = "2.0.0"
5
5
  end
@@ -41,15 +41,16 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
41
41
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
42
42
  spec.require_paths = ["lib"]
43
43
 
44
- spec.required_ruby_version = ">= 2.5"
44
+ spec.required_ruby_version = ">= 2.7"
45
45
 
46
- spec.add_dependency "activerecord", ">= 5.2"
46
+ spec.add_dependency "activerecord", ">= 6.0"
47
47
  spec.add_development_dependency "appraisal", ">= 2.3.0"
48
48
  spec.add_development_dependency "bundler", ">= 1.16"
49
49
  spec.add_development_dependency "discard", ">= 1.2"
50
+ spec.add_development_dependency "paranoia", ">= 2.6.0"
50
51
  spec.add_development_dependency "pry", ">= 0.10.0"
51
52
  spec.add_development_dependency "rake", ">= 10.0"
52
53
  spec.add_development_dependency "rspec", "~> 3.7"
53
54
  spec.add_development_dependency "rubocop", ">= 1.13.0"
54
- spec.add_development_dependency "sqlite3", ">= 1.3.13"
55
+ spec.add_development_dependency "sqlite3", ">= 1.4"
55
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: operator_recordable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Hanamura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-18 00:00:00.000000000 Z
11
+ date: 2022-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '6.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5.2'
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: appraisal
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: paranoia
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 2.6.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 2.6.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: pry
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +142,14 @@ dependencies:
128
142
  requirements:
129
143
  - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: 1.3.13
145
+ version: '1.4'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: 1.3.13
152
+ version: '1.4'
139
153
  description: 'OperatorRecordable is a Rails plugin that makes your ActiveRecord models
140
154
  to be saved or logically deleted with automatically set created_by, updated_by,
141
155
  and deleted_by. Also it makes creator, updater, deleter belongs_to association if
@@ -152,14 +166,13 @@ files:
152
166
  - ".rubocop.yml"
153
167
  - Appraisals
154
168
  - CHANGELOG.md
169
+ - CODE_OF_CONDUCT.md
155
170
  - Gemfile
156
171
  - LICENSE.txt
157
172
  - README.md
158
173
  - Rakefile
159
174
  - bin/console
160
175
  - bin/setup
161
- - gemfiles/activerecord_5.2.gemfile
162
- - gemfiles/activerecord_5.2_with_request_store.gemfile
163
176
  - gemfiles/activerecord_6.0.gemfile
164
177
  - gemfiles/activerecord_6.0_with_request_store.gemfile
165
178
  - gemfiles/activerecord_6.1.gemfile
@@ -173,7 +186,6 @@ files:
173
186
  - lib/operator_recordable/store.rb
174
187
  - lib/operator_recordable/store/current_attributes_store.rb
175
188
  - lib/operator_recordable/store/request_store.rb
176
- - lib/operator_recordable/store/thread_store.rb
177
189
  - lib/operator_recordable/version.rb
178
190
  - operator_recordable.gemspec
179
191
  homepage: https://github.com/yujideveloper/operator_recordable
@@ -193,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
205
  requirements:
194
206
  - - ">="
195
207
  - !ruby/object:Gem::Version
196
- version: '2.5'
208
+ version: '2.7'
197
209
  required_rubygems_version: !ruby/object:Gem::Requirement
198
210
  requirements:
199
211
  - - ">="
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 5.2.0"
6
-
7
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 5.2.0"
6
- gem "request_store"
7
-
8
- gemspec path: "../"
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module OperatorRecordable
4
- class ThreadStore
5
- def initialize
6
- warn "DEPRECATION WARNING: `:thread_store` is deprecated. It will be removed in v2.0"
7
- end
8
-
9
- def [](key)
10
- ::Thread.current[key]
11
- end
12
-
13
- def []=(key, value)
14
- ::Thread.current[key] = value
15
- end
16
- end
17
-
18
- Store.register(:thread_store, ThreadStore)
19
- end