acts_as_trackable 0.1.0 → 0.2.0

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: a700b0c0fba945f6c9876467d413d0600f0a2ab74d99972056dfe927748db138
4
- data.tar.gz: 9418887b082a2b132aeccd35141195399199b9ad434cbe89deaaeb29504a4e78
3
+ metadata.gz: c82b4e1be672e8ac1b66d36a51e990aef0f8e68cdc53afa1621943cbcd68251a
4
+ data.tar.gz: 2f6da86a1762b29af12af1fda72142a76d1ae14b32b7d212283e34a1de80f5d3
5
5
  SHA512:
6
- metadata.gz: a1f834409c983cd6edec2afa8f15fcd6d1d1d18d918aba0b00d7fa75c5d31c04d4404903b4980256d31882a3b9a8c6bcdc268f3665029b2c83c09dcc9b03e401
7
- data.tar.gz: 0f0c6826c985e4b8de63c2144d2971a6aac46ffb32d1202623e55cefa4e9fa1091358770d60a36254b78bdc1d705be11ece697c3b19c2ae25981596b3d1cb2b5
6
+ metadata.gz: 4338160a7818f83e063965fc3a9bc824c1be37806dcbc8fc515786ebbd1c3b0b8cf0cf85473d9300c7b50fdce0f54d9cd1c3acdf3c9308ebe1d9267c64182055
7
+ data.tar.gz: 4ceecf348a819f9a50a76c5877b6be5516e6d5b647bae8fe68c1cca042d2278668a605e3436d23f60f1f5a957f723fb2396f8ea16c6c1940de1bdb988f294363
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.2
1
+ 3.1.2
data/Gemfile CHANGED
@@ -1,10 +1,11 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
- gem 'activerecord', '~> 6.1', '>= 6.1.7.10'
5
- gem 'activesupport', '~> 6.1', '>= 6.1.7.10'
6
- gem 'rake', '~> 13.2.1'
4
+ gem 'activerecord', '~> 7.2', '>= 7.2.2'
5
+ gem 'activesupport', '~> 7.2', '>= 7.2.2'
6
+ gem 'nokogiri', '~> 1.16', '>= 1.16.7'
7
+ gem 'rake', '~> 13.2', '>= 13.2.1'
7
8
 
8
9
  group :test do
9
- gem 'sqlite3', '~> 1.6.8'
10
+ gem 'sqlite3', '~> 2.2'
10
11
  end
