attribute_extras 0.1.4 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/main.yml +35 -0
- data/.gitignore +8 -0
- data/.rubocop.yml +34 -0
- data/CHANGELOG.md +27 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +70 -0
- data/LICENSE +21 -0
- data/README.md +67 -60
- data/Rakefile +4 -19
- data/attribute_extras.gemspec +47 -0
- data/bin/console +8 -0
- data/bin/setup +6 -0
- data/lib/attribute_extras/version.rb +3 -4
- data/lib/attribute_extras.rb +43 -39
- metadata +105 -58
- data/MIT-LICENSE +0 -20
- data/lib/attribute_extras/extra_builder.rb +0 -83
- data/lib/attribute_extras/hook_builder.rb +0 -56
- data/lib/attribute_extras/modifier.rb +0 -19
- data/test/base_extensions_test.rb +0 -52
- data/test/modifier_test.rb +0 -9
- data/test/nullify_attributes_test.rb +0 -57
- data/test/strip_attributes_test.rb +0 -57
- data/test/test_classes.rb +0 -86
- data/test/test_helper.rb +0 -10
- data/test/truncate_attributes_test.rb +0 -57
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b20d50f3986dfb10a5e3c8d5afcb9c7b6f3acd3c4ed8ec77e7f2f0bdd4cb6b41
|
4
|
+
data.tar.gz: 7f05f0982053f65ed2bc96993a2e50d99c7f53257e8d941e5a5adae735cd90dc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 52c7e755eab89794cb6e8fd424ad390534a02c26fd4082a896fe93c42f6c0b107b2f493b253b09d29df0bcb71c7ab5afa4cdf7c44cc12129928322b11e586d53
|
7
|
+
data.tar.gz: c17ab44ea5736d792e6288f14d9bf014ec32889fabbdefee0b503ff9e29ce1f7cd0dba95cfa452f397ff3014056687a540388163e913b725c7a0c842e5f6b115
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: Main
|
2
|
+
on:
|
3
|
+
- push
|
4
|
+
- pull_request_target
|
5
|
+
jobs:
|
6
|
+
ci:
|
7
|
+
name: CI
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
env:
|
10
|
+
CI: true
|
11
|
+
steps:
|
12
|
+
- run: sudo apt-get install libsqlite3-dev
|
13
|
+
- uses: actions/checkout@master
|
14
|
+
- uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 3.0
|
17
|
+
bundler-cache: true
|
18
|
+
- name: Lint and test
|
19
|
+
run: |
|
20
|
+
bundle exec rubocop --parallel
|
21
|
+
bundle exec rake test
|
22
|
+
automerge:
|
23
|
+
name: AutoMerge
|
24
|
+
needs: ci
|
25
|
+
runs-on: ubuntu-latest
|
26
|
+
if: github.event_name == 'pull_request_target' && (github.actor == github.repository_owner || github.actor == 'dependabot[bot]')
|
27
|
+
steps:
|
28
|
+
- uses: actions/github-script@v3
|
29
|
+
with:
|
30
|
+
script: |
|
31
|
+
github.pulls.merge({
|
32
|
+
owner: context.payload.repository.owner.login,
|
33
|
+
repo: context.payload.repository.name,
|
34
|
+
pull_number: context.payload.pull_request.number
|
35
|
+
})
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisplayCopNames: true
|
3
|
+
DisplayStyleGuide: true
|
4
|
+
TargetRubyVersion: 2.7
|
5
|
+
Exclude:
|
6
|
+
- 'vendor/**/*'
|
7
|
+
- 'yard/**/*'
|
8
|
+
|
9
|
+
Gemspec/RequiredRubyVersion:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Layout/LineLength:
|
13
|
+
Max: 80
|
14
|
+
|
15
|
+
Lint/AmbiguousBlockAssociation:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Lint/MissingSuper:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Naming/RescuedExceptionsVariableName:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/Documentation:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/FormatString:
|
28
|
+
EnforcedStyle: percent
|
29
|
+
|
30
|
+
Style/FormatStringToken:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Style/PerlBackrefs:
|
34
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## [1.0.1] - 2021-11-17
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- Require MFA for releasing.
|
14
|
+
|
15
|
+
## [1.0.0] - 2018-12-05
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Instead of overwriting the writer, adds a `before_validation` callback so that the extras can be composed.
|
20
|
+
- From `set_*_attributes` to just `*_attributes`, .e.g, `set_nullified_attributes` became `nullify_attributes`.
|
21
|
+
|
22
|
+
### Removed
|
23
|
+
|
24
|
+
- All of the introspection methods.
|
25
|
+
|
26
|
+
[Unreleased]: https://github.com/kddnewton/attribute_extras/compare/v1.0.0...HEAD
|
27
|
+
[1.0.0]: https://github.com/kddnewton/attribute_extras/compare/ccda61...v1.0.0
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
- Using welcoming and inclusive language
|
18
|
+
- Being respectful of differing viewpoints and experiences
|
19
|
+
- Gracefully accepting constructive criticism
|
20
|
+
- Focusing on what is best for the community
|
21
|
+
- Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
- The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
- Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
- Public or private harassment
|
29
|
+
- Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at kddnewton@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72
|
+
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
74
|
+
|
75
|
+
For answers to common questions about this code of conduct, see
|
76
|
+
https://www.contributor-covenant.org/faq
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
attribute_extras (1.0.1)
|
5
|
+
activerecord (> 3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (7.0.0.alpha2)
|
11
|
+
activesupport (= 7.0.0.alpha2)
|
12
|
+
activerecord (7.0.0.alpha2)
|
13
|
+
activemodel (= 7.0.0.alpha2)
|
14
|
+
activesupport (= 7.0.0.alpha2)
|
15
|
+
activesupport (7.0.0.alpha2)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 1.6, < 2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
ast (2.4.2)
|
21
|
+
concurrent-ruby (1.1.9)
|
22
|
+
docile (1.3.5)
|
23
|
+
i18n (1.8.10)
|
24
|
+
concurrent-ruby (~> 1.0)
|
25
|
+
minitest (5.14.4)
|
26
|
+
parallel (1.21.0)
|
27
|
+
parser (3.0.2.0)
|
28
|
+
ast (~> 2.4.1)
|
29
|
+
rainbow (3.0.0)
|
30
|
+
rake (13.0.6)
|
31
|
+
regexp_parser (2.1.1)
|
32
|
+
rexml (3.2.5)
|
33
|
+
rubocop (1.23.0)
|
34
|
+
parallel (~> 1.10)
|
35
|
+
parser (>= 3.0.0.0)
|
36
|
+
rainbow (>= 2.2.2, < 4.0)
|
37
|
+
regexp_parser (>= 1.8, < 3.0)
|
38
|
+
rexml
|
39
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
40
|
+
ruby-progressbar (~> 1.7)
|
41
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
42
|
+
rubocop-ast (1.13.0)
|
43
|
+
parser (>= 3.0.1.1)
|
44
|
+
ruby-progressbar (1.11.0)
|
45
|
+
simplecov (0.21.2)
|
46
|
+
docile (~> 1.1)
|
47
|
+
simplecov-html (~> 0.11)
|
48
|
+
simplecov_json_formatter (~> 0.1)
|
49
|
+
simplecov-html (0.12.3)
|
50
|
+
simplecov_json_formatter (0.1.2)
|
51
|
+
sqlite3 (1.4.2)
|
52
|
+
tzinfo (2.0.4)
|
53
|
+
concurrent-ruby (~> 1.0)
|
54
|
+
unicode-display_width (2.1.0)
|
55
|
+
|
56
|
+
PLATFORMS
|
57
|
+
ruby
|
58
|
+
|
59
|
+
DEPENDENCIES
|
60
|
+
activerecord (>= 6.0.0.beta1)
|
61
|
+
attribute_extras!
|
62
|
+
bundler (~> 2.0)
|
63
|
+
minitest (~> 5.0)
|
64
|
+
rake (~> 13.0)
|
65
|
+
rubocop (~> 1.12)
|
66
|
+
simplecov (~> 0.17)
|
67
|
+
sqlite3 (~> 1.4)
|
68
|
+
|
69
|
+
BUNDLED WITH
|
70
|
+
2.2.3
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015-present Kevin Newton
|
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
CHANGED
@@ -1,105 +1,112 @@
|
|
1
|
-
|
1
|
+
# AttributeExtras
|
2
2
|
|
3
|
-
|
3
|
+
[![Build Status](https://github.com/kddnewton/attribute_extras/workflows/Main/badge.svg)](https://github.com/kddnewton/attribute_extras/actions)
|
4
|
+
[![Gem](https://img.shields.io/gem/v/attribute_extras.svg)](https://rubygems.org/gems/attribute_extras)
|
4
5
|
|
5
|
-
|
6
|
+
Use this gem for automatic behavior on attributes performed before validation. You can use the predefined extras or define your own.
|
6
7
|
|
7
|
-
|
8
|
+
## Installation
|
8
9
|
|
9
|
-
|
10
|
-
class Person < ActiveRecord::Base
|
11
|
-
nullify_attributes :name
|
12
|
-
end
|
10
|
+
Add this line to your application's Gemfile:
|
13
11
|
|
14
|
-
|
15
|
-
|
12
|
+
```ruby
|
13
|
+
gem 'attribute_extras'
|
16
14
|
```
|
17
15
|
|
18
|
-
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install attribute_extras
|
19
23
|
|
20
|
-
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
`AttributeExtras` provides three extras that are predefined: `nullify_attributes`, `strip_attributes`, and `truncate_attributes`. You can use these methods to tell `AttributeExtras` to perform mutations before validation. Additionally, you can call these methods at any time to perform the mutation programmatically. Examples are below:
|
27
|
+
|
28
|
+
### `ActiveRecord::Base::nullify_attributes`
|
29
|
+
|
30
|
+
Sets the value to `nil` if the value is blank.
|
21
31
|
|
22
32
|
```ruby
|
23
33
|
class Person < ActiveRecord::Base
|
24
|
-
|
34
|
+
nullify_attributes :name
|
25
35
|
end
|
26
36
|
|
27
|
-
|
28
|
-
|
37
|
+
person = Person.create(name: ' ')
|
38
|
+
person.name # => nil
|
39
|
+
|
40
|
+
person = Person.new(name: ' ')
|
41
|
+
person.nullify_attributes
|
42
|
+
person.name # => nil
|
29
43
|
```
|
30
44
|
|
31
|
-
###
|
45
|
+
### `ActiveRecord::Base::strip_attributes`
|
32
46
|
|
33
|
-
|
47
|
+
Strips the value.
|
34
48
|
|
35
49
|
```ruby
|
36
50
|
class Person < ActiveRecord::Base
|
37
|
-
|
51
|
+
strip_attributes :name
|
38
52
|
end
|
39
53
|
|
40
|
-
|
41
|
-
|
42
|
-
```
|
43
|
-
|
44
|
-
### Inheritance
|
54
|
+
person = Person.create(name: ' value ')
|
55
|
+
person.name # => 'value'
|
45
56
|
|
46
|
-
|
47
|
-
|
48
|
-
|
57
|
+
person = Person.new(name: ' value ')
|
58
|
+
person.strip_attributes
|
59
|
+
person.name # => 'value'
|
60
|
+
```
|
49
61
|
|
50
|
-
|
62
|
+
### `ActiveRecord::Base::truncate_attributes`
|
51
63
|
|
52
|
-
|
64
|
+
Truncates the value to the maximum length allowed by the column.
|
53
65
|
|
54
66
|
```ruby
|
55
67
|
class Person < ActiveRecord::Base
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
class Developer < Person
|
60
|
-
nullify_attributes :email
|
68
|
+
truncate_attributes :name
|
61
69
|
end
|
62
70
|
|
63
|
-
Person.
|
64
|
-
|
71
|
+
person = Person.create(name: 'a' * 500)
|
72
|
+
person.name # => 'a' * limit
|
65
73
|
|
66
|
-
|
67
|
-
|
74
|
+
person = Person.new(name: 'a' * 500)
|
75
|
+
person.truncate_attributes
|
76
|
+
person.name # => 'a' * limit
|
68
77
|
```
|
69
78
|
|
70
|
-
|
79
|
+
### `AttributeExtras::define_extra`
|
71
80
|
|
72
|
-
|
73
|
-
|
74
|
-
### `:nullify` Example
|
81
|
+
You can define your own extras by using the `define_extra` method on the `AttributeExtras` module. `define_extra` takes a name for the extra and a block which itself accepts three arguments (the record being modified, the attribute being modified, and the value of the attribute). The block should return the modified value. An example would be:
|
75
82
|
|
76
83
|
```ruby
|
77
|
-
AttributeExtras.
|
78
|
-
|
79
|
-
past: :nullified,
|
80
|
-
validator: { format: { allow_nil: true, without: /\A\s*\z/ } }
|
84
|
+
AttributeExtras.define_extra :double_attributes do |_record, _attribute, value|
|
85
|
+
value * 2
|
81
86
|
end
|
82
|
-
```
|
83
87
|
|
84
|
-
|
85
|
-
|
86
|
-
```ruby
|
87
|
-
AttributeExtras.configure do |config|
|
88
|
-
config.register_extra :truncate, ->(value, options){ value.is_a?(String) ? value[0...options[:limit]] : value },
|
89
|
-
past: :truncated,
|
90
|
-
validator: ->(options){ { length: { maximum: options[:limit] } } },
|
91
|
-
options: ->(attribute){ { limit: self.columns_hash[attribute.to_s].limit } }
|
88
|
+
class Person < ActiveRecord::Base
|
89
|
+
double_attributes :age
|
92
90
|
end
|
91
|
+
|
92
|
+
person = Person.create(age: 5)
|
93
|
+
person.age # => 10
|
94
|
+
|
95
|
+
person = Person.new(age: 5)
|
96
|
+
person.double_attributes
|
97
|
+
person.age # => 10
|
93
98
|
```
|
94
99
|
|
95
|
-
|
100
|
+
## Development
|
101
|
+
|
102
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
96
103
|
|
97
|
-
|
104
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
98
105
|
|
99
|
-
|
106
|
+
## Contributing
|
100
107
|
|
101
|
-
|
108
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kddnewton/attribute_extras.
|
102
109
|
|
103
|
-
|
110
|
+
## License
|
104
111
|
|
105
|
-
MIT License.
|
112
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -1,27 +1,12 @@
|
|
1
|
-
|
2
|
-
require 'bundler/setup'
|
3
|
-
rescue LoadError
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
6
2
|
|
7
|
-
require '
|
3
|
+
require 'bundler/gem_tasks'
|
8
4
|
require 'rake/testtask'
|
9
5
|
|
10
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
11
|
-
rdoc.rdoc_dir = 'rdoc'
|
12
|
-
rdoc.title = 'AttributeExtras'
|
13
|
-
rdoc.options << '--line-numbers'
|
14
|
-
rdoc.rdoc_files.include('README.md')
|
15
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
16
|
-
end
|
17
|
-
|
18
|
-
Bundler::GemHelper.install_tasks
|
19
|
-
|
20
6
|
Rake::TestTask.new(:test) do |t|
|
21
|
-
t.libs << 'lib'
|
22
7
|
t.libs << 'test'
|
23
|
-
t.
|
24
|
-
t.
|
8
|
+
t.libs << 'lib'
|
9
|
+
t.test_files = FileList['test/**/*_test.rb']
|
25
10
|
end
|
26
11
|
|
27
12
|
task default: :test
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/attribute_extras/version'
|
4
|
+
|
5
|
+
version = AttributeExtras::VERSION
|
6
|
+
repository = 'https://github.com/kddnewton/attribute_extras'
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = 'attribute_extras'
|
10
|
+
spec.version = version
|
11
|
+
spec.authors = ['Kevin Newton']
|
12
|
+
spec.email = ['kddnewton@gmail.com']
|
13
|
+
|
14
|
+
spec.summary = 'Extra macros for auto attribute manipulation.'
|
15
|
+
spec.description = <<~DOC
|
16
|
+
Builds macros to automatically manipulate your models' attributes.
|
17
|
+
DOC
|
18
|
+
spec.homepage = repository
|
19
|
+
spec.license = 'MIT'
|
20
|
+
|
21
|
+
spec.metadata = {
|
22
|
+
'bug_tracker_uri' => "#{repository}/issues",
|
23
|
+
'changelog_uri' => "#{repository}/blob/v#{version}/CHANGELOG.md",
|
24
|
+
'source_code_uri' => repository,
|
25
|
+
'rubygems_mfa_required' => 'true'
|
26
|
+
}
|
27
|
+
|
28
|
+
spec.files =
|
29
|
+
Dir.chdir(__dir__) do
|
30
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
31
|
+
f.match(%r{^(test|spec|features)/})
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
spec.bindir = 'exe'
|
36
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
|
+
spec.require_paths = ['lib']
|
38
|
+
|
39
|
+
spec.add_dependency 'activerecord', '> 3'
|
40
|
+
|
41
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
42
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
43
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
44
|
+
spec.add_development_dependency 'rubocop', '~> 1.12'
|
45
|
+
spec.add_development_dependency 'simplecov', '~> 0.17'
|
46
|
+
spec.add_development_dependency 'sqlite3', '~> 1.4'
|
47
|
+
end
|
data/bin/console
ADDED
data/bin/setup
ADDED