snapcher 0.1.1 → 0.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: ae3088224fb3c2293582c866c7c18c99b825ab26ae51a2a04cf7953561a89fca
4
- data.tar.gz: 3ee807d9b9c5d492faac21d55075375428844529c618a23048abd5f2266e45c0
3
+ metadata.gz: cf06ee5a1a0a2a88b36aaf158a7968e6e43e076d48c5109312f299b00dd84f75
4
+ data.tar.gz: 0005bf88e3a4e16762aec1ba059a327bdb2c5e01e97f9727a5a4ac60db1abf42
5
5
  SHA512:
6
- metadata.gz: 0adf58e67edcc55b01d4532aad99d852ab422b6e5f2188fefe905033486686af54e962ed1f555adc6541ca040b0af8cf52de18d446e95fcf00d50e0a9f426fad
7
- data.tar.gz: 11b68211feff574a498ade576614adec9be7f8d63aa816f05a4f0163f015158ea88feb3d49f7948a49f74c70c549d475783a2e5ea7a6bd2307e39c2d23e8bf7b
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.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.1)
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
+ ![snapcher_logo](https://github.com/ryosk7/snapcher/blob/0-1-2/logo/snapcher_logo.png?raw=true)
2
+
3
+ ----------
4
+
1
5
  # Snapcher
6
+ [![Gem Version](https://img.shields.io/gem/v/snapcher.svg)](http://rubygems.org/gems/snapcher)
7
+ ![GitHub](https://img.shields.io/github/license/ryosk7/snapcher)
8
+ =======
2
9
 
3
- TODO: Delete this and the text below, and describe your gem
10
+ **Snapcher** is an ORM extension that logs changes to specific columns to your model.
4
11
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/snapcher`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- ## Installation
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
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
16
+ ## Supported
10
17
 
11
- Install the gem and add to the application's Gemfile by executing:
18
+ ### Snapcher supports Ruby versions:
12
19
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
20
+ * 3.1
21
+ * 3.2
14
22
 
15
- If bundler is not being used to manage dependencies, install the gem by executing:
23
+ ### Snapcher supports Rails versions:
16
24
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
25
+ * 7.0
26
+ * 7.1
18
27
 
19
- ## Usage
28
+ ## Supported ORMs
29
+
30
+ Snapcher is currently ActiveRecord-only.
20
31
 
21
- TODO: Write usage instructions here
32
+ ## Installation
33
+
34
+ Add the gem to your Gemfile:
35
+
36
+ ```ruby
37
+ gem "snapcher"
38
+ ```
22
39
 
23
- ## Development
40
+ Then, from your Rails app directory, create the `scannings` table:
24
41
 
25
- 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
+ ```bash
43
+ $ rails generate snapcher:install
44
+ $ rails db:migrate
45
+ ```
46
+
47
+ ## Usage
26
48
 
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
49
+ Simply call `scanning` on your models.
28
50
 
29
- ## Contributing
51
+ Use `column_name:` to select the column you want to log.
30
52
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/snapcher. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/snapcher/blob/main/CODE_OF_CONDUCT.md).
53
+ ```ruby
54
+ class User < ActiveRecord::Base
55
+ scanning column_name: "name"
56
+ end
57
+ ```
32
58
 
33
- ## License
59
+ By default, whenever a user is created, updated or destroyed, a new scanning is created.
34
60
 
35
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
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
- ## Code of Conduct
70
+ Scanning contain information regarding what action was taken on the model and what changes were made.
38
71
 
39
- Everyone interacting in the Snapcher project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/snapcher/blob/main/CODE_OF_CONDUCT.md).
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
+ ```
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Snapcher
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
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.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-23 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: appraisal
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
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: Save snapshot of DB columns.
129
+ summary: Snapcher is an ORM extension that logs changes to specific columns to your
130
+ model.
140
131
  test_files: []