data/Gemfile.lock CHANGED
@@ -1,57 +1,83 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acts_as_trackable (0.1.0)
4
+ acts_as_trackable (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actionpack (6.1.7.10)
10
- actionview (= 6.1.7.10)
11
- activesupport (= 6.1.7.10)
12
- rack (~> 2.0, >= 2.0.9)
9
+ actionpack (7.2.2)
10
+ actionview (= 7.2.2)
11
+ activesupport (= 7.2.2)
12
+ nokogiri (>= 1.8.5)
13
+ racc
14
+ rack (>= 2.2.4, < 3.2)
15
+ rack-session (>= 1.0.1)
13
16
  rack-test (>= 0.6.3)
14
- rails-dom-testing (~> 2.0)
15
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
16
- actionview (6.1.7.10)
17
- activesupport (= 6.1.7.10)
17
+ rails-dom-testing (~> 2.2)
18
+ rails-html-sanitizer (~> 1.6)
19
+ useragent (~> 0.16)
20
+ actionview (7.2.2)
21
+ activesupport (= 7.2.2)
18
22
  builder (~> 3.1)
19
- erubi (~> 1.4)
20
- rails-dom-testing (~> 2.0)
21
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
22
- activemodel (6.1.7.10)
23
- activesupport (= 6.1.7.10)
24
- activerecord (6.1.7.10)
25
- activemodel (= 6.1.7.10)
26
- activesupport (= 6.1.7.10)
27
- activesupport (6.1.7.10)
28
- concurrent-ruby (~> 1.0, >= 1.0.2)
23
+ erubi (~> 1.11)
24
+ rails-dom-testing (~> 2.2)
25
+ rails-html-sanitizer (~> 1.6)
26
+ activemodel (7.2.2)
27
+ activesupport (= 7.2.2)
28
+ activerecord (7.2.2)
29
+ activemodel (= 7.2.2)
30
+ activesupport (= 7.2.2)
31
+ timeout (>= 0.4.0)
32
+ activesupport (7.2.2)
33
+ base64
34
+ benchmark (>= 0.3)
35
+ bigdecimal
36
+ concurrent-ruby (~> 1.0, >= 1.3.1)
37
+ connection_pool (>= 2.2.5)
38
+ drb
29
39
  i18n (>= 1.6, < 2)
40
+ logger (>= 1.4.2)
30
41
  minitest (>= 5.1)
31
- tzinfo (~> 2.0)
32
- zeitwerk (~> 2.3)
42
+ securerandom (>= 0.3)
43
+ tzinfo (~> 2.0, >= 2.0.5)
44
+ base64 (0.2.0)
45
+ benchmark (0.4.0)
46
+ bigdecimal (3.1.8)
33
47
  builder (3.3.0)
34
48
  concurrent-ruby (1.3.4)
49
+ connection_pool (2.4.1)
35
50
  crass (1.0.6)
51
+ drb (2.2.1)
36
52
  erubi (1.13.0)
37
53
  generator_spec (0.10.0)
38
54
  activesupport (>= 3.0.0)
39
55
  railties (>= 3.0.0)
40
56
  i18n (1.14.6)
41
57
  concurrent-ruby (~> 1.0)
58
+ io-console (0.7.2)
59
+ irb (1.14.1)
60
+ rdoc (>= 4.0.0)
61
+ reline (>= 0.4.2)
62
+ logger (1.6.1)
42
63
  loofah (2.23.1)
43
64
  crass (~> 1.0.2)
44
65
  nokogiri (>= 1.12.0)
45
- method_source (1.1.0)
46
- mini_portile2 (2.8.8)
47
66
  minitest (5.25.1)
48
- nokogiri (1.15.6)
49
- mini_portile2 (~> 2.8.2)
67
+ nokogiri (1.16.7-arm64-darwin)
50
68
  racc (~> 1.4)
69
+ nokogiri (1.16.7-x86_64-darwin)
70
+ racc (~> 1.4)
71
+ psych (5.2.0)
72
+ stringio
51
73
  racc (1.8.1)
52
- rack (2.2.10)
74
+ rack (3.1.8)
75
+ rack-session (2.0.0)
76
+ rack (>= 3.0.0)
53
77
  rack-test (2.1.0)
54
78
  rack (>= 1.3)
79
+ rackup (2.2.1)
80
+ rack (>= 3)
55
81
  rails-dom-testing (2.2.0)
56
82
  activesupport (>= 5.0.0)
57
83
  minitest
@@ -59,30 +85,42 @@ GEM
59
85
  rails-html-sanitizer (1.6.0)
60
86
  loofah (~> 2.21)
61
87
  nokogiri (~> 1.14)
62
- railties (6.1.7.10)
63
- actionpack (= 6.1.7.10)
64
- activesupport (= 6.1.7.10)
65
- method_source
88
+ railties (7.2.2)
89
+ actionpack (= 7.2.2)
90
+ activesupport (= 7.2.2)
91
+ irb (~> 1.13)
92
+ rackup (>= 1.0.0)
66
93
  rake (>= 12.2)
67
- thor (~> 1.0)
94
+ thor (~> 1.0, >= 1.2.2)
95
+ zeitwerk (~> 2.6)
68
96
  rake (13.2.1)
69
- sqlite3 (1.6.9)
70
- mini_portile2 (~> 2.8.0)
97
+ rdoc (6.7.0)
98
+ psych (>= 4.0.0)
99
+ reline (0.5.11)
100
+ io-console (~> 0.5)
101
+ securerandom (0.3.2)
102
+ sqlite3 (2.2.0-arm64-darwin)
103
+ sqlite3 (2.2.0-x86_64-darwin)
104
+ stringio (3.1.2)
71
105
  thor (1.3.2)
106
+ timeout (0.4.2)
72
107
  tzinfo (2.0.6)
73
108
  concurrent-ruby (~> 1.0)
109
+ useragent (0.16.10)
74
110
  zeitwerk (2.6.18)
75
111
 
76
112
  PLATFORMS
77
- ruby
113
+ arm64-darwin
114
+ x86_64-darwin
78
115
 
79
116
  DEPENDENCIES
80
- activerecord (~> 6.1, >= 6.1.7.10)
81
- activesupport (~> 6.1, >= 6.1.7.10)
117
+ activerecord (~> 7.2, >= 7.2.2)
118
+ activesupport (~> 7.2, >= 7.2.2)
82
119
  acts_as_trackable!
83
120
  generator_spec
84
- rake (~> 13.2.1)
85
- sqlite3 (~> 1.6.8)
121
+ nokogiri (~> 1.16, >= 1.16.7)
122
+ rake (~> 13.2, >= 13.2.1)
123
+ sqlite3 (~> 2.2)
86
124
 
87
125
  BUNDLED WITH
88
- 2.1.4
126
+ 2.5.19
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <!-- [![Gem Version](https://badge.fury.io/rb/acts_as_trackable.svg)](https://badge.fury.io/rb/acts_as_trackable) -->
1
+ [![Gem Version](https://badge.fury.io/rb/acts_as_trackable.svg)](https://badge.fury.io/rb/acts_as_trackable)
2
2
 
3
3
  # ActsAsTrackable
4
4
 
@@ -6,10 +6,10 @@ ActsAsTrackable is a gem that simplifies the process of tracking your DB object'
6
6
 
7
7
  ## Installation
8
8
 
9
- Add this line to your application's Gemfile(For now you have to add it locally v0.1.0):
9
+ Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'acts_as_trackable', path: 'path_to_gem'
12
+ gem 'acts_as_trackable'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -35,7 +35,7 @@ After that run the following commands:
35
35
  acts_as_trackable
36
36
  ```
37
37
 
38
- - If your model is expected to have multiple version of each object, pass the column that tracks the version to acts_as_trackable as a symbol, acts_as_trackable is smart enough to relink the object_activity with the latest version(Previous versions won't be linked to any activity):
38
+ - If your model is expected to have multiple versions of each object, pass the column that tracks the version to acts_as_trackable as a symbol, acts_as_trackable is smart enough to relink the object_activity with the latest version(Previous versions won't be linked to any activity):
39
39
 
40
40
  ```ruby
41
41
  acts_as_trackable :latest_x_version_id
@@ -51,10 +51,23 @@ After that run the following commands:
51
51
  ```
52
52
 
53
53
 
54
- - Joining your records with objects_activities:
54
+ - Joining your records with objects_activities for Sorting, Searching, and Filtering:
55
55
  ```ruby
56
56
  @records.left_joins_object_activities(['YourUserModelClassName'])
57
57
  ```
58
+
59
+
60
+ - Fetching an object's owners/modifiers:
61
+ ```ruby
62
+ @record.created_by
63
+ @record.updated_by
64
+ ```
65
+
66
+ - Fetching object_activities created/updated by user:
67
+ ```ruby
68
+ @user.object_activities_as_creator
69
+ @user.object_activities_as_updater
70
+ ```
58
71
  ## Development
59
72
 
60
73
  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.
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.email = ['a.keewan@zenhr.com']
8
8
  spec.homepage = 'https://www.zenhr.com'
9
9
  spec.license = 'MIT'
10
- spec.required_ruby_version = Gem::Requirement.new('>= 2.7.2')
10
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.1.2')
11
11
  spec.metadata["homepage_uri"] = spec.homepage
12
12
  spec.metadata["source_code_uri"] = 'https://github.com/a-keewan/acts_as_trackable'
13
13
  spec.metadata["changelog_uri"] = 'https://github.com/a-keewan/acts_as_trackable/blob/master/changelog.md'
data/changelog.md ADDED
@@ -0,0 +1,11 @@
1
+ # acts_as_trackable Changelog
2
+
3
+ ## Version: 0.2.0
4
+ ### Patch
5
+ - Upgraded all used dependencies to patch https://github.com/advisories/GHSA-vv62-jfwq-693v mainly caused by using nokogiri
6
+ - Increased required_ruby_version to >= 3.1.2
7
+ ## Version: 0.1.1
8
+ ### Fix:
9
+ - Replaced user_type.downcase with user_type.underscore to support joining with user classes consisting of more than word.
10
+ - Added how-to access objects steps to the README file.
11
+ ## Version: 0.1.0
@@ -23,8 +23,8 @@ module Trackable
23
23
  }
24
24
 
25
25
  def self.left_join_users(action, user_type)
26
- "LEFT JOIN #{user_type.downcase.pluralize} AS #{action}_#{user_type.downcase.pluralize} " \
27
- "ON #{action}_#{user_type.downcase.pluralize}.id = object_activities.#{action}_id " \
26
+ "LEFT JOIN #{user_type.underscore.pluralize} AS #{action}_#{user_type.underscore.pluralize} " \
27
+ "ON #{action}_#{user_type.underscore.pluralize}.id = object_activities.#{action}_id " \
28
28
  "AND object_activities.#{action}_type = '#{user_type}'"
29
29
  end
30
30
 
@@ -1,3 +1,3 @@
1
1
  module ActsAsTrackable
2
- VERSION = "0.1.0"
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_trackable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmad Keewan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-11-17 00:00:00.000000000 Z
12
+ date: 2024-11-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: generator_spec
@@ -51,6 +51,7 @@ files:
51
51
  - acts_as_trackable.gemspec
52
52
  - bin/console
53
53
  - bin/setup
54
+ - changelog.md
54
55
  - lib/acts_as_trackable.rb
55
56
  - lib/acts_as_trackable/modifier.rb
56
57
  - lib/acts_as_trackable/trackable.rb
@@ -73,14 +74,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
74
  requirements:
74
75
  - - ">="
75
76
  - !ruby/object:Gem::Version
76
- version: 2.7.2
77
+ version: 3.1.2
77
78
  required_rubygems_version: !ruby/object:Gem::Requirement
78
79
  requirements:
79
80
  - - ">="
80
81
  - !ruby/object:Gem::Version
81
82
  version: '0'
82
83
  requirements: []
83
- rubygems_version: 3.1.4
84
+ rubygems_version: 3.3.7
84
85
  signing_key:
85
86
  specification_version: 4
86
87
  summary: ActsAsTrackable is a RoR gem that simplifies tracking the creation and modification