random-rails 1.0.2 → 1.0.4

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: 353a1c5d2a49d22d293032ea70253cb1bf711173c01fab5f6d528a0c3ed2661a
4
- data.tar.gz: 864bb5abd310a796055a5d3a0f3648ad01a2115f8e1eedd9b8be09819b430f72
3
+ metadata.gz: 8476fa987466053c3b50f4c4fe306756c3c660ce43f5551c5f831423b4c25e42
4
+ data.tar.gz: 26a3c31572e1d962d465c591e4b88b3971f2ce0cad375ed85ee6c99b86fb92aa
5
5
  SHA512:
6
- metadata.gz: 8a939b36e74e9bb6904544089ad7f16ab3adb546755b0736ff56e4fdbd47f39213b8914b3c77f25316dd76f8df4b17baed3f7a8b822702aa96234c86621f9867
7
- data.tar.gz: ddb9675cbca82dd3602272c991c194aef7034e564760cec346e0e3563bad0309d9f0d6e06165d5dcd0e5848063205429ef32ddb2189843dac475d9882cb4ccd8
6
+ metadata.gz: 71d4340bc71598c274ca8aea8cff875614750acca0c43c742bc4e8dded44634bb5a75ddef9ad5870cea0d9cdddd97731d22fcd78a7688834c3f6fbe1d005be35
7
+ data.tar.gz: 1d06cfcbaac8d6dba749706a58dec7a3afebd6674fdb5dccbacf25a98683721b208636170430b3888b852252656be5b101bdfa9d0daa744f434cd52282300596
data/.rubocop/rspec.yml CHANGED
@@ -44,9 +44,3 @@ RSpec/MissingExampleGroupArgument:
44
44
 
45
45
  RSpec/ReceiveCounts:
46
46
  Enabled: true
47
-
48
- FactoryBot/AttributeDefinedStatically:
49
- Enabled: true
50
-
51
- FactoryBot/CreateList:
52
- Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ ## [1.0.4] - 2026-02-26
2
+
3
+ ### Maintenance Release - Removed versions lock for rails 8.1 and higher
4
+
5
+ - Removed lock on rails 8.0 and lower for `activerecord`, now it's available for all versions of rails
6
+ - Removed lock on rails 8.0 and lower for activesupport, now it's available for all versions of rails
7
+
8
+ ## [1.0.3] - 2025-10-07
9
+
10
+ ### Maintenance Release - RuboCop & Dependency Updates
11
+
12
+ #### Fixed
13
+
14
+ - **RuboCop configuration**: Fixed configuration syntax by replacing `require:` with `plugins:` in RuboCop configuration files to follow the correct plugin loading mechanism
15
+ - **ActiveSupport loading**: Optimized ActiveSupport loading by using `lazy_load_hooks` instead of loading the entire core extensions
16
+
17
+ #### Changed
18
+
19
+ - **Dependency updates**:
20
+ - Updated RuboCop from ~> 1.52 to ~> 1.80
21
+ - Updated Standard from ~> 1.3 to ~> 1.51
22
+ - Updated rubocop-rspec from ~> 2.22 to ~> 3.7
23
+ - Updated rubocop-performance to ~> 1.25.0
24
+ - Added mutex_m and bigdecimal as development dependencies
25
+
26
+ #### Technical Improvements
27
+
28
+ - Improved RuboCop plugin configuration for better linting
29
+ - More efficient ActiveSupport loading to reduce memory footprint
30
+ - Updated development tooling for better code quality enforcement
31
+
1
32
  ## [1.0.2] - 2025-10-06
2
33
 
3
34
  ### Maintenance Release - Code Quality & CI Improvements
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- random-rails (1.0.2)
5
- activerecord (>= 4.0, < 8.1)
6
- activesupport (>= 6.1.5, < 8.1)
4
+ random-rails (1.0.4)
5
+ activerecord (>= 4.0)
6
+ activesupport (>= 6.1.5)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -18,7 +18,8 @@ GEM
18
18
  i18n (>= 1.6, < 2)
