snapcher 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -7
- data/README.md +58 -19
- data/lib/snapcher/version.rb +1 -1
- data/logo/snapcher_logo.png +0 -0
- metadata +10 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf06ee5a1a0a2a88b36aaf158a7968e6e43e076d48c5109312f299b00dd84f75
|
4
|
+
data.tar.gz: 0005bf88e3a4e16762aec1ba059a327bdb2c5e01e97f9727a5a4ac60db1abf42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9377f8a832c2ca08c13b9cdeb05651be64672d7058a96e8bf36ca82fb5b2142e8cc3f48c15f2555011dca32ab409ab20119c07e1822ca6b12e77f3efc30257b
|
7
|
+
data.tar.gz: e7c95f86a999f0000686f5a9f4afc55af69b0fc3cd451e8a9cf1d1970f1c06d50a14cefdfe72a9c0e057f1e012c0c1f1fd9240562446ee1141ee0298023e103e
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snapcher (0.1.
|
4
|
+
snapcher (0.1.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -71,10 +71,6 @@ GEM
|
|
71
71
|
i18n (>= 1.6, < 2)
|
72
72
|
minitest (>= 5.1)
|
73
73
|
tzinfo (~> 2.0)
|
74
|
-
appraisal (2.5.0)
|
75
|
-
bundler
|
76
|
-
rake
|
77
|
-
thor (>= 0.14.0)
|
78
74
|
ast (2.4.2)
|
79
75
|
base64 (0.1.1)
|
80
76
|
builder (3.2.4)
|
@@ -108,7 +104,7 @@ GEM
|
|
108
104
|
method_source (1.0.0)
|
109
105
|
mini_mime (1.1.5)
|
110
106
|
minitest (5.20.0)
|
111
|
-
net-imap (0.4.
|
107
|
+
net-imap (0.4.2)
|
112
108
|
date
|
113
109
|
net-protocol
|
114
110
|
net-pop (0.1.2)
|
@@ -233,7 +229,6 @@ PLATFORMS
|
|
233
229
|
x86_64-linux
|
234
230
|
|
235
231
|
DEPENDENCIES
|
236
|
-
appraisal
|
237
232
|
debug (>= 1.8.0)
|
238
233
|
rails (>= 7.0.0, < 7.1)
|
239
234
|
railties
|
data/README.md
CHANGED
@@ -1,39 +1,78 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
----------
|
4
|
+
|
1
5
|
# Snapcher
|
6
|
+
[](http://rubygems.org/gems/snapcher)
|
7
|
+

|
8
|
+
=======
|
2
9
|
|
3
|
-
|
10
|
+
**Snapcher** is an ORM extension that logs changes to specific columns to your model.
|
4
11
|
|
5
|
-
|
12
|
+
When a change is made to a specific column, the difference between before and after the change is obtained and saved.
|
6
13
|
|
7
|
-
|
14
|
+
To make it easier for analysts, save the table name, column name, and data before and after changes as separate columns.
|
8
15
|
|
9
|
-
|
16
|
+
## Supported
|
10
17
|
|
11
|
-
|
18
|
+
### Snapcher supports Ruby versions:
|
12
19
|
|
13
|
-
|
20
|
+
* 3.1
|
21
|
+
* 3.2
|
14
22
|
|
15
|
-
|
23
|
+
### Snapcher supports Rails versions:
|
16
24
|
|
17
|
-
|
25
|
+
* 7.0
|
26
|
+
* 7.1
|
18
27
|
|
19
|
-
##
|
28
|
+
## Supported ORMs
|
29
|
+
|
30
|
+
Snapcher is currently ActiveRecord-only.
|
20
31
|
|
21
|
-
|
32
|
+
## Installation
|
33
|
+
|
34
|
+
Add the gem to your Gemfile:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
gem "snapcher"
|
38
|
+
```
|
22
39
|
|
23
|
-
|
40
|
+
Then, from your Rails app directory, create the `scannings` table:
|
24
41
|
|
25
|
-
|
42
|
+
```bash
|
43
|
+
$ rails generate snapcher:install
|
44
|
+
$ rails db:migrate
|
45
|
+
```
|
46
|
+
|
47
|
+
## Usage
|
26
48
|
|
27
|
-
|
49
|
+
Simply call `scanning` on your models.
|
28
50
|
|
29
|
-
|
51
|
+
Use `column_name:` to select the column you want to log.
|
30
52
|
|
31
|
-
|
53
|
+
```ruby
|
54
|
+
class User < ActiveRecord::Base
|
55
|
+
scanning column_name: "name"
|
56
|
+
end
|
57
|
+
```
|
32
58
|
|
33
|
-
|
59
|
+
By default, whenever a user is created, updated or destroyed, a new scanning is created.
|
34
60
|
|
35
|
-
|
61
|
+
```ruby
|
62
|
+
user = User.create!(name: "Gillian Seed")
|
63
|
+
user.scannings.count # => 1
|
64
|
+
user.update!(name: "Mika Slayton")
|
65
|
+
user.scannings.count # => 2
|
66
|
+
user.destroy
|
67
|
+
user.scannings.count # => 3
|
68
|
+
```
|
36
69
|
|
37
|
-
|
70
|
+
Scanning contain information regarding what action was taken on the model and what changes were made.
|
38
71
|
|
39
|
-
|
72
|
+
```ruby
|
73
|
+
user.update!(name: "Mika Slayton")
|
74
|
+
snapcher = user.scannings.last
|
75
|
+
snapcher.action # => "update"
|
76
|
+
snapcher.before_params # => "Gillian Seed"
|
77
|
+
snapcher.after_params # => "Mika Slayton"
|
78
|
+
```
|
data/lib/snapcher/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,30 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snapcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryosk7
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
description: Save snapshot of DB columns.
|
11
|
+
date: 2023-10-24 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |
|
14
|
+
Snapcher is an ORM extension that logs changes to specific columns to your model.
|
15
|
+
When a change is made to a specific column, the difference between before and after the change is obtained and saved.
|
16
|
+
To make it easier for analysts, save the table name, column name, and data before and after changes as separate columns.
|
28
17
|
email:
|
29
18
|
- uchiryo7@gmail.com
|
30
19
|
executables: []
|
@@ -50,6 +39,7 @@ files:
|
|
50
39
|
- lib/snapcher/scanning.rb
|
51
40
|
- lib/snapcher/sweeper.rb
|
52
41
|
- lib/snapcher/version.rb
|
42
|
+
- logo/snapcher_logo.png
|
53
43
|
- sample-app/.dockerignore
|
54
44
|
- sample-app/.gitattributes
|
55
45
|
- sample-app/.gitignore
|
@@ -136,5 +126,6 @@ requirements: []
|
|
136
126
|
rubygems_version: 3.4.10
|
137
127
|
signing_key:
|
138
128
|
specification_version: 4
|
139
|
-
summary:
|
129
|
+
summary: Snapcher is an ORM extension that logs changes to specific columns to your
|
130
|
+
model.
|
140
131
|
test_files: []
|