logisticed 0.1.0 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3c3fe85b4c2c2975df8b5cd4870b555b85871a27b1599bde1e11a5139a039b8
4
- data.tar.gz: 4ada53766738c01f2acc507e0ad3dad86b0e074b9f032d157dd2992205220cfc
3
+ metadata.gz: 169a9a12d30c45dbe38f4afa074a1a7d62cfd5f3c3116b7826fb83e83b5c1c5c
4
+ data.tar.gz: 5e16c9708ba8580c4b6864051b598d61dfb42eccd46c5b23f047b5fdc8ace0ab
5
5
  SHA512:
6
- metadata.gz: 38f274ccd8522f277a272f1b3c0c45cdcc4b1e2ec9bfbf02241ce887f395049fa41b2a42c4358cf8122126e3008017b2f9224ec4e625db9e4550a2400678a766
7
- data.tar.gz: 5c5ae24ab9b8572cfffa83b28e5c039e6c9085158899e052f7c4b8c6d1b3b40ade8af3cc9245c9c3c2a4d6d9f775d09a002f158f17b42d02b2054ed3ed7755cb
6
+ metadata.gz: fcfdde7d954008ea410ccc98040c9fa83ab58f1cdd4ead30a4e727c48896788727bf47d30bcf2d87c80150a187f656dd85f8d1684d345f0c90d2b58064377f19
7
+ data.tar.gz: 1bf730d7ccd5c58e753096717cd69b54f449b2975c0014a5d37c9b5776188929eff9bd5a4a86a5cbfcbdc8087fca35674d07c70835317136da483994676b7673
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- logisticed (0.1.0)
4
+ logisticed (1.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -16,4 +16,4 @@ DEPENDENCIES
16
16
  rake (~> 12.0)
17
17
 
18
18
  BUNDLED WITH
19
- 2.1.4
19
+ 2.2.22
data/README.md CHANGED
@@ -30,20 +30,20 @@ end
30
30
  ```ruby
31
31
  class Page < ActiveRecord::Base
32
32
  enum status: [:draft, :active, :archived]
33
- logisticed :status, only: [:active, :archived]
33
+ logisticed :status, only: [:active, :archived]
34
34
  end
35
35
  ```
36
36
 
37
37
  现在就已经可以监听所有的操作人和操作时间等信息了
38
38
  ```ruby
39
39
  class PagesController < ApplicationController
40
- def create
41
- current_user # => #<User name: 'sss'>
42
- @page = Page.first # => #<Page status: 'draft'>
43
- @page.active!
44
- @active_at # => 2021-01-22 17:15:13 +0800
45
- @active_by # => #<User name: 'sss'>
46
- end
40
+ def create
41
+ current_user # => #<User name: 'sss'>
42
+ @page = Page.first # => #<Page status: 'draft'>
43
+ @page.active!
44
+ @page.active_at # => 2021-01-22 17:15:13 +0800
45
+ @page.active_by # => #<User name: 'sss'>
46
+ end
47
47
  end
48
48
  ```
49
49
 
@@ -53,16 +53,16 @@ end
53
53
 
54
54
  ```ruby
55
55
  class PagesController < ApplicationController
56
- def create
57
- current_user # => #<User name: 'sss'>
58
- user = User.last # => #<User name: 'smx'>
59
- Logisticed::Logistic.as_user(user) do
60
- @page = Page.first # => #<Page status: 'draft'>
61
- @page.active!
62
- @active_at # => 2021-01-22 17:15:13 +0800
63
- @active_by # => #<User name: 'smx'>
64
- end
65
- end
56
+ def create
57
+ current_user # => #<User name: 'sss'>
58
+ user = User.last # => #<User name: 'smx'>
59
+ Logisticed::Logistic.as_user(user) do
60
+ @page = Page.first # => #<Page status: 'draft'>
61
+ @page.active!
62
+ @page.active_at # => 2021-01-22 17:15:13 +0800
63
+ @page.active_by # => #<User name: 'smx'>
64
+ end
65
+ end
66
66
  end
67
67
  ```
68
68
  # setting
@@ -71,9 +71,9 @@ end
71
71
  # config/initializers/logisticed.rb
72
72
 
73
73
  Logisticed.config do |config|
74
- config.current_user_method = :authenticated_user
75
- # if your table primary_key type is uuid
76
- config.logisticed_source_id_column_type = :uuid
77
- config.logisticed_operator_id_column_type = :uuid
74
+ config.current_user_method = :authenticated_user
75
+ # if your table primary_key type is uuid
76
+ config.logisticed_source_id_column_type = :uuid
77
+ config.logisticed_operator_id_column_type = :uuid
78
78
  end
79
79
  ```
@@ -2,7 +2,7 @@ module Logisticed
2
2
  class Logistic < ::ActiveRecord::Base
3
3
  belongs_to :source, polymorphic: true
4
4
  belongs_to :operator, polymorphic: true
5
- before_create :set_logistic_user
5
+ before_create :set_logistic_user, :set_request_info
6
6
 
7
7
  def self.as_user(user)
8
8
  last_logisticed_user = ::Logisticed.store[:logisticed_user]
@@ -19,5 +19,10 @@ module Logisticed
19
19
  self.operator ||= ::Logisticed.store[:current_user].try!(:call) # from Sweeper
20
20
  nil # prevent stopping callback chains
21
21
  end
22
+
23
+ def set_request_info
24
+ self.remote_ip = ::Logisticed.store[:current_remote_address]
25
+ self.request_uuid = ::Logisticed.store[:current_request_uuid]
26
+ end
22
27
  end
23
28
  end
@@ -1,3 +1,3 @@
1
1
  module Logisticed
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logisticed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sumingxuan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-22 00:00:00.000000000 Z
11
+ date: 2022-08-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 轻松的管理你的业务变更的操作人和操作时间
14
14
  email:
@@ -36,7 +36,7 @@ homepage: https://github.com/SuMingXuan/logisticed
36
36
  licenses: []
37
37
  metadata:
38
38
  homepage_uri: https://github.com/SuMingXuan/logisticed
39
- post_install_message:
39
+ post_install_message:
40
40
  rdoc_options: []
41
41
  require_paths:
42
42
  - lib
@@ -51,8 +51,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0'
53
53
  requirements: []
54
- rubygems_version: 3.0.8
55
- signing_key:
54
+ rubygems_version: 3.2.22
55
+ signing_key:
56
56
  specification_version: 4
57
57
  summary: simple manage business change datas
58
58
  test_files: []