19
19
  minitest (>= 5.1)
20
20
  tzinfo (~> 2.0)
21
- ast (2.4.2)
21
+ ast (2.4.3)
22
+ bigdecimal (3.2.3)
22
23
  coderay (1.1.3)
23
24
  concurrent-ruby (1.2.2)
24
25
  diff-lcs (1.5.0)
@@ -27,26 +28,28 @@ GEM
27
28
  i18n (>= 1.8.11, < 2)
28
29
  i18n (1.14.1)
29
30
  concurrent-ruby (~> 1.0)
30
- json (2.6.3)
31
- language_server-protocol (3.17.0.3)
31
+ json (2.15.0)
32
+ language_server-protocol (3.17.0.5)
32
33
  lint_roller (1.1.0)
33
34
  method_source (1.0.0)
34
35
  mini_portile2 (2.8.9)
35
36
  minitest (5.18.1)
37
+ mutex_m (0.3.0)
36
38
  mysql2 (0.5.5)
37
- parallel (1.23.0)
38
- parser (3.2.2.3)
39
+ parallel (1.27.0)
40
+ parser (3.3.9.0)
39
41
  ast (~> 2.4.1)
40
42
  racc
41
43
  pg (1.5.3)
44
+ prism (1.5.1)
42
45
  pry (0.14.2)
43
46
  coderay (~> 1.1)
44
47
  method_source (~> 1.0)
45
- racc (1.7.1)
48
+ racc (1.8.1)
46
49
  rainbow (3.1.1)
47
50
  rake (13.0.6)
48
- regexp_parser (2.8.1)
49
- rexml (3.2.5)
51
+ regexp_parser (2.11.3)
52
+ rexml (3.4.4)
50
53
  rspec (3.12.0)
51
54
  rspec-core (~> 3.12.0)
52
55
  rspec-expectations (~> 3.12.0)
@@ -60,29 +63,25 @@ GEM
60
63
  diff-lcs (>= 1.2.0, < 2.0)
61
64
  rspec-support (~> 3.12.0)
62
65
  rspec-support (3.12.1)
63
- rubocop (1.52.1)
66
+ rubocop (1.64.1)
64
67
  json (~> 2.3)
68
+ language_server-protocol (>= 3.17.0)
65
69
  parallel (~> 1.10)
66
- parser (>= 3.2.2.3)
70
+ parser (>= 3.3.0.2)
67
71
  rainbow (>= 2.2.2, < 4.0)
68
72
  regexp_parser (>= 1.8, < 3.0)
69
73
  rexml (>= 3.2.5, < 4.0)
70
- rubocop-ast (>= 1.28.0, < 2.0)
74
+ rubocop-ast (>= 1.31.1, < 2.0)
71
75
  ruby-progressbar (~> 1.7)
72
76
  unicode-display_width (>= 2.4.0, < 3.0)
73
- rubocop-ast (1.29.0)
74
- parser (>= 3.2.1.0)
75
- rubocop-capybara (2.18.0)
76
- rubocop (~> 1.41)
77
- rubocop-factory_bot (2.23.1)
78
- rubocop (~> 1.33)
79
- rubocop-performance (1.18.0)
80
- rubocop (>= 1.7.0, < 2.0)
81
- rubocop-ast (>= 0.4.0)
82
- rubocop-rspec (2.22.0)
83
- rubocop (~> 1.33)
84
- rubocop-capybara (~> 2.17)
85
- rubocop-factory_bot (~> 2.22)
77
+ rubocop-ast (1.47.1)
78
+ parser (>= 3.3.7.2)
79
+ prism (~> 1.4)
80
+ rubocop-performance (1.21.1)
81
+ rubocop (>= 1.48.1, < 2.0)
82
+ rubocop-ast (>= 1.31.1, < 2.0)
83
+ rubocop-rspec (3.0.0)
84
+ rubocop (~> 1.40)
86
85
  ruby-progressbar (1.13.0)
