rails_log_book 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/lib/generators/log_book/templates/initializer.rb +1 -1
- data/lib/log_book/configuration.rb +1 -1
- data/lib/log_book/railtie.rb +8 -0
- data/lib/log_book/tree.rb +7 -1
- data/lib/log_book/version.rb +1 -1
- data/lib/rails_log_book.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40ac50af4671708098c57282c0a2bfd6af146bc41a2511fdb712669b30642e8d
|
4
|
+
data.tar.gz: 8fa4ae7b220b1c52146e011f999e95e5b8a781dbf45e6db6aaa785503a8eadda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09543149f1dc7cf81a78e1450f0840bdfce3e796c0c68f467d66e9e845251d97ad43c58766ff900717da6329e37a3faff8c50322e05b0be73d68e0c8353bd3f6'
|
7
|
+
data.tar.gz: 8f2620cd3a9ed80bac438d85d000201fd9aa911f36e0fc0a0bb182f4380e408865ea22f4c7f2f55c8d601868b00ea097317beb0424a7957e8975da64f6f019dc
|
data/README.md
CHANGED
@@ -235,11 +235,10 @@ Defines what method is run when looking for the author for recording
|
|
235
235
|
``` ruby
|
236
236
|
# config/initializers/log_book.rb
|
237
237
|
LogBook.configure do |config|
|
238
|
-
config.records_table_name = 'records'
|
239
238
|
config.ignored_attributes = [:updated_at, :created_at]
|
240
239
|
config.author_method = :current_user
|
241
240
|
config.record_squashing = false
|
242
|
-
config.
|
241
|
+
config.always_record = false
|
243
242
|
config.skip_if_empty_actions = [:update]
|
244
243
|
end
|
245
244
|
```
|
@@ -248,7 +247,7 @@ end
|
|
248
247
|
|
249
248
|
``` ruby
|
250
249
|
LogBook.with_recording {} #=> Enables recording within block
|
251
|
-
LogBook.author=(author
|
250
|
+
LogBook.author=(author) #=> Records as a different author within block
|
252
251
|
LogBook.action=(value) #=> Change default action for this request
|
253
252
|
LogBook.with_record_squashing {} #=> Squashes records within block
|
254
253
|
LogBook.enable_recording #=> Enables recording from this point
|
@@ -2,7 +2,7 @@ LogBook.configure do |config|
|
|
2
2
|
# config.records_table_name = 'records'
|
3
3
|
# config.ignored_attributes = [:updated_at, :created_at]
|
4
4
|
# config.author_method = :current_user
|
5
|
-
# config.
|
5
|
+
# config.always_record = false
|
6
6
|
# config.record_squashing = true
|
7
7
|
# config.skip_if_empty_actions = [:update]
|
8
8
|
end
|
@@ -3,7 +3,7 @@ module LogBook
|
|
3
3
|
|
4
4
|
setting :records_table_name, 'records'
|
5
5
|
setting :ignored_attributes, [:updated_at, :created_at]
|
6
|
-
setting :
|
6
|
+
setting :always_record, false
|
7
7
|
setting :author_method, :current_user
|
8
8
|
setting :record_squashing, false
|
9
9
|
setting :skip_if_empty_actions, [:update]
|
data/lib/log_book/railtie.rb
CHANGED
@@ -4,5 +4,13 @@ module LogBook
|
|
4
4
|
spec = Gem::Specification.find_by_name 'rails_log_book'
|
5
5
|
load "#{spec.gem_dir}/lib/tasks/log_book.rake"
|
6
6
|
end
|
7
|
+
|
8
|
+
config.after_initialize do
|
9
|
+
next unless LogBook.config.always_record
|
10
|
+
|
11
|
+
at_exit do
|
12
|
+
LogBook::SaveRecords.call
|
13
|
+
end
|
14
|
+
end
|
7
15
|
end
|
8
16
|
end
|
data/lib/log_book/tree.rb
CHANGED
@@ -11,7 +11,8 @@ module LogBook
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def add(record)
|
14
|
-
node = nodes[record.recording_key]
|
14
|
+
node = nodes[record.recording_key]
|
15
|
+
node = node ? node.merge(record) : nodes[record.recording_key] = Node.new(record)
|
15
16
|
add_parent(node, record.parent)
|
16
17
|
add_children(node, record.children)
|
17
18
|
end
|
@@ -69,6 +70,11 @@ module LogBook
|
|
69
70
|
@depth = 0
|
70
71
|
@children = []
|
71
72
|
end
|
73
|
+
|
74
|
+
def merge(new_value)
|
75
|
+
value.record_changes = new_value.record_changes
|
76
|
+
self
|
77
|
+
end
|
72
78
|
end
|
73
79
|
end
|
74
80
|
end
|
data/lib/log_book/version.rb
CHANGED
data/lib/rails_log_book.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_log_book
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stjepan Hadjic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|