logga 1.6.2 → 2.1.2

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: ad7c8f2df432c96d6db7b3fa5f22c7ac8b7721f3a9af98c2d152dcaa1268113c
4
- data.tar.gz: 98f43cf7910d991e11da7ba8324c79be2f4180a714d71cd2e45d1a944247cc6a
3
+ metadata.gz: e701347d79260bff1bb8db40f220512a456720b66efa246de76dac9a9790bac2
4
+ data.tar.gz: a8b56e341270752b63f5d1195232e0ac90972d3e66bf0368561b0775ea45e99d
5
5
  SHA512:
6
- metadata.gz: 84a3ee81304cc97f0db758eec19715a4eb6185a45870c0d67d8dac6ba525e8c0fa08da8391ac7a75a37bd05851bcb881dcbbf57fefd24238a8a6eb70de1f0508
7
- data.tar.gz: 20e82cbca661fa23e241aa7f3479d7cc0074971d2148fd7e2ba19ebbdb27b972c577ccc7458f28c4870ba4b298508504ea73ae21d406f412087016c16ea82236
6
+ metadata.gz: 4991d4f6fb02cb56c5f3b952416fb2c58209eae7a84d65d8db9147b797cab1c40af9123d1be4e70a4b59a9d5a46247f7a1a913695558bf9d7641e76b1fcc38c0
7
+ data.tar.gz: ccdd5e59e29546563dc5cbba93796682dcdb07286aa91da7974d544daa41a3d43724b93d749d41b7dd5e957240f08f0b9ca062e74e22242d4c22e727dc34e799
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2020 Boxt
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Provides attribute logging functionality to ActiveRecord objects.
4
4
 