87
86
  simplecov (0.22.0)
88
87
  docile (~> 1.1)
@@ -92,21 +91,21 @@ GEM
92
91
  simplecov_json_formatter (0.1.4)
93
92
  sqlite3 (1.6.3)
94
93
  mini_portile2 (~> 2.8.0)
95
- standard (1.30.1)
94
+ standard (1.37.0)
96
95
  language_server-protocol (~> 3.17.0.2)
97
96
  lint_roller (~> 1.0)
98
- rubocop (~> 1.52.0)
97
+ rubocop (~> 1.64.0)
99
98
  standard-custom (~> 1.0.0)
100
- standard-performance (~> 1.1.0)
99
+ standard-performance (~> 1.4)
101
100
  standard-custom (1.0.2)
102
101
  lint_roller (~> 1.0)
103
102
  rubocop (~> 1.50)
104
- standard-performance (1.1.1)
103
+ standard-performance (1.4.0)
105
104
  lint_roller (~> 1.1)
106
- rubocop-performance (~> 1.18.0)
105
+ rubocop-performance (~> 1.21.0)
107
106
  tzinfo (2.0.6)
108
107
  concurrent-ruby (~> 1.0)
109
- unicode-display_width (2.4.2)
108
+ unicode-display_width (2.6.0)
110
109
 
111
110
  PLATFORMS
112
111
  arm64-darwin-21
@@ -114,19 +113,22 @@ PLATFORMS
114
113
  x86_64-linux
115
114
 
116
115
  DEPENDENCIES
116
+ bigdecimal
117
117
  faker (~> 3.2)
118
+ mutex_m
118
119
  mysql2 (~> 0.5.5)
119
120
  pg (~> 1.5)
120
121
  pry (~> 0.14.2)
121
122
  rake (~> 13.0)
122
123
  random-rails!
123
124
  rspec (~> 3.0)
124
- rubocop (~> 1.52)
125
- rubocop-performance (~> 1.18)
126
- rubocop-rspec (~> 2.22)
125
+ rubocop (~> 1.64.0)
126
+ rubocop-performance (~> 1.21.0)
127
+ rubocop-rspec (~> 3.0.0)
127
128
  simplecov (~> 0.22.0)
128
129
  sqlite3 (~> 1.6)
129
- standard (~> 1.3)
130
+ standard (~> 1.37.0)
131
+ standard-performance (~> 1.4.0)
130
132
 
131
133
  BUNDLED WITH
132
134
  2.4.13
