paper_trail_scrapbook 0.1.3 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CODE_OF_CONDUCT.md +46 -0
- data/Changelog.md +14 -0
- data/Gemfile.lock +2 -2
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/paper_trail_scrapbook/changes.rb +2 -2
- data/lib/paper_trail_scrapbook/chapter.rb +17 -4
- data/lib/paper_trail_scrapbook/config.rb +10 -8
- data/lib/paper_trail_scrapbook/life_history.rb +1 -1
- data/lib/paper_trail_scrapbook/version.rb +1 -1
- data/spec/paper_trail_scrapbook/changes_spec.rb +2 -2
- data/spec/paper_trail_scrapbook/chapter_spec.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8a8392755eb1e658bea68423fffc6707e8aa465
|
4
|
+
data.tar.gz: 755f0f904aa0173175f279ec8832bc959833f0a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ee0eaa31e43a7f427b4f2f1f224a19207cdc24e6ecc67bb84bea064c95b92fc05644c3779ddc533d38291674f18a3f35b7e1c0d4825d0c8c30557be745e07a3
|
7
|
+
data.tar.gz: a9d56422cad7eb4da6437077761b032a874c3940288ff3d82f3ac0b81317b7d4dc108b93d627f990378a2fd09092b0c5550ca85b98b62278b8808ba7035e566e
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
test.log
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
## Our Standards
|
8
|
+
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
10
|
+
|
11
|
+
* Using welcoming and inclusive language
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
13
|
+
* Gracefully accepting constructive criticism
|
14
|
+
* Focusing on what is best for the community
|
15
|
+
* Showing empathy towards other community members
|
16
|
+
|
17
|
+
Examples of unacceptable behavior by participants include:
|
18
|
+
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
21
|
+
* Public or private harassment
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
24
|
+
|
25
|
+
## Our Responsibilities
|
26
|
+
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
28
|
+
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
30
|
+
|
31
|
+
## Scope
|
32
|
+
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
34
|
+
|
35
|
+
## Enforcement
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at tim@possibilogy.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
38
|
+
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
40
|
+
|
41
|
+
## Attribution
|
42
|
+
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
44
|
+
|
45
|
+
[homepage]: http://contributor-covenant.org
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Changelog.md
CHANGED
@@ -15,6 +15,20 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).
|
|
15
15
|
|
16
16
|
### Fixed
|
17
17
|
|
18
|
+
## 0.1.4 (2017-11-08) Minor Functional Release
|
19
|
+
|
20
|
+
### Breaking Changes
|
21
|
+
|
22
|
+
- None
|
23
|
+
|
24
|
+
### Added
|
25
|
+
|
26
|
+
- Added #to_whodunnit as a customizeable fetch of the whodunnit info
|
27
|
+
|
28
|
+
### Fixed
|
29
|
+
|
30
|
+
- None
|
31
|
+
|
18
32
|
## 0.1.3 (2017-07-05) Bugfix Release
|
19
33
|
|
20
34
|
### Breaking Changes
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -46,7 +46,7 @@ PaperTrailScrapbook.config.whodunnit_class = WhoDidIt
|
|
46
46
|
```ruby
|
47
47
|
widget = Widget.find 42
|
48
48
|
|
49
|
-
text = PaperTrailScrapbook::
|
49
|
+
text = PaperTrailScrapbook::LifeHistory.new(widget).story
|
50
50
|
# On Wednesday, 07 Jun 2017 at 2:37 PM, Rob Owens created the following Widget information:
|
51
51
|
# • email: Tim@example.com
|
52
52
|
# • name: Tim's Widget
|
data/Rakefile
CHANGED
@@ -26,7 +26,7 @@ module PaperTrailScrapbook
|
|
26
26
|
.compact
|
27
27
|
.join("\n")
|
28
28
|
|
29
|
-
text = text.gsub('
|
29
|
+
text = text.gsub(' id:', ':') if PaperTrailScrapbook.config.drop_id_suffix
|
30
30
|
text
|
31
31
|
end
|
32
32
|
|
@@ -36,7 +36,7 @@ module PaperTrailScrapbook
|
|
36
36
|
old, new = v
|
37
37
|
return if old.nil? && (new.nil? || new.eql?(''))
|
38
38
|
|
39
|
-
"#{BULLET} #{k}: #{detailed_analysis(k, new, old)}"
|
39
|
+
"#{BULLET} #{k.gsub('_',' ')}: #{detailed_analysis(k, new, old)}"
|
40
40
|
end
|
41
41
|
|
42
42
|
def detailed_analysis(k, new, old)
|
@@ -7,12 +7,17 @@ module PaperTrailScrapbook
|
|
7
7
|
include Concord.new(:version)
|
8
8
|
include Adamantium::Flat
|
9
9
|
|
10
|
+
delegate :event, to: :version
|
11
|
+
|
10
12
|
# Single version historical analysis
|
11
13
|
#
|
12
14
|
# @return [String] Human readable description of changes
|
13
15
|
#
|
14
16
|
def story
|
15
|
-
|
17
|
+
updates = changes
|
18
|
+
return unless create? || updates.present? || !config.filter_non_changes
|
19
|
+
|
20
|
+
"#{preface}\n#{updates}"
|
16
21
|
end
|
17
22
|
|
18
23
|
private
|
@@ -25,6 +30,10 @@ module PaperTrailScrapbook
|
|
25
30
|
version.item_type
|
26
31
|
end
|
27
32
|
|
33
|
+
def create?
|
34
|
+
event.eql?('create')
|
35
|
+
end
|
36
|
+
|
28
37
|
def changes
|
29
38
|
Changes.new(version).change_log
|
30
39
|
end
|
@@ -33,7 +42,11 @@ module PaperTrailScrapbook
|
|
33
42
|
author = version.version_author
|
34
43
|
if author
|
35
44
|
if whodunnit_class
|
36
|
-
whodunnit_class.
|
45
|
+
if whodunnit_class.method_defined?(:to_whodunnit)
|
46
|
+
whodunnit_class.find(author).to_whodunnit
|
47
|
+
else
|
48
|
+
whodunnit_class.find(author).to_s
|
49
|
+
end
|
37
50
|
else
|
38
51
|
author
|
39
52
|
end
|
@@ -55,8 +68,8 @@ module PaperTrailScrapbook
|
|
55
68
|
end
|
56
69
|
|
57
70
|
def kind
|
58
|
-
config.events[
|
59
|
-
raise(ArgumentError, "incorrect event:#{
|
71
|
+
config.events[event] ||
|
72
|
+
raise(ArgumentError, "incorrect event:#{event}")
|
60
73
|
end
|
61
74
|
end
|
62
75
|
end
|
@@ -10,7 +10,7 @@ module PaperTrailScrapbook
|
|
10
10
|
'update' => 'updated',
|
11
11
|
'destroy' => 'destroyed' }.freeze
|
12
12
|
|
13
|
-
SCRUB_COLUMNS = %w
|
13
|
+
SCRUB_COLUMNS = %w[updated_at created_at id].freeze
|
14
14
|
UNKNOWN_WHODUNNIT = '*the app*'.freeze
|
15
15
|
|
16
16
|
attr_accessor :whodunnit_class,
|
@@ -18,15 +18,17 @@ module PaperTrailScrapbook
|
|
18
18
|
:events,
|
19
19
|
:scrub_columns,
|
20
20
|
:drop_id_suffix,
|
21
|
-
:unknown_whodunnit
|
21
|
+
:unknown_whodunnit,
|
22
|
+
:filter_non_changes
|
22
23
|
|
23
24
|
def initialize
|
24
|
-
@whodunnit_class
|
25
|
-
@time_format
|
26
|
-
@events
|
27
|
-
@scrub_columns
|
28
|
-
@unknown_whodunnit
|
29
|
-
@drop_id_suffix
|
25
|
+
@whodunnit_class = nil
|
26
|
+
@time_format = DEFAULT_TIME_FORMAT
|
27
|
+
@events = DEFAULT_EVENTS
|
28
|
+
@scrub_columns = SCRUB_COLUMNS
|
29
|
+
@unknown_whodunnit = UNKNOWN_WHODUNNIT
|
30
|
+
@drop_id_suffix = true
|
31
|
+
@filter_non_changes = true
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -89,7 +89,7 @@ module PaperTrailScrapbook
|
|
89
89
|
|
90
90
|
describe '#change_log' do
|
91
91
|
it 'provides a set of update changes' do
|
92
|
-
expect(subject).to match(/
|
92
|
+
expect(subject).to match(/discounted amount: 29612.0 added/)
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'filters the proper columns' do
|
@@ -101,7 +101,7 @@ module PaperTrailScrapbook
|
|
101
101
|
it 'provides a set of create changes' do
|
102
102
|
version.event = 'create'
|
103
103
|
|
104
|
-
expect(subject).to match(/
|
104
|
+
expect(subject).to match(/discounted amount: 29612.0$/)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paper_trail_scrapbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timothy Chambers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -239,9 +239,11 @@ extensions: []
|
|
239
239
|
extra_rdoc_files: []
|
240
240
|
files:
|
241
241
|
- ".codeclimate.yml"
|
242
|
+
- ".gitignore"
|
242
243
|
- ".rspec"
|
243
244
|
- ".rubocop.yml"
|
244
245
|
- ".ruby-gemset"
|
246
|
+
- CODE_OF_CONDUCT.md
|
245
247
|
- Changelog.md
|
246
248
|
- Gemfile
|
247
249
|
- Gemfile.lock
|