5
+ [![CircleCI](https://circleci.com/gh/boxt/logga/tree/master.svg?style=svg&circle-token=f9550ac25744c292e3680638bad3d5deafb1c4e1)](https://circleci.com/gh/boxt/logga/tree/master)
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -12,11 +14,15 @@ gem 'logga'
12
14
 
13
15
  And then execute:
14
16
 
15
- $ bundle
17
+ ```sh
18
+ bundle
19
+ ```
16
20
 
17
21
  Or install it yourself as:
18
22
 
19
- $ gem install logga
23
+ ```sh
24
+ gem install logga
25
+ ```
20
26
 
21
27
  ## Usage
22
28
 
@@ -26,7 +32,6 @@ Add this to your model:
26
32
  class Order < ApplicationRecord
27
33
  add_log_entries_for :create, :update
28
34
  end
29
-
30
35
  ```
31
36
 
32
37
  So that new LogEntry records attached to a given Order instance will be created whenever a new one is created or
@@ -34,11 +39,13 @@ modified.
34
39
 
35
40
  ## Development
36
41
 
37
- 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.
42
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
38
43
 
39
44
  To install this gem onto your local machine, run `bundle exec rake install`.
40
45
 
41
- To release a new version, update the version number in `version.rb`.
46
+ ## Versioning
47
+
48
+ The version of the gem should be set in the `VERSION` file found in the root of the project. This is then read by the `lib/boxt_aasm_ext/version.rb` file to set in the gem.
42
49
 
43
50
  ## Contributing
44
51
 
@@ -50,5 +57,5 @@ The gem is available as open source under the terms of the [MIT License](http://
50
57
 
51
58
  ## TODOs
52
59
 
53
- * Write some tests
54
- * Improve the documentation
60
+ - Write some tests
61
+ - Improve the documentation
data/Rakefile CHANGED
@@ -1,6 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
4
+ require "rake/testtask"
2
5
  require "rspec/core/rake_task"
3
6
 
4
- RSpec::Core::RakeTask.new(:spec)
7
+ RSpec::Core::RakeTask.new(:spec) do |t|
8
+ t.pattern = Dir.glob("spec/**/*_spec.rb")
9
+ end
5
10
 
6
- task :default => :spec
11
+ task test: :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.1.2
@@ -4,13 +4,13 @@ module Logga
4
4
  module ActiveRecord
5
5
  extend ActiveSupport::Concern
6
6
 
7
- EXCLUDED_KEYS = %i[id created_at deleted_at initial updated_at log sent_after_sales_emails].freeze
7
+ EXCLUDED_KEYS = %i[id created_at deleted_at initial updated_at log sent_after_sales_emails].freeze
8
8
  EXCLUDED_KEYS_SUFFIXES = %i[_id _filenames].freeze
9
9
 
10
10
  included do
11
- class_attribute :log_fields, instance_writer: false
11
+ class_attribute :log_fields, instance_writer: false
12
12
  class_attribute :excluded_fields, instance_writer: false
13
- self.log_fields = {}
13
+ self.log_fields = {}
14
14
  self.excluded_fields = {}
15
15
  end
16
16
 
@@ -21,7 +21,7 @@ module Logga
21
21
  after_update :log_model_changes if actions.include?(:update)
22
22
  define_method(:log_receiver) { to == :self ? self : send(to) }
23
23
 
24
- self.log_fields = fields
24
+ self.log_fields = fields
25
25
  self.excluded_fields = Array(exclude_fields)
26
26
  end
27
27
  end
@@ -37,7 +37,7 @@ module Logga
37
37
  return if should_not_log?
38
38
 
39
39
  body_generator = ->(record) { default_creation_log_body(record) }
40
- body = log_fields.fetch(:created_at, body_generator).call(self)
40
+ body = log_fields.fetch(:created_at, body_generator).call(self)
41
41
  create_log_entry(author_data.merge(body: body, created_at: creation_at))
42
42
  end
43
43
 
@@ -45,7 +45,7 @@ module Logga
45
45
  return if should_not_log?
46
46
 
47
47
  body_generator = ->(record) { default_deletion_log_body(record) }
48
- body = log_fields.fetch(:deleted_at, body_generator).call(self)
48
+ body = log_fields.fetch(:deleted_at, body_generator).call(self)
49
49
  create_log_entry(author_data.merge(body: body))
50
50
  end
51
51
 
@@ -61,7 +61,7 @@ module Logga
61
61
  def author_data
62
62
  data = Hash(log_receiver.try(:author) || try(:author)).with_indifferent_access
63
63
  {
64
- author_id: data[:id],
64
+ author_id: data[:id],
65
65
  author_type: data[:type],
66
66
  author_name: data[:name]
67
67
  }
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Logga
4
- VERSION = "1.6.2"
4
+ version_file = File.join(File.dirname(__FILE__), "../../VERSION")
5
+ VERSION = File.read(version_file).split("\n").first
5
6
  end
metadata CHANGED
@@ -1,127 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logga
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boxt
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-28 00:00:00.000000000 Z
11
+ date: 2020-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: boxt_ruby_style_guide
14
+ name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5.2'
17
20
  - - "~>"
18
21
  - !ruby/object:Gem::Version
19
- version: '2.1'
20
- type: :development
22
+ version: '6.0'
23
+ type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '5.2'
24
30
  - - "~>"
25
31
  - !ruby/object:Gem::Version
26
- version: '2.1'
32
+ version: '6.0'
27
33
  - !ruby/object:Gem::Dependency
28
- name: bundler
34
+ name: activesupport
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '5.2'
31
40
  - - "~>"
32
41
  - !ruby/object:Gem::Version
33
- version: '1.17'
34
- type: :development
42
+ version: '6.0'
43
+ type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '5.2'
38
50
  - - "~>"
39
51
  - !ruby/object:Gem::Version
40
- version: '1.17'
52
+ version: '6.0'
41
53
  - !ruby/object:Gem::Dependency
42
- name: byebug
54
+ name: boxt_ruby_style_guide
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - '='
58
+ - !ruby/object:Gem::Version
59
+ version: 7.2.0
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '='
65
+ - !ruby/object:Gem::Version
66
+ version: 7.2.0
67
+ - !ruby/object:Gem::Dependency
68
+ name: bundler
43
69
  requirement: !ruby/object:Gem::Requirement
44
70
  requirements:
45
71
  - - "~>"
46
72
  - !ruby/object:Gem::Version
47
- version: '10.0'
73
+ version: '2.1'
48
74
  type: :development
49
75
  prerelease: false
50
76
  version_requirements: !ruby/object:Gem::Requirement
51
77
  requirements:
52
78
  - - "~>"
53
79
  - !ruby/object:Gem::Version
54
- version: '10.0'
80
+ version: '2.1'
55
81
  - !ruby/object:Gem::Dependency
56
- name: rake
82
+ name: byebug
57
83
  requirement: !ruby/object:Gem::Requirement
58
84
  requirements:
59
85
  - - "~>"
60
86
  - !ruby/object:Gem::Version
61
- version: '12.3'
87
+ version: '11.0'
62
88
  type: :development
63
89
  prerelease: false
64
90
  version_requirements: !ruby/object:Gem::Requirement
65
91
  requirements:
66
92
  - - "~>"
67
93
  - !ruby/object:Gem::Version
68
- version: '12.3'
94
+ version: '11.0'
69
95
  - !ruby/object:Gem::Dependency
70
- name: rspec
96
+ name: rake
71
97
  requirement: !ruby/object:Gem::Requirement
72
98
  requirements:
73
99
  - - "~>"
74
100
  - !ruby/object:Gem::Version
75
- version: '3.6'
101
+ version: '13.0'
76
102
  type: :development
77
103
  prerelease: false
78
104
  version_requirements: !ruby/object:Gem::Requirement
79
105
  requirements:
80
106
  - - "~>"
81
107
  - !ruby/object:Gem::Version
82
- version: '3.6'
108
+ version: '13.0'
83
109
  - !ruby/object:Gem::Dependency
84
- name: simplecov
110
+ name: rspec
85
111
  requirement: !ruby/object:Gem::Requirement
86
112
  requirements:
87
113
  - - "~>"
88
114
  - !ruby/object:Gem::Version
89
- version: '0.16'
115
+ version: '3.9'
90
116
  type: :development
91
117
  prerelease: false
92
118
  version_requirements: !ruby/object:Gem::Requirement
93
119
  requirements:
94
120
  - - "~>"
95
121
  - !ruby/object:Gem::Version
96
- version: '0.16'
122
+ version: '3.9'
97
123
  - !ruby/object:Gem::Dependency
98
- name: activerecord
124
+ name: rspec-nc
99
125
  requirement: !ruby/object:Gem::Requirement
100
126
  requirements:
101
127
  - - "~>"
102
128
  - !ruby/object:Gem::Version
103
- version: '5.2'
104
- type: :runtime
129
+ version: '0.3'
130
+ type: :development
105
131
  prerelease: false
106
132
  version_requirements: !ruby/object:Gem::Requirement
107
133
  requirements:
108
134
  - - "~>"
109
135
  - !ruby/object:Gem::Version
110
- version: '5.2'
136
+ version: '0.3'
111
137
  - !ruby/object:Gem::Dependency
112
- name: activesupport
138
+ name: simplecov
113
139
  requirement: !ruby/object:Gem::Requirement
114
140
  requirements:
115
141
  - - "~>"
116
142
  - !ruby/object:Gem::Version
117
- version: '5.2'
118
- type: :runtime
143
+ version: '0.17'
144
+ type: :development
119
145
  prerelease: false
120
146
  version_requirements: !ruby/object:Gem::Requirement
121
147
  requirements:
122
148
  - - "~>"
123
149
  - !ruby/object:Gem::Version
124
- version: '5.2'
150
+ version: '0.17'
125
151
  description: Extensions to ActiveRecord to log entries on model changes
126
152
  email:
127
153
  - developers@boxt.co.uk
@@ -129,26 +155,18 @@ executables: []
129
155
  extensions: []
130
156
  extra_rdoc_files: []
131
157
  files:
132
- - ".gitignore"
133
- - ".rspec"
134
- - ".rubocop.yml"
135
- - ".ruby-version"
136
- - ".travis.yml"
137
- - Gemfile
138
- - LICENSE.txt
158
+ - MIT-LICENSE
139
159
  - README.md
140
160
  - Rakefile
141
- - bin/console
142
- - bin/setup
161
+ - VERSION
143
162
  - lib/logga.rb
144
163
  - lib/logga/active_record.rb
145
164
  - lib/logga/version.rb
146
- - logga.gemspec
147
165
  homepage: https://github.com/boxt/logga
148
166
  licenses:
149
167
  - MIT
150
168
  metadata: {}
151
- post_install_message:
169
+ post_install_message:
152
170
  rdoc_options: []
153
171
  require_paths:
154
172
  - lib
@@ -156,16 +174,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
174
  requirements:
157
175
  - - ">="
158
176
  - !ruby/object:Gem::Version
159
- version: '0'
177
+ version: '2.5'
160
178
  required_rubygems_version: !ruby/object:Gem::Requirement
161
179
  requirements:
162
180
  - - ">="
163
181
  - !ruby/object:Gem::Version
164
182
  version: '0'
165
183
  requirements: []
166
- rubyforge_project:
167
- rubygems_version: 2.7.6
168
- signing_key:
184
+ rubygems_version: 3.1.4
185
+ signing_key:
169
186
  specification_version: 4
170
187
  summary: ActiveRecord log entries on model changes
171
188
  test_files: []
data/.gitignore DELETED
@@ -1,101 +0,0 @@
1
- # See http://help.github.com/ignore-files/ for more about ignoring files.
2
- #
3
- # If you find yourself ignoring temporary files generated by your text editor
4
- # or operating system, you probably want to add a global ignore instead:
5
- # git config --global core.excludesfile '~/.gitignore_global'
6
-
7
- # Ignore bundler config.
8
- /.bundle
9
-
10
- # Gems
11
- /Gemfile.lock
12
-
13
- # Ignore the default SQLite database.
14
- /db/*.sqlite3
15
- /db/*.sqlite3-journal
16
-
17
- # Ignore gem building folder: pkg
18
- pkg
19
-
20
- # Ignore log and tmp files
21
- log/*
22
- *.log
23
- tmp
24
- tmp/**/*
25
-
26
- # Documentation
27
- /doc/
28
- doc/api
29
- doc/app
30
- .yardoc
31
- /_yardoc/
32
- .yardopts
33
-
34
- # Public Uploads
35
- public/system/*
36
- public/themes/*
37
-
38
- # Public Cache
39
- public/javascripts/cache
40
- public/stylesheets/cache
41
-
42
- # Vendor Cache
43
- vendor/cache
44
-
45
- # Acts as Indexed
46
- index/**/*
47
-
48
- # Refinery Specific
49
- *.tmproj
50
- *.autobackupbyrefinery.*
51
- refinerycms-*.gem
52
- .autotest
53
-
54
- # Mac
55
- .DS_Store
56
-
57
- # Windows
58
- Thumbs.db
59
-
60
- # NetBeans
61
- nbproject
62
-
63
- # Eclipse
64
- .project
65
-
66
- # Redcar
67
- .redcar
68
-
69
- # Rubinius
70
- *.rbc
71
-
72
- # RVM / rbenv
73
- .ruby-gemset
74
- .rvmrc
75
-
76
- # Vim
77
- *.swp
78
- *.swo
79
-
80
- # RubyMine
81
- .idea
82
-
83
- # E-texteditor
84
- .eprj
85
-
86
- # Backup
87
- *~
88
-
89
- # Capybara Bug
90
- capybara-*html
91
-
92
- # sass
93
- .sass-cache
94
- .sass-cache/*
95
-
96
- # SimpleCov (tests code converage)
97
- /coverage
98
-
99
- # RSpec
100
- /spec/reports/
101
- .rspec_status
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --color
2
- --require byebug
3
- --require spec_helper
4
- --format documentation
@@ -1,3 +0,0 @@
1
- inherit_gem:
2
- boxt_ruby_style_guide:
3
- - default.yml
@@ -1 +0,0 @@
1
- ruby-2.5.3
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.3
5
- before_install: gem install bundler -v 1.17.3
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- # Specify your gem's dependencies in logga.gemspec
6
- gemspec
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Lorenzo Tello
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.
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "logga"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # rubocop:disable Style/ExpandPathArguments
4
- # NOTE: This is because of Gemfury failing with __dir__
5
- lib = File.expand_path("../lib", __FILE__)
6
- # rubocop:enable Style/ExpandPathArguments
7
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
- require "logga/version"
9
-
10
- Gem::Specification.new do |spec|
11
- spec.name = "logga"
12
- spec.version = Logga::VERSION
13
- spec.authors = ["Boxt"]
14
- spec.email = ["developers@boxt.co.uk"]
15
-
16
- spec.summary = "ActiveRecord log entries on model changes"
17
- spec.description = "Extensions to ActiveRecord to log entries on model changes"
18
- spec.homepage = "https://github.com/boxt/logga"
19
- spec.license = "MIT"
20
-
21
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
22
- f.match(%r{^(test|spec|features)/})
23
- end
24
- spec.bindir = "exe"
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ["lib"]
27
-
28
- spec.add_development_dependency "boxt_ruby_style_guide", "~> 2.1"
29
- spec.add_development_dependency "bundler", "~> 1.17"
30
- spec.add_development_dependency "byebug", "~> 10.0"
31
- spec.add_development_dependency "rake", "~> 12.3"
32
- spec.add_development_dependency "rspec", "~> 3.6"
33
- spec.add_development_dependency "simplecov", "~> 0.16"
34
-
35
- spec.add_runtime_dependency "activerecord", "~> 5.2"
36
- spec.add_runtime_dependency "activesupport", "~> 5.2"
37
- end