data/README.md CHANGED
@@ -1,7 +1,11 @@
1
1
  [![lint](https://github.com/the-rubies-way/random-rails/actions/workflows/linter.yml/badge.svg)](https://github.com/the-rubies-way/random-rails/actions/workflows/linter.yml)
2
2
  [![test](https://github.com/the-rubies-way/random-rails/actions/workflows/test.yml/badge.svg)](https://github.com/the-rubies-way/random-rails/actions/workflows/test.yml)
3
- [![Listed on OpenSource-Heroes.com](https://opensource-heroes.com/badge-v1.svg)](https://opensource-heroes.com/r/the-rubies-way/random-rails)
3
+ [![Gem Version](https://img.shields.io/gem/v/random-rails)](https://rubygems.org/gems/random-rails)
4
4
 
5
+ <p align="center">
6
+ <img width="600" height="600" alt="Image Oct 9, 2025, 04_30_33" src="https://github.com/user-attachments/assets/cc522bff-2de6-41f3-b458-83867bf70b26" />
7
+ </p>
8
+
5
9
  # RandomRails
6
10
 
7
11
  🚀 The most performant way to get random records from ActiveRecord. Supports **PostgreSQL**, **MySQL**, and **SQLite** with intelligent strategy selection to replace slow `ORDER BY RANDOM()` queries.
@@ -26,6 +30,9 @@ Real-world benchmark results comparing RandomRails with traditional methods (10
26
30
  | 100,000 users | 31.578s | **3.6968s** | 369.4334s | **8.54x faster** |
27
31
  | 1,000,000 users | 171.497s | **5.3441s** | 373.6102s | **32.09x faster** |
28
32
 
33
+ <img width="1968" height="1180" alt="image" src="https://github.com/user-attachments/assets/3c395cfd-d28f-45d1-92f2-872075552782" />
34
+
35
+
29
36
  **Key Takeaways:**
30
37
 
31
38
  - RandomRails consistently outperforms `ORDER BY RANDOM()` by 2-32x
@@ -153,4 +160,4 @@ Everyone interacting in the ActiveRecord::Random project's codebases, issue trac
153
160
 
154
161
  ## Thanks for your support!
155
162
 
156
- [`<img width="100" alt="RailsJazz" src="https://avatars.githubusercontent.com/u/104008706?s=200">`](https://github.com/railsjazz)
163
+ [<img width="100" alt="RailsJazz" src="https://avatars.githubusercontent.com/u/104008706?s=200">](https://github.com/railsjazz)
@@ -1,5 +1,4 @@
1
- require "active_support"
2
- require "active_support/core_ext"
1
+ require "active_support/lazy_load_hooks"
3
2
 
4
3
  require "random-rails/adapters/active_record/base"
5
4
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RandomRails
4
- VERSION = "1.0.2"
4
+ VERSION = "1.0.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: random-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - loqimean
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-06 00:00:00.000000000 Z
11
+ date: 2026-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '8.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '4.0'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '8.1'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: activesupport
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -37,9 +31,6 @@ dependencies:
37
31
  - - ">="
38
32
  - !ruby/object:Gem::Version
39
33
  version: 6.1.5
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '8.1'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
@@ -47,9 +38,6 @@ dependencies:
47
38
  - - ">="
48
39
  - !ruby/object:Gem::Version
49
40
  version: 6.1.5
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '8.1'
53
41
  - !ruby/object:Gem::Dependency
54
42
  name: rspec
55
43
  requirement: !ruby/object:Gem::Requirement
@@ -70,56 +58,70 @@ dependencies:
70
58
  requirements:
71
59
  - - "~>"
72
60
  - !ruby/object:Gem::Version
73
- version: '2.22'
61
+ version: 3.0.0
74
62
  type: :development
75
63
  prerelease: false
76
64
  version_requirements: !ruby/object:Gem::Requirement
77
65
  requirements:
78
66
  - - "~>"
79
67
  - !ruby/object:Gem::Version
80
- version: '2.22'
68
+ version: 3.0.0
81
69
  - !ruby/object:Gem::Dependency
82
70
  name: standard
83
71
  requirement: !ruby/object:Gem::Requirement
84
72
  requirements:
85
73
  - - "~>"
86
74
  - !ruby/object:Gem::Version
87
- version: '1.3'
75
+ version: 1.37.0
88
76
  type: :development
89
77
  prerelease: false
90
78
  version_requirements: !ruby/object:Gem::Requirement
91
79
  requirements:
92
80
  - - "~>"
93
81
  - !ruby/object:Gem::Version
94
- version: '1.3'
82
+ version: 1.37.0
95
83
  - !ruby/object:Gem::Dependency
96
84
  name: rubocop
97
85
  requirement: !ruby/object:Gem::Requirement
98
86
  requirements:
99
87
  - - "~>"
100
88
  - !ruby/object:Gem::Version
101
- version: '1.52'
89
+ version: 1.64.0
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
93
  requirements:
106
94
  - - "~>"
107
95
  - !ruby/object:Gem::Version
108
- version: '1.52'
96
+ version: 1.64.0
109
97
  - !ruby/object:Gem::Dependency
110
98
  name: rubocop-performance
111
99
  requirement: !ruby/object:Gem::Requirement
112
100
  requirements:
113
101
  - - "~>"
114
102
  - !ruby/object:Gem::Version
115
- version: '1.18'
103
+ version: 1.21.0
116
104
  type: :development
117
105
  prerelease: false
118
106
  version_requirements: !ruby/object:Gem::Requirement
119
107
  requirements:
120
108
  - - "~>"
121
109
  - !ruby/object:Gem::Version
122
- version: '1.18'
110
+ version: 1.21.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: standard-performance
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.4.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.4.0
123
125
  - !ruby/object:Gem::Dependency
124
126
  name: simplecov
125
127
  requirement: !ruby/object:Gem::Requirement
@@ -204,6 +206,34 @@ dependencies:
204
206
  - - "~>"
205
207
  - !ruby/object:Gem::Version
206
208
  version: '3.2'
209
+ - !ruby/object:Gem::Dependency
210
+ name: mutex_m
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: bigdecimal
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
207
237
  description: The easiest way to get random records from database with best performance
208
238
  that you ever seen.
209
239
  email:
@@ -229,7 +259,6 @@ files:
229
259
  - lib/random-rails/adapters/active_record/base.rb
230
260
  - lib/random-rails/configuration.rb
231
261
  - lib/random-rails/version.rb
232
- - random-rails.gemspec
233
262
  - sig/random-rails/random.rbs
234
263
  homepage: https://github.com/the-rubies-way/random-rails
235
264
  licenses:
data/random-rails.gemspec DELETED
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $:.push File.expand_path("../lib", __FILE__)
4
- require "random-rails/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "random-rails"
8
- spec.version = RandomRails::VERSION
9
- spec.authors = ["loqimean"]
10
- spec.email = ["vanuha277@gmail.com"]
11
-
12
- spec.summary = "Awesome gem to get random records from database."
13
- spec.description = "The easiest way to get random records from database with best performance that you ever seen."
14
- spec.homepage = "https://github.com/the-rubies-way/random-rails"
15
- spec.license = "MIT"
16
- spec.required_ruby_version = ">= 2.6.0"
17
-
18
- spec.metadata["source_code_uri"] = spec.homepage
19
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
20
-
21
- # Specify which files should be added to the gem when it is released.
22
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
- spec.files = Dir.chdir(__dir__) do
24
- `git ls-files -z`.split("\x0").reject do |f|
25
- (File.expand_path(f) == __FILE__) || f.start_with?("bin/", "test/", "spec/", "features/", ".git", ".circleci", "appveyor")
26
- end
27
- end
28
- spec.bindir = "exe"
29
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
- spec.require_paths = ["lib"]
31
-
32
- # **********************************
33
- # * Dependencies
34
- spec.add_runtime_dependency "activerecord", ">= 4.0", "< 8.1"
35
- spec.add_runtime_dependency "activesupport", ">= 6.1.5", "< 8.1"
36
-
37
- spec.add_development_dependency "rspec", "~> 3.0"
38
- spec.add_development_dependency "rubocop-rspec", "~> 2.22"
39
- spec.add_development_dependency "standard", "~> 1.3"
40
- spec.add_development_dependency "rubocop", "~> 1.52"
41
- spec.add_development_dependency "rubocop-performance", "~> 1.18"
42
- spec.add_development_dependency "simplecov", "~> 0.22.0"
43
- spec.add_development_dependency "pry", "~> 0.14.2"
44
- spec.add_development_dependency "sqlite3", "~> 1.6"
45
- spec.add_development_dependency "pg", "~> 1.5"
46
- spec.add_development_dependency "mysql2", "~> 0.5.5"
47
- spec.add_development_dependency "faker", "~> 3.2"
48
-
49
- spec.post_install_message = <<~MSG
50
-
51
- ===================================================================
52
- Thanks for installing random-rails!
53
-
54
- => For usage examples and documentation, please visit:
55
- https://github.com/the-rubies-way/random-rails#examples
56
-
57
- => If you find this gem useful, please consider starring the repository:
58
- https://github.com/the-rubies-way/random-rails
59
- ===================================================================
60
-
61
- MSG
62
- end