operator_recordable 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.travis.yml +12 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +131 -0
- data/Rakefile +8 -0
- data/bin/console +8 -0
- data/bin/setup +8 -0
- data/gemfiles/activerecord_5.0.gemfile +7 -0
- data/gemfiles/activerecord_5.1.gemfile +7 -0
- data/gemfiles/activerecord_5.2.gemfile +7 -0
- data/lib/operator_recordable.rb +29 -0
- data/lib/operator_recordable/configuration.rb +74 -0
- data/lib/operator_recordable/recorder.rb +120 -0
- data/lib/operator_recordable/store.rb +22 -0
- data/lib/operator_recordable/store/current_attributes_store.rb +30 -0
- data/lib/operator_recordable/store/request_store.rb +15 -0
- data/lib/operator_recordable/store/thread_store.rb +15 -0
- data/lib/operator_recordable/version.rb +5 -0
- data/operator_recordable.gemspec +34 -0
- metadata +168 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fdc77dbb80f781c9560906bfcf32c555861a1dca7939261c0380db0e86d9b635
|
4
|
+
data.tar.gz: 7142047e67d09890a16e959a81c0c0e7f5ab2fd33077f32832b8dba4be9ca514
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5e83aaeec3864a96e51cf4dc05298a6a585c524fe67e34fb80953b7dc13902e384fe8b225435851c5d22bb0b84b6cf4f335df4845b92b818194f9e958f51432a
|
7
|
+
data.tar.gz: ada73774a5ca90f7d77cfaf735ede38e111249a4698e5d624a6fd1a94edd840a6ae5f39d88fb200c016204551ecf9aec3e2f8f2c126f4d8b2c5e2742fba9d62f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Yuji Hanamura
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
# OperatorRecordable
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/yujideveloper/operator_recordable.svg?branch=master)](https://travis-ci.org/yujideveloper/operator_recordable)
|
4
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/aaa0fcd567da9232a847/maintainability)](https://codeclimate.com/github/yujideveloper/operator_recordable/maintainability)
|
5
|
+
|
6
|
+
OperatorRecordable is a Rails plugin gem that makes your ActiveRecord models to be saved or logically deleted with automatically set `created_by`, `updated_by`, and `deleted_by`.
|
7
|
+
Also it makes `creator`, `updater`, and `deleter` `belongs_to` association if a class has `created_by`, `updated_by`, or `deleted_by`.
|
8
|
+
|
9
|
+
This gem is inspired by [RecordWithOperator](https://github.com/nay/record_with_operator).
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'operator_recordable'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install operator_recordable
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
### Configuration
|
30
|
+
|
31
|
+
#### Initialize `OperatorRecordable`
|
32
|
+
|
33
|
+
``` ruby
|
34
|
+
# config/initializers/operator_recordable.rb
|
35
|
+
OperatorRecordable.config = {
|
36
|
+
operator_class_name: "Operator",
|
37
|
+
creator_column_name: "created_by",
|
38
|
+
updater_column_name: "updated_by",
|
39
|
+
deleter_column_name: "deleted_by",
|
40
|
+
operator_association_options: {},
|
41
|
+
operator_association_scope: nil,
|
42
|
+
store: :thread_store
|
43
|
+
}
|
44
|
+
```
|
45
|
+
|
46
|
+
##### Options
|
47
|
+
|
48
|
+
| Name | Type | Description | Default |
|
49
|
+
|:-----|:-----|:------------|:--------|
|
50
|
+
| `operator_class_name` | String | class name of your operator model. | `"Operator"` |
|
51
|
+
| `creator_column_name` | String | column name of creator. | `"created_by"` |
|
52
|
+
| `updater_column_name` | String | column name of updater. | `"updated_by"` |
|
53
|
+
| `deleter_column_name` | String | column name of deleter. | `"deleted_by"` |
|
54
|
+
| `operator_association_options` | Hash | options of operator associations. e.g. `{ optional: true }` | `{}` |
|
55
|
+
| `operator_association_scope` | Proc | The scope of operator associations. e.g. `-> { with_deleted }` | `nil` |
|
56
|
+
| `store` | Enum | operator store. any value of `:thread_store`, `:request_store` or `current_attributes_store` | `:thread_store` |
|
57
|
+
|
58
|
+
#### Include `OperatorRecordable` in your model
|
59
|
+
|
60
|
+
``` ruby
|
61
|
+
class ApplicationRecord < ActiveRecord::Base
|
62
|
+
self.abstract_class = true
|
63
|
+
|
64
|
+
include OperatorRecordable
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
#### Activate `OperatorRecordable` in your model
|
69
|
+
|
70
|
+
You can specify which action you want to save operator like this.
|
71
|
+
``` ruby
|
72
|
+
class Post < ApplicationRecord
|
73
|
+
record_operator_on :create, :update, :destroy
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
77
|
+
OperatorRecordable needs to know who is currently operating. For that, you need to set operator through a following way in a `before_action` callback, etc.
|
78
|
+
``` ruby
|
79
|
+
OperatorRecordable.operator = current_operator
|
80
|
+
```
|
81
|
+
|
82
|
+
### Stores
|
83
|
+
|
84
|
+
#### `:thread_store`
|
85
|
+
|
86
|
+
This store is implemented by `Thread.current`.
|
87
|
+
This is default store.
|
88
|
+
|
89
|
+
|
90
|
+
#### `:request_store`
|
91
|
+
|
92
|
+
This store is implemented by using [RequestStore gem](https://github.com/steveklabnik/request_store).
|
93
|
+
So, this requires RequestStore gem.
|
94
|
+
|
95
|
+
RequestStore must be required before OperatorRecordable.
|
96
|
+
|
97
|
+
``` ruby
|
98
|
+
gem "request_store"
|
99
|
+
gem "operator_recordable"
|
100
|
+
```
|
101
|
+
Or
|
102
|
+
|
103
|
+
``` ruby
|
104
|
+
require "request_store"
|
105
|
+
require "operator_recordable"
|
106
|
+
```
|
107
|
+
|
108
|
+
Otherwise, you need to require it yourself.
|
109
|
+
``` ruby
|
110
|
+
require "operator_recordable/store/request_store"
|
111
|
+
```
|
112
|
+
|
113
|
+
#### `:current_attributes_store`
|
114
|
+
|
115
|
+
This store is implemented by using [`ActiveSupport::CurrentAttributes`](https://api.rubyonrails.org/v5.2.0/classes/ActiveSupport/CurrentAttributes.html).
|
116
|
+
So, this requires ActivgeSupport 5.2 or later.
|
117
|
+
|
118
|
+
|
119
|
+
## Development
|
120
|
+
|
121
|
+
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.
|
122
|
+
|
123
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
124
|
+
|
125
|
+
## Contributing
|
126
|
+
|
127
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/yujideveloper/operator_recordable.
|
128
|
+
|
129
|
+
## License
|
130
|
+
|
131
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "operator_recordable/version"
|
4
|
+
require "operator_recordable/configuration"
|
5
|
+
require "operator_recordable/store"
|
6
|
+
require "operator_recordable/recorder"
|
7
|
+
|
8
|
+
module OperatorRecordable
|
9
|
+
def self.config
|
10
|
+
self.config = {} unless instance_variable_defined? :@config
|
11
|
+
@config
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.config=(config)
|
15
|
+
@config = Configuration.new(config)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.operator
|
19
|
+
config.store[Store.operator_store_key]
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.operator=(operator)
|
23
|
+
config.store[Store.operator_store_key] = operator
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.included(class_or_module)
|
27
|
+
class_or_module.extend Recorder.new(config)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "operator_recordable/store"
|
4
|
+
|
5
|
+
module OperatorRecordable
|
6
|
+
class Configuration
|
7
|
+
attr_reader :store
|
8
|
+
|
9
|
+
def initialize(config)
|
10
|
+
@config = initialize_config(config)
|
11
|
+
initialize_store
|
12
|
+
end
|
13
|
+
|
14
|
+
%i[operator_class_name creator_column_name updater_column_name deleter_column_name
|
15
|
+
operator_association_options operator_association_scope].each do |name|
|
16
|
+
define_method name do
|
17
|
+
config[name]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :config
|
24
|
+
|
25
|
+
def initialize_config(config)
|
26
|
+
{
|
27
|
+
operator_class_name: "Operator",
|
28
|
+
creator_column_name: "created_by",
|
29
|
+
updater_column_name: "updated_by",
|
30
|
+
deleter_column_name: "deleted_by",
|
31
|
+
operator_association_options: {},
|
32
|
+
operator_association_scope: nil,
|
33
|
+
store: :thread_store
|
34
|
+
}.merge!(config || {}).freeze
|
35
|
+
end
|
36
|
+
|
37
|
+
def initialize_store
|
38
|
+
args = [*config[:store]]
|
39
|
+
name = args.shift
|
40
|
+
@store = Store.fetch_class(name).new(*args)
|
41
|
+
end
|
42
|
+
|
43
|
+
class Model
|
44
|
+
VALID_ACTIONS = %i[create update destroy].freeze
|
45
|
+
|
46
|
+
def initialize(actions)
|
47
|
+
@actions = actions
|
48
|
+
assert_actions
|
49
|
+
end
|
50
|
+
|
51
|
+
def record_creator?
|
52
|
+
actions.include? :create
|
53
|
+
end
|
54
|
+
|
55
|
+
def record_updater?
|
56
|
+
actions.include? :update
|
57
|
+
end
|
58
|
+
|
59
|
+
def record_deleter?
|
60
|
+
actions.include? :destroy
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
attr_reader :actions
|
66
|
+
|
67
|
+
def assert_actions
|
68
|
+
return if actions.all?(&VALID_ACTIONS.method(:include?))
|
69
|
+
|
70
|
+
raise ArgumentError, "valid actions are #{VALID_ACTIONS.inspect}."
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "operator_recordable/configuration"
|
4
|
+
|
5
|
+
module OperatorRecordable
|
6
|
+
class Recorder < ::Module
|
7
|
+
def initialize(config)
|
8
|
+
define_activate_method(config)
|
9
|
+
define_predicate_methods
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def define_activate_method(config)
|
15
|
+
m = self
|
16
|
+
|
17
|
+
define_method :record_operator_on do |*actions|
|
18
|
+
@_record_operator_on = Configuration::Model.new(actions)
|
19
|
+
|
20
|
+
if record_creator?
|
21
|
+
m.__send__(:run_creator_dsl, self, config)
|
22
|
+
m.__send__(:define_creator_instance_methods, self, config)
|
23
|
+
end
|
24
|
+
|
25
|
+
if record_updater?
|
26
|
+
m.__send__(:run_updater_dsl, self, config)
|
27
|
+
m.__send__(:define_updater_instance_methods, self, config)
|
28
|
+
end
|
29
|
+
|
30
|
+
if record_deleter?
|
31
|
+
m.__send__(:run_deleter_dsl, self, config)
|
32
|
+
m.__send__(:define_deleter_instance_methods, self, config)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def run_creator_dsl(class_or_module, config)
|
38
|
+
class_or_module.class_exec do
|
39
|
+
before_create :assign_creator
|
40
|
+
belongs_to :creator, config.operator_association_scope,
|
41
|
+
{ foreign_key: config.creator_column_name,
|
42
|
+
class_name: config.operator_class_name }.merge(config.operator_association_options)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def run_updater_dsl(class_or_module, config)
|
47
|
+
class_or_module.class_exec do
|
48
|
+
before_save :assign_updater
|
49
|
+
belongs_to :updater, config.operator_association_scope,
|
50
|
+
{ foreign_key: config.updater_column_name,
|
51
|
+
class_name: config.operator_class_name }.merge(config.operator_association_options)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def run_deleter_dsl(class_or_module, config)
|
56
|
+
class_or_module.class_exec do
|
57
|
+
before_destroy :assign_deleter
|
58
|
+
belongs_to :deleter, config.operator_association_scope,
|
59
|
+
{ foreign_key: config.deleter_column_name,
|
60
|
+
class_name: config.operator_class_name }.merge(config.operator_association_options)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def define_creator_instance_methods(class_or_module, config)
|
65
|
+
class_or_module.class_eval <<~END_OF_DEF, __FILE__, __LINE__ + 1
|
66
|
+
private def assign_creator
|
67
|
+
return unless (op = OperatorRecordable.operator)
|
68
|
+
|
69
|
+
self.#{config.creator_column_name} = op.id
|
70
|
+
end
|
71
|
+
END_OF_DEF
|
72
|
+
end
|
73
|
+
|
74
|
+
def define_updater_instance_methods(class_or_module, config)
|
75
|
+
class_or_module.class_eval <<~END_OF_DEF, __FILE__, __LINE__ + 1
|
76
|
+
private def assign_updater
|
77
|
+
return if !self.new_record? && !self.changed?
|
78
|
+
return unless (op = OperatorRecordable.operator)
|
79
|
+
|
80
|
+
self.#{config.updater_column_name} = op.id
|
81
|
+
end
|
82
|
+
END_OF_DEF
|
83
|
+
end
|
84
|
+
|
85
|
+
def define_deleter_instance_methods(class_or_module, config)
|
86
|
+
class_or_module.class_eval <<~END_OF_DEF, __FILE__, __LINE__ + 1
|
87
|
+
private def assign_deleter
|
88
|
+
return if self.frozen?
|
89
|
+
return unless (op = OperatorRecordable.operator)
|
90
|
+
|
91
|
+
self
|
92
|
+
.class
|
93
|
+
.where(self.class.primary_key => id)
|
94
|
+
.update_all('#{config.deleter_column_name}' => op.id)
|
95
|
+
self.#{config.deleter_column_name} = op.id
|
96
|
+
end
|
97
|
+
END_OF_DEF
|
98
|
+
end
|
99
|
+
|
100
|
+
def define_predicate_methods
|
101
|
+
define_method :record_creator? do
|
102
|
+
instance_variable_defined?(:@_record_operator_on) &&
|
103
|
+
@_record_operator_on.record_creator?
|
104
|
+
end
|
105
|
+
private :record_creator?
|
106
|
+
|
107
|
+
define_method :record_updater? do
|
108
|
+
instance_variable_defined?(:@_record_operator_on) &&
|
109
|
+
@_record_operator_on.record_updater?
|
110
|
+
end
|
111
|
+
private :record_updater?
|
112
|
+
|
113
|
+
define_method :record_deleter? do
|
114
|
+
instance_variable_defined?(:@_record_operator_on) &&
|
115
|
+
@_record_operator_on.record_deleter?
|
116
|
+
end
|
117
|
+
private :record_deleter?
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OperatorRecordable
|
4
|
+
class Store
|
5
|
+
def self.operator_store_key
|
6
|
+
:operator_recordable_operator
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.register(name, klass)
|
10
|
+
@stores ||= {}
|
11
|
+
@stores[name] = klass
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.fetch_class(name)
|
15
|
+
@stores.fetch(name)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
require "operator_recordable/store/thread_store"
|
21
|
+
require "operator_recordable/store/request_store" if defined? ::RequestStore
|
22
|
+
require "operator_recordable/store/current_attributes_store" if defined? ::ActiveSupport::CurrentAttributes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OperatorRecordable
|
4
|
+
class CurrentAttributesStore
|
5
|
+
class Current < ::ActiveSupport::CurrentAttributes
|
6
|
+
attribute :store
|
7
|
+
|
8
|
+
def [](key)
|
9
|
+
return nil unless self.store
|
10
|
+
|
11
|
+
self.store[key]
|
12
|
+
end
|
13
|
+
|
14
|
+
def []=(key, value)
|
15
|
+
self.store ||= {}
|
16
|
+
self.store[key] = value
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def [](key)
|
21
|
+
Current[key]
|
22
|
+
end
|
23
|
+
|
24
|
+
def []=(key, value)
|
25
|
+
Current[key] = value
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
Store.register(:current_attributes_store, CurrentAttributesStore)
|
30
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OperatorRecordable
|
4
|
+
class RequestStore
|
5
|
+
def [](key)
|
6
|
+
::RequestStore.store[key]
|
7
|
+
end
|
8
|
+
|
9
|
+
def []=(key, value)
|
10
|
+
::RequestStore.store[key] = value
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Store.register(:request_store, RequestStore)
|
15
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "operator_recordable/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "operator_recordable"
|
9
|
+
spec.version = OperatorRecordable::VERSION
|
10
|
+
spec.authors = ["Yuji Hanamura"]
|
11
|
+
spec.email = ["yuji.developer@gmail.com"]
|
12
|
+
|
13
|
+
spec.summary = "OperatorRecordable is a Rails plugin to set created_by, updated_by, and deleted_by to ActiveRecord objects."
|
14
|
+
spec.description = "OperatorRecordable is a Rails plugin that makes your ActiveRecord models to be saved or logically deleted with automatically set created_by, updated_by, and deleted_by. Also it makes creator, updater, deleter belongs_to association if a class has created_by, updated_by, or deleted_by."
|
15
|
+
spec.homepage = "https://github.com/yujideveloper/operator_recordable"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
+
spec.files = Dir.chdir(__dir__) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.bindir = "exe"
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
spec.add_dependency "activerecord", "~> 5.0"
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
29
|
+
spec.add_development_dependency "pry", ">= 0.10.0"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "request_store"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.7"
|
33
|
+
spec.add_development_dependency "sqlite3", "~> 1.0"
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: operator_recordable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuji Hanamura
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-09-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.10.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.10.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: request_store
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.7'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.7'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: sqlite3
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
111
|
+
description: OperatorRecordable is a Rails plugin that makes your ActiveRecord models
|
112
|
+
to be saved or logically deleted with automatically set created_by, updated_by,
|
113
|
+
and deleted_by. Also it makes creator, updater, deleter belongs_to association if
|
114
|
+
a class has created_by, updated_by, or deleted_by.
|
115
|
+
email:
|
116
|
+
- yuji.developer@gmail.com
|
117
|
+
executables: []
|
118
|
+
extensions: []
|
119
|
+
extra_rdoc_files: []
|
120
|
+
files:
|
121
|
+
- ".gitignore"
|
122
|
+
- ".rspec"
|
123
|
+
- ".travis.yml"
|
124
|
+
- CHANGELOG.md
|
125
|
+
- Gemfile
|
126
|
+
- LICENSE.txt
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- bin/console
|
130
|
+
- bin/setup
|
131
|
+
- gemfiles/activerecord_5.0.gemfile
|
132
|
+
- gemfiles/activerecord_5.1.gemfile
|
133
|
+
- gemfiles/activerecord_5.2.gemfile
|
134
|
+
- lib/operator_recordable.rb
|
135
|
+
- lib/operator_recordable/configuration.rb
|
136
|
+
- lib/operator_recordable/recorder.rb
|
137
|
+
- lib/operator_recordable/store.rb
|
138
|
+
- lib/operator_recordable/store/current_attributes_store.rb
|
139
|
+
- lib/operator_recordable/store/request_store.rb
|
140
|
+
- lib/operator_recordable/store/thread_store.rb
|
141
|
+
- lib/operator_recordable/version.rb
|
142
|
+
- operator_recordable.gemspec
|
143
|
+
homepage: https://github.com/yujideveloper/operator_recordable
|
144
|
+
licenses:
|
145
|
+
- MIT
|
146
|
+
metadata: {}
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 2.7.6
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: OperatorRecordable is a Rails plugin to set created_by, updated_by, and deleted_by
|
167
|
+
to ActiveRecord objects.
|
168
|
+
test_files: []
|