type_balancer_rails 0.1.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 +7 -0
- data/.rubocop.yml +174 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +29 -0
- data/LICENSE.txt +21 -0
- data/README.md +96 -0
- data/Rakefile +12 -0
- data/lib/generators/type_balancer/install/install_generator.rb +19 -0
- data/lib/generators/type_balancer/install/templates/type_balancer.rb.erb +15 -0
- data/lib/type_balancer/rails/active_record_extension.rb +48 -0
- data/lib/type_balancer/rails/collection_methods.rb +59 -0
- data/lib/type_balancer/rails/railtie.rb +14 -0
- data/lib/type_balancer/rails/version.rb +7 -0
- data/lib/type_balancer/rails.rb +13 -0
- data/lib/type_balancer_rails.rb +10 -0
- data/type_balancer_rails.gemspec +39 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 71cdcd571a025f512e4aafd499454b169a1fc6e0dfad5ff44ee8c673d514b978
|
4
|
+
data.tar.gz: 510a9017cce97a0de216d4fff5b70126bb1fcf19b4feb599df6eb529fc8b7abc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b426fdb236f4d075ae34a4b9683123d2280099117e6343f71d0dd914431d85b38131054ee9cbeb32818b75ace84000595e29f1d874f6e0e79db5240cfb19ad33
|
7
|
+
data.tar.gz: 92bd9e81c3fdb370c404e53d522c5e56cbadc91306002729e1ece60ac50ac5ba75f1dc5d0d8a155434a27a11948974492110bf154693f9bee7997f286bfdbb9d
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
- rubocop-rails
|
4
|
+
- rubocop-capybara
|
5
|
+
- rubocop-factory_bot
|
6
|
+
|
7
|
+
AllCops:
|
8
|
+
TargetRubyVersion: 3.2
|
9
|
+
NewCops: enable
|
10
|
+
SuggestExtensions: false
|
11
|
+
Exclude:
|
12
|
+
- 'bin/**/*'
|
13
|
+
- 'tmp/**/*'
|
14
|
+
- 'vendor/**/*'
|
15
|
+
- 'log/**/*'
|
16
|
+
- 'node_modules/**/*'
|
17
|
+
- 'db/schema.rb'
|
18
|
+
- 'db/migrate/*.rb'
|
19
|
+
- 'Gemfile.lock'
|
20
|
+
|
21
|
+
Style/Documentation:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/FrozenStringLiteralComment:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/StringLiterals:
|
28
|
+
EnforcedStyle: single_quotes
|
29
|
+
|
30
|
+
Style/SymbolArray:
|
31
|
+
EnforcedStyle: brackets
|
32
|
+
|
33
|
+
Style/WordArray:
|
34
|
+
EnforcedStyle: brackets
|
35
|
+
|
36
|
+
Metrics/MethodLength:
|
37
|
+
Max: 20
|
38
|
+
|
39
|
+
Metrics/AbcSize:
|
40
|
+
Max: 20
|
41
|
+
|
42
|
+
Metrics/ClassLength:
|
43
|
+
Max: 200
|
44
|
+
|
45
|
+
Metrics/ModuleLength:
|
46
|
+
Max: 200
|
47
|
+
|
48
|
+
RSpec/NestedGroups:
|
49
|
+
Max: 4
|
50
|
+
|
51
|
+
RSpec/MultipleExpectations:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
RSpec/MultipleMemoizedHelpers:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
RSpec/ExampleLength:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
RSpec/MessageSpies:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
RSpec/VerifiedDoubles:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
RSpec/MessageChain:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
RSpec/NoExpectationExample:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
RSpec/SubjectStub:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
RSpec/StubbedMock:
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
RSpec/DescribeClass:
|
79
|
+
Exclude:
|
80
|
+
- 'spec/integration/**/*_spec.rb'
|
81
|
+
|
82
|
+
Capybara/CurrentPathExpectation:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Capybara/MatchStyle:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
Capybara/NegationMatcher:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
Capybara/SpecificActions:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
Capybara/SpecificFinders:
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
Capybara/SpecificMatcher:
|
98
|
+
Enabled: false
|
99
|
+
|
100
|
+
Capybara/VisibilityMatcher:
|
101
|
+
Enabled: false
|
102
|
+
|
103
|
+
FactoryBot/AttributeDefinedStatically:
|
104
|
+
Enabled: false
|
105
|
+
|
106
|
+
FactoryBot/ConsistentParenthesesStyle:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
FactoryBot/CreateList:
|
110
|
+
Enabled: false
|
111
|
+
|
112
|
+
FactoryBot/FactoryClassName:
|
113
|
+
Enabled: false
|
114
|
+
|
115
|
+
FactoryBot/FactoryNameStyle:
|
116
|
+
Enabled: false
|
117
|
+
|
118
|
+
FactoryBot/SyntaxMethods:
|
119
|
+
Enabled: false
|
120
|
+
|
121
|
+
RSpecRails/AvoidSetupHook:
|
122
|
+
Enabled: false
|
123
|
+
|
124
|
+
RSpecRails/HaveHttpStatus:
|
125
|
+
Enabled: false
|
126
|
+
|
127
|
+
RSpecRails/HttpStatus:
|
128
|
+
Enabled: false
|
129
|
+
|
130
|
+
RSpecRails/InferredSpecType:
|
131
|
+
Enabled: false
|
132
|
+
|
133
|
+
RSpecRails/MinitestAssertions:
|
134
|
+
Enabled: false
|
135
|
+
|
136
|
+
RSpecRails/NegationBeValid:
|
137
|
+
Enabled: false
|
138
|
+
|
139
|
+
RSpecRails/TravelAround:
|
140
|
+
Enabled: false
|
141
|
+
|
142
|
+
Layout/LineLength:
|
143
|
+
Max: 120
|
144
|
+
|
145
|
+
# Disable OpenStruct warnings in specs since we use it extensively for test data
|
146
|
+
# and the performance impact isn't relevant in our test context
|
147
|
+
Style/OpenStructUse:
|
148
|
+
Exclude:
|
149
|
+
- 'spec/**/*'
|
150
|
+
|
151
|
+
Metrics/BlockLength:
|
152
|
+
Enabled: true
|
153
|
+
Exclude:
|
154
|
+
- 'spec/**/*'
|
155
|
+
- 'Rakefile'
|
156
|
+
|
157
|
+
Metrics/CyclomaticComplexity:
|
158
|
+
Max: 10
|
159
|
+
|
160
|
+
Metrics/PerceivedComplexity:
|
161
|
+
Max: 10
|
162
|
+
|
163
|
+
RSpec/RepeatedExample:
|
164
|
+
Enabled: false # We have intentionally repeated examples
|
165
|
+
|
166
|
+
RSpec/MultipleDescribes:
|
167
|
+
Enabled: false # We have intentionally structured our specs this way
|
168
|
+
|
169
|
+
RSpec/RepeatedExampleGroupDescription:
|
170
|
+
Enabled: false # We have intentionally structured our specs this way
|
171
|
+
|
172
|
+
# Disable Rails-specific cops since we're testing Rails integration
|
173
|
+
Rails:
|
174
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We pledge to maintain a welcoming and productive environment for everyone who participates in this project, regardless of their background or experience level.
|
6
|
+
|
7
|
+
## Our Standards
|
8
|
+
|
9
|
+
* Be respectful of others
|
10
|
+
* Focus on constructive contributions
|
11
|
+
* Exercise empathy in interactions
|
12
|
+
* Accept constructive feedback gracefully
|
13
|
+
* Keep discussions focused on improving the project
|
14
|
+
|
15
|
+
## Scope
|
16
|
+
|
17
|
+
This Code of Conduct applies to all project spaces, including the repository, issue tracker, discussions, and any other project-related communication channels.
|
18
|
+
|
19
|
+
## Enforcement
|
20
|
+
|
21
|
+
Project maintainers are responsible for clarifying and enforcing these standards. They have the right and responsibility to remove, edit, or reject any contributions that don't align with this Code of Conduct.
|
22
|
+
|
23
|
+
## Contact
|
24
|
+
|
25
|
+
If you have concerns, please contact the project maintainers.
|
26
|
+
|
27
|
+
## Attribution
|
28
|
+
|
29
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.0.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Carl Smith
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# TypeBalancer Rails
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/type_balancer-rails)
|
4
|
+
[](https://github.com/llwebconsulting/type_balancer-rails/actions)
|
5
|
+
[](LICENSE)
|
6
|
+
|
7
|
+
Rails integration for the [TypeBalancer](https://github.com/llwebconsulting/type_balancer) gem. This gem provides a seamless way to balance content types in your Rails application's ActiveRecord queries.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'type_balancer-rails'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
```bash
|
20
|
+
$ bundle install
|
21
|
+
```
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
$ gem install type_balancer-rails
|
27
|
+
```
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
### Basic Usage
|
32
|
+
|
33
|
+
The gem adds a `balance_by_type` method to your ActiveRecord relations. Here's how to use it:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
# Get a balanced collection of posts
|
37
|
+
@posts = Post.all.balance_by_type
|
38
|
+
|
39
|
+
# With pagination
|
40
|
+
@posts = Post.all.balance_by_type.page(2).per(20)
|
41
|
+
|
42
|
+
# Specify a custom type field
|
43
|
+
@posts = Post.all.balance_by_type(type_field: :content_type)
|
44
|
+
```
|
45
|
+
|
46
|
+
### Model Configuration
|
47
|
+
|
48
|
+
You can configure the default type field at the model level:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
class Post < ApplicationRecord
|
52
|
+
balance_by_type type_field: :content_type
|
53
|
+
end
|
54
|
+
|
55
|
+
# Now you can call without specifying the type field
|
56
|
+
@posts = Post.all.balance_by_type
|
57
|
+
|
58
|
+
# You can still override the type field per query
|
59
|
+
@posts = Post.all.balance_by_type(type_field: :category)
|
60
|
+
```
|
61
|
+
|
62
|
+
### Chainable with ActiveRecord
|
63
|
+
|
64
|
+
The `balance_by_type` method preserves the ActiveRecord query interface:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
@posts = Post.where(published: true)
|
68
|
+
.order(created_at: :desc)
|
69
|
+
.balance_by_type
|
70
|
+
.page(2)
|
71
|
+
.per(20)
|
72
|
+
```
|
73
|
+
|
74
|
+
## Development
|
75
|
+
|
76
|
+
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.
|
77
|
+
|
78
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
79
|
+
|
80
|
+
## Contributing
|
81
|
+
|
82
|
+
1. Fork it
|
83
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
84
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
85
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
86
|
+
5. Create new Pull Request
|
87
|
+
|
88
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/llwebconsulting/type_balancer-rails.
|
89
|
+
|
90
|
+
## License
|
91
|
+
|
92
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
93
|
+
|
94
|
+
## Code of Conduct
|
95
|
+
|
96
|
+
Everyone interacting in the TypeBalancer Rails project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module TypeBalancer
|
6
|
+
module Generators
|
7
|
+
# Generator for installing TypeBalancer::Rails
|
8
|
+
class InstallGenerator < Rails::Generators::Base
|
9
|
+
source_root File.expand_path('templates', __dir__)
|
10
|
+
|
11
|
+
def create_initializer
|
12
|
+
template(
|
13
|
+
'type_balancer.rb.erb',
|
14
|
+
'config/initializers/type_balancer.rb'
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
TypeBalancer::Rails.configure do |config|
|
4
|
+
# Duration to cache balanced positions
|
5
|
+
config.cache_duration = 1.hour
|
6
|
+
|
7
|
+
# Collection size threshold for background processing
|
8
|
+
config.async_threshold = 1000
|
9
|
+
|
10
|
+
# Default number of items per page
|
11
|
+
config.per_page_default = 25
|
12
|
+
|
13
|
+
# Maximum number of items per page
|
14
|
+
config.max_per_page = 100
|
15
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/concern'
|
4
|
+
|
5
|
+
module TypeBalancer
|
6
|
+
module Rails
|
7
|
+
# Extension for ActiveRecord models to configure type balancing
|
8
|
+
module ActiveRecordExtension
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
included do
|
12
|
+
class << self
|
13
|
+
def all
|
14
|
+
relation = super
|
15
|
+
relation.extend(TypeBalancer::Rails::CollectionMethods)
|
16
|
+
relation
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class_methods do
|
22
|
+
def balance_by_type(options = {})
|
23
|
+
self.type_balancer_options = {
|
24
|
+
type_field: options[:type_field] || :type
|
25
|
+
}
|
26
|
+
|
27
|
+
return [] unless respond_to?(:all)
|
28
|
+
|
29
|
+
relation = all
|
30
|
+
return [] unless relation.is_a?(ActiveRecord::Relation)
|
31
|
+
|
32
|
+
relation.extend(CollectionMethods)
|
33
|
+
relation.balance_by_type(options)
|
34
|
+
end
|
35
|
+
|
36
|
+
def type_balancer_options
|
37
|
+
@type_balancer_options ||= {}
|
38
|
+
end
|
39
|
+
|
40
|
+
attr_writer :type_balancer_options
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
ActiveSupport.on_load(:active_record) do
|
47
|
+
extend TypeBalancer::Rails::ActiveRecordExtension
|
48
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TypeBalancer
|
4
|
+
module Rails
|
5
|
+
# Provides collection methods for balancing by type
|
6
|
+
# These methods are extended onto ActiveRecord::Relation
|
7
|
+
module CollectionMethods
|
8
|
+
# Public: Balance the collection by type
|
9
|
+
#
|
10
|
+
# options - Hash of options to merge with model's type_balancer_options (default: {})
|
11
|
+
# :type_field - Field to balance by (default: :type)
|
12
|
+
# :page - Page number for pagination (default: 1)
|
13
|
+
# :per_page - Number of items per page (default: 20)
|
14
|
+
#
|
15
|
+
# Examples
|
16
|
+
#
|
17
|
+
# Post.all.balance_by_type
|
18
|
+
# Post.where(published: true).balance_by_type(type_field: :category)
|
19
|
+
# Post.all.balance_by_type(page: 2, per_page: 20)
|
20
|
+
#
|
21
|
+
# Returns ActiveRecord::Relation with balanced ordering
|
22
|
+
def balance_by_type(options = {})
|
23
|
+
records = to_a
|
24
|
+
return empty_relation if records.empty?
|
25
|
+
|
26
|
+
# Get type field from options or model configuration
|
27
|
+
type_field = fetch_type_field(options)
|
28
|
+
|
29
|
+
# Balance records using TypeBalancer
|
30
|
+
balanced = TypeBalancer.balance(records, type_field: type_field)
|
31
|
+
return empty_relation if balanced.nil?
|
32
|
+
|
33
|
+
# Handle pagination if requested
|
34
|
+
if options[:page] || options[:per_page]
|
35
|
+
page = (options[:page] || 1).to_i
|
36
|
+
per_page = (options[:per_page] || 20).to_i
|
37
|
+
offset = (page - 1) * per_page
|
38
|
+
balanced = balanced[offset, per_page] || []
|
39
|
+
end
|
40
|
+
|
41
|
+
# Return as relation
|
42
|
+
TestRelation.new(balanced)
|
43
|
+
end
|
44
|
+
|
45
|
+
def all_records = to_a
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def empty_relation
|
50
|
+
TestRelation.new([])
|
51
|
+
end
|
52
|
+
|
53
|
+
def fetch_type_field(options)
|
54
|
+
model_opts = klass.respond_to?(:type_balancer_options) ? klass.type_balancer_options : {}
|
55
|
+
options[:type_field] || model_opts[:type_field] || :type
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TypeBalancer
|
4
|
+
module Rails
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
|
+
initializer 'type_balancer.configure_rails_initialization' do
|
7
|
+
# Include the ActiveRecord extension
|
8
|
+
ActiveSupport.on_load(:active_record) do
|
9
|
+
include TypeBalancer::Rails::ActiveRecordExtension
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/core_ext'
|
5
|
+
require 'active_record'
|
6
|
+
|
7
|
+
require_relative 'rails/active_record_extension'
|
8
|
+
require_relative 'rails/collection_methods'
|
9
|
+
|
10
|
+
module TypeBalancer
|
11
|
+
module Rails
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/core_ext'
|
5
|
+
require 'active_record'
|
6
|
+
require 'type_balancer'
|
7
|
+
|
8
|
+
require_relative 'type_balancer/rails/version'
|
9
|
+
require_relative 'type_balancer/rails'
|
10
|
+
require 'type_balancer/rails/collection_methods'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/type_balancer/rails/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'type_balancer_rails'
|
7
|
+
spec.version = TypeBalancer::Rails::VERSION
|
8
|
+
spec.authors = ['Carl Smith']
|
9
|
+
spec.email = ['carl@llwebconsulting.com']
|
10
|
+
|
11
|
+
spec.summary = 'Rails integration for type_balancer'
|
12
|
+
spec.description = 'Provides Rails integration for the type_balancer gem'
|
13
|
+
spec.homepage = 'https://github.com/llwebconsulting/type_balancer-rails'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = '>= 3.2.0'
|
16
|
+
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
18
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
19
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
20
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(File.expand_path(f) == __FILE__) ||
|
27
|
+
f.start_with?('bin/', 'test/', 'spec/', 'features/', '.git', '.circleci', 'appveyor', 'Gemfile')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
spec.require_paths = ['lib']
|
31
|
+
|
32
|
+
# Runtime dependencies
|
33
|
+
spec.add_dependency 'activerecord', '~> 7.0'
|
34
|
+
spec.add_dependency 'activesupport', '~> 7.0'
|
35
|
+
spec.add_dependency 'type_balancer', '~> 0.1', '>= 0.1.0'
|
36
|
+
|
37
|
+
# For more information and examples about making a new gem, check out our
|
38
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: type_balancer_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Carl Smith
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-04-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '7.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '7.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '7.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '7.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: type_balancer
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.1'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 0.1.0
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0.1'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.1.0
|
61
|
+
description: Provides Rails integration for the type_balancer gem
|
62
|
+
email:
|
63
|
+
- carl@llwebconsulting.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- ".rubocop.yml"
|
69
|
+
- CHANGELOG.md
|
70
|
+
- CODE_OF_CONDUCT.md
|
71
|
+
- LICENSE.txt
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- lib/generators/type_balancer/install/install_generator.rb
|
75
|
+
- lib/generators/type_balancer/install/templates/type_balancer.rb.erb
|
76
|
+
- lib/type_balancer/rails.rb
|
77
|
+
- lib/type_balancer/rails/active_record_extension.rb
|
78
|
+
- lib/type_balancer/rails/collection_methods.rb
|
79
|
+
- lib/type_balancer/rails/railtie.rb
|
80
|
+
- lib/type_balancer/rails/version.rb
|
81
|
+
- lib/type_balancer_rails.rb
|
82
|
+
- type_balancer_rails.gemspec
|
83
|
+
homepage: https://github.com/llwebconsulting/type_balancer-rails
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata:
|
87
|
+
homepage_uri: https://github.com/llwebconsulting/type_balancer-rails
|
88
|
+
source_code_uri: https://github.com/llwebconsulting/type_balancer-rails
|
89
|
+
changelog_uri: https://github.com/llwebconsulting/type_balancer-rails/blob/main/CHANGELOG.md
|
90
|
+
rubygems_mfa_required: 'true'
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 3.2.0
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubygems_version: 3.5.18
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Rails integration for type_balancer
|
110
|
+
test_files: []
|