audit_model 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 +11 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/README.md +54 -0
- data/Rakefile +6 -0
- data/audit_model.gemspec +30 -0
- data/lib/audit_model.rb +5 -0
- data/lib/audit_model/version.rb +3 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4fbf268b640ba3489c07ed6ff20a40f454a44ac2
|
4
|
+
data.tar.gz: 137cbed98f5cb719d63b38abce211db531b2ec0b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7168fbf66da9d93b435e64458e8d48f16e088bda655a2d9a4ddf28ca0f220e32355cb8096d9bca92bfaacbb4a4cc13a4d1e17fc09504da624e49cc4f3f42c7f0
|
7
|
+
data.tar.gz: e11de75b2c0c50d62c4dd972efd52fb06af0a1b0ae4ca0bcd85e3c6d7db1a93cde291bee8fed53ca9d549c7561959d585837906e5551d66b6cca36477ccdac0a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# AuditModel
|
2
|
+
|
3
|
+
Track changes to your models, for auditing or versioning.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add audit_model to your application's Gemfile
|
8
|
+
|
9
|
+
```
|
10
|
+
#!ruby
|
11
|
+
gem 'audit_model'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute
|
15
|
+
|
16
|
+
```
|
17
|
+
rails g audit_model:install
|
18
|
+
rake db:migrate
|
19
|
+
```
|
20
|
+
For each model you want to audit you should run this command:
|
21
|
+
```
|
22
|
+
rails g audit_model:audit MODEL field1 field2 ...
|
23
|
+
rake db:migrate
|
24
|
+
```
|
25
|
+
Where MODEL is your model what you want to do audit and (field1, field2) are the fields that you want to be audited.
|
26
|
+
Add auditable to the models you want to track.
|
27
|
+
|
28
|
+
```
|
29
|
+
#!ruby
|
30
|
+
class User < ActiveRecord::Base
|
31
|
+
auditable
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
In the model you have [#audits](#) method that returns the audits.
|
37
|
+
```
|
38
|
+
#!ruby
|
39
|
+
User.audits
|
40
|
+
```
|
41
|
+
Audits are ActiveRecord models, knowing that you can make any query based on ActiveRecord.
|
42
|
+
You can do something like this:
|
43
|
+
```
|
44
|
+
#!ruby
|
45
|
+
User.audits.last
|
46
|
+
```
|
47
|
+
This will return the last change in the model.
|
48
|
+
## License
|
49
|
+
|
50
|
+
AuditModel is released under the [MIT License](http://www.opensource.org/licenses/MIT).
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
Bug reports and pull requests are welcome on BitBucket at https://bitbucket.org/alissonbruno/audit_model
|
data/Rakefile
ADDED
data/audit_model.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'audit_model/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "audit_model"
|
8
|
+
spec.platform = Gem::Platform::RUBY
|
9
|
+
spec.version = AuditModel::VERSION
|
10
|
+
spec.summary = %q{Audit changes to your models.}
|
11
|
+
spec.description = %q{With gem audit_model you can log all changes to your models.}
|
12
|
+
|
13
|
+
spec.required_ruby_version = '>= 2.2.2'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.authors = ["Alisson Bruno"]
|
17
|
+
spec.email = ["alissonbruno.sa@gmail.com"]
|
18
|
+
spec.homepage = "https://bitbucket.org/alissonbruno/audit_model"
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
|
29
|
+
spec.add_dependency 'activerecord', [">=4.2", "< 5.1"]
|
30
|
+
end
|
data/lib/audit_model.rb
ADDED
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: audit_model
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alisson Bruno
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activerecord
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4.2'
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '5.1'
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '4.2'
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '5.1'
|
75
|
+
description: With gem audit_model you can log all changes to your models.
|
76
|
+
email:
|
77
|
+
- alissonbruno.sa@gmail.com
|
78
|
+
executables: []
|
79
|
+
extensions: []
|
80
|
+
extra_rdoc_files: []
|
81
|
+
files:
|
82
|
+
- ".gitignore"
|
83
|
+
- ".rspec"
|
84
|
+
- ".travis.yml"
|
85
|
+
- Gemfile
|
86
|
+
- README.md
|
87
|
+
- Rakefile
|
88
|
+
- audit_model.gemspec
|
89
|
+
- lib/audit_model.rb
|
90
|
+
- lib/audit_model/version.rb
|
91
|
+
homepage: https://bitbucket.org/alissonbruno/audit_model
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.2.2
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.5.1
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Audit changes to your models.
|
115
|
+
test_files: []
|