shreddies 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.autotest +12 -0
- data/.gitignore +8 -0
- data/.rubocop.yml +8 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +98 -0
- data/LICENSE.txt +21 -0
- data/README.md +118 -0
- data/Rakefile +10 -0
- data/config.ru +9 -0
- data/lib/shreddies.rb +10 -0
- data/lib/shreddies/as_json.rb +33 -0
- data/lib/shreddies/engine.rb +17 -0
- data/lib/shreddies/json.rb +61 -0
- data/lib/shreddies/version.rb +3 -0
- data/shreddies.gemspec +29 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6770e333d8c5c90f6a7f1d56fd4d3e27fa32103c13473ed500d151ee20cd8826
|
4
|
+
data.tar.gz: 387cc3e15bbaa1eb8ca3c1775fbc80d22df8c7edf79547dd1518149f07d70e68
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a7ef85a2a7e0cf2bac9353ce5998f3b7b897c36da844e7169e13dfea62c377cf7a994b4e0bf27a763721a3853aa503303ff2248b65a6ade68b9db4748b027ec
|
7
|
+
data.tar.gz: c2b54d864565890b793b63bdbdf6160d85ff7dd3a8de974034499139aedb7c2fb0974cb34ae05acda31d7d444caa480522f4c9408c6284709a6a1168f552f221
|
data/.autotest
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'autotest/suffix'
|
4
|
+
require 'autotest/restart'
|
5
|
+
require 'autotest/bundler'
|
6
|
+
|
7
|
+
Autotest.add_hook :initialize do |at|
|
8
|
+
at.testlib = 'minitest/autorun'
|
9
|
+
at.add_exception '.git'
|
10
|
+
at.add_exception %r{^\./test/internal/db/.+\.sqlite}
|
11
|
+
at.add_exception %r{^\./test/internal/(?:log|public|tmp)}
|
12
|
+
end
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
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, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
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 joel@developwithstyle.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://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in shreddies.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem 'rake', '~> 12.0'
|
9
|
+
gem 'minitest', '~> 5.0'
|
10
|
+
gem 'autotest-suffix'
|
11
|
+
gem 'minitest-autotest'
|
12
|
+
gem 'minitest-focus'
|
13
|
+
gem 'combustion'
|
14
|
+
gem 'sqlite3'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
shreddies (0.1.0)
|
5
|
+
activerecord (>= 5)
|
6
|
+
railties (>= 5)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (6.0.3.2)
|
12
|
+
actionview (= 6.0.3.2)
|
13
|
+
activesupport (= 6.0.3.2)
|
14
|
+
rack (~> 2.0, >= 2.0.8)
|
15
|
+
rack-test (>= 0.6.3)
|
16
|
+
rails-dom-testing (~> 2.0)
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
+
actionview (6.0.3.2)
|
19
|
+
activesupport (= 6.0.3.2)
|
20
|
+
builder (~> 3.1)
|
21
|
+
erubi (~> 1.4)
|
22
|
+
rails-dom-testing (~> 2.0)
|
23
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
+
activemodel (6.0.3.2)
|
25
|
+
activesupport (= 6.0.3.2)
|
26
|
+
activerecord (6.0.3.2)
|
27
|
+
activemodel (= 6.0.3.2)
|
28
|
+
activesupport (= 6.0.3.2)
|
29
|
+
activesupport (6.0.3.2)
|
30
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
31
|
+
i18n (>= 0.7, < 2)
|
32
|
+
minitest (~> 5.1)
|
33
|
+
tzinfo (~> 1.1)
|
34
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
35
|
+
autotest-suffix (1.1.0)
|
36
|
+
builder (3.2.4)
|
37
|
+
combustion (1.3.0)
|
38
|
+
activesupport (>= 3.0.0)
|
39
|
+
railties (>= 3.0.0)
|
40
|
+
thor (>= 0.14.6)
|
41
|
+
concurrent-ruby (1.1.6)
|
42
|
+
crass (1.0.6)
|
43
|
+
erubi (1.9.0)
|
44
|
+
i18n (1.8.3)
|
45
|
+
concurrent-ruby (~> 1.0)
|
46
|
+
loofah (2.6.0)
|
47
|
+
crass (~> 1.0.2)
|
48
|
+
nokogiri (>= 1.5.9)
|
49
|
+
method_source (1.0.0)
|
50
|
+
mini_portile2 (2.4.0)
|
51
|
+
minitest (5.14.1)
|
52
|
+
minitest-autotest (1.1.1)
|
53
|
+
minitest-server (~> 1.0)
|
54
|
+
path_expander (~> 1.0)
|
55
|
+
minitest-focus (1.2.1)
|
56
|
+
minitest (>= 4, < 6)
|
57
|
+
minitest-server (1.0.6)
|
58
|
+
minitest (~> 5.0)
|
59
|
+
nokogiri (1.10.9)
|
60
|
+
mini_portile2 (~> 2.4.0)
|
61
|
+
path_expander (1.1.0)
|
62
|
+
rack (2.2.3)
|
63
|
+
rack-test (1.1.0)
|
64
|
+
rack (>= 1.0, < 3)
|
65
|
+
rails-dom-testing (2.0.3)
|
66
|
+
activesupport (>= 4.2.0)
|
67
|
+
nokogiri (>= 1.6)
|
68
|
+
rails-html-sanitizer (1.3.0)
|
69
|
+
loofah (~> 2.3)
|
70
|
+
railties (6.0.3.2)
|
71
|
+
actionpack (= 6.0.3.2)
|
72
|
+
activesupport (= 6.0.3.2)
|
73
|
+
method_source
|
74
|
+
rake (>= 0.8.7)
|
75
|
+
thor (>= 0.20.3, < 2.0)
|
76
|
+
rake (12.3.3)
|
77
|
+
sqlite3 (1.4.2)
|
78
|
+
thor (1.0.1)
|
79
|
+
thread_safe (0.3.6)
|
80
|
+
tzinfo (1.2.7)
|
81
|
+
thread_safe (~> 0.1)
|
82
|
+
zeitwerk (2.3.1)
|
83
|
+
|
84
|
+
PLATFORMS
|
85
|
+
ruby
|
86
|
+
|
87
|
+
DEPENDENCIES
|
88
|
+
autotest-suffix
|
89
|
+
combustion
|
90
|
+
minitest (~> 5.0)
|
91
|
+
minitest-autotest
|
92
|
+
minitest-focus
|
93
|
+
rake (~> 12.0)
|
94
|
+
shreddies!
|
95
|
+
sqlite3
|
96
|
+
|
97
|
+
BUNDLED WITH
|
98
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Joel Moss
|
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,118 @@
|
|
1
|
+
# Shreddies - Stupid simple Rails model and object serializer
|
2
|
+
|
3
|
+
Shreddies is a JSON serialization library for Rails that focuses on simplicity and speed. No more "magic" DSL's - just plain old Ruby objects! It's primarily intended to serialize Rails models as JSON, but will also work with pretty much anything at all.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'shreddies'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install shreddies
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Serializers should be named after your models and located in "`app/serializers`". Any public methods you define will be serialized, and you can quickly expose methods from the serialized subject using the `delegate` class method.
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
# app/serializers/user_serializer.rb
|
27
|
+
class UserSerializer < Shreddies::Json
|
28
|
+
delegate :id, :first_name, :last_name, :email
|
29
|
+
|
30
|
+
def name
|
31
|
+
"#{first_name} #{last_name}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
Calling the above will result in this JSON:
|
37
|
+
|
38
|
+
```json
|
39
|
+
{
|
40
|
+
"id": 1,
|
41
|
+
"name": "Joel Moss",
|
42
|
+
"firstName": "Joel",
|
43
|
+
"lastName": "Moss",
|
44
|
+
"email": "me@you.com"
|
45
|
+
}
|
46
|
+
```
|
47
|
+
|
48
|
+
> **NOTE** that all keys are transformed to camelCase, as the JSON is intended to be used by Javascript.
|
49
|
+
|
50
|
+
Call your serializer directly:
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
UserSerializer.render(user)
|
54
|
+
```
|
55
|
+
|
56
|
+
Or just use the `#as_json` instance method on your model:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
User.find(1).as_json
|
60
|
+
```
|
61
|
+
|
62
|
+
Model collections and array's are also supported:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
User.all.as_json
|
66
|
+
```
|
67
|
+
|
68
|
+
### Options
|
69
|
+
|
70
|
+
Both `#as_json` and `.render` accepts an `options` hash, which will be forwarded to the serializer class, and available as `options`. This allows you to pass arbitrary options and use them in your serializer.
|
71
|
+
|
72
|
+
The following standard options are supported, and provide additional built-in functionality:
|
73
|
+
|
74
|
+
#### `index_by`
|
75
|
+
|
76
|
+
Give this option a property of your serialized subject as a Symbol, and the returned collection will be a Hash keyed by that property.
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
User.all.as_json index_by: :id
|
80
|
+
```
|
81
|
+
|
82
|
+
```json
|
83
|
+
{
|
84
|
+
1: {
|
85
|
+
"id": 1,
|
86
|
+
"name": "Joel Moss",
|
87
|
+
"firstName": "Joel",
|
88
|
+
"lastName": "Moss"
|
89
|
+
}
|
90
|
+
|
91
|
+
2: {
|
92
|
+
"id": 2,
|
93
|
+
"name": "An Other",
|
94
|
+
"firstName": "An",
|
95
|
+
"lastName": "Other"
|
96
|
+
}
|
97
|
+
|
98
|
+
...
|
99
|
+
}
|
100
|
+
```
|
101
|
+
|
102
|
+
## Development
|
103
|
+
|
104
|
+
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.
|
105
|
+
|
106
|
+
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).
|
107
|
+
|
108
|
+
## Contributing
|
109
|
+
|
110
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/joelmoss/shreddies. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/joelmoss/shreddies/blob/master/CODE_OF_CONDUCT.md).
|
111
|
+
|
112
|
+
## License
|
113
|
+
|
114
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
115
|
+
|
116
|
+
## Code of Conduct
|
117
|
+
|
118
|
+
Everyone interacting in the Shreddies project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/joelmoss/shreddies/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/config.ru
ADDED
data/lib/shreddies.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Shreddies
|
4
|
+
module AsJson
|
5
|
+
module ActiveRecordBase
|
6
|
+
def as_json(options = {})
|
7
|
+
serializer = options.delete(:serializer) || "#{model_name}Serializer"
|
8
|
+
|
9
|
+
if serializer.is_a?(String) || serializer.is_a?(Symbol)
|
10
|
+
serializer.to_s.constantize.render_as_json self, options
|
11
|
+
else
|
12
|
+
serializer.render self, options
|
13
|
+
end
|
14
|
+
rescue NameError
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module ActiveRecordRelation
|
20
|
+
def as_json(options = {})
|
21
|
+
serializer = options.delete(:serializer) || "#{model_name}Serializer"
|
22
|
+
|
23
|
+
if serializer.is_a?(String) || serializer.is_a?(Symbol)
|
24
|
+
serializer.to_s.constantize.render_as_json self, options
|
25
|
+
else
|
26
|
+
serializer.render self, options
|
27
|
+
end
|
28
|
+
rescue NameError
|
29
|
+
super
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails'
|
4
|
+
require 'shreddies/as_json'
|
5
|
+
|
6
|
+
module Shreddies
|
7
|
+
class Engine < ::Rails::Engine
|
8
|
+
isolate_namespace Shreddies
|
9
|
+
|
10
|
+
initializer 'active_record.enhance_as_json' do
|
11
|
+
ActiveSupport.on_load(:active_record) do
|
12
|
+
ActiveRecord::Base.include Shreddies::AsJson::ActiveRecordBase
|
13
|
+
ActiveRecord::Relation.include Shreddies::AsJson::ActiveRecordRelation
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Shreddies
|
4
|
+
class Json
|
5
|
+
class << self
|
6
|
+
# Render a subject as json, where `subject` is a single object (usually a Rails model), or an
|
7
|
+
# array/collection of objects.
|
8
|
+
#
|
9
|
+
# A Hash of options can be given as the second argument:
|
10
|
+
# - index_by - Key the returned array by the value, transforming it from an array to a hash.
|
11
|
+
#
|
12
|
+
def render(subject, options = {})
|
13
|
+
index_by = options.delete(:index_by)
|
14
|
+
|
15
|
+
if subject.is_a?(Array) || subject.is_a?(ActiveRecord::Relation)
|
16
|
+
if index_by
|
17
|
+
mapped = {}
|
18
|
+
subject.each do |x|
|
19
|
+
mapped[x[index_by]] = new(x, options)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
mapped = subject.map { |x| new(x, options) }
|
23
|
+
end
|
24
|
+
|
25
|
+
mapped.as_json
|
26
|
+
else
|
27
|
+
new(subject, options).as_json
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
alias render_as_json render
|
32
|
+
end
|
33
|
+
|
34
|
+
# Monkey patches Rails Module#delegate so that the `:to` argument defaults tio `:subject`.
|
35
|
+
def self.delegate(*methods, to: :subject, prefix: nil, allow_nil: nil, private: nil)
|
36
|
+
super(*methods, to: to, prefix: prefix, allow_nil: allow_nil, private: private)
|
37
|
+
end
|
38
|
+
|
39
|
+
attr_reader :subject, :options
|
40
|
+
|
41
|
+
def initialize(subject, options)
|
42
|
+
@subject = subject
|
43
|
+
@options = options
|
44
|
+
end
|
45
|
+
|
46
|
+
def as_json
|
47
|
+
json = {}
|
48
|
+
|
49
|
+
methods = public_methods(false)
|
50
|
+
if self.class.superclass.to_s.end_with?('Serializer')
|
51
|
+
methods.concat self.class.superclass.public_instance_methods(false)
|
52
|
+
end
|
53
|
+
|
54
|
+
methods.uniq.excluding(:subject, :options, :as_json).map do |attr|
|
55
|
+
json[attr] = public_send(attr)
|
56
|
+
end
|
57
|
+
|
58
|
+
json.deep_transform_keys { |key| key.to_s.camelize :lower }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/shreddies.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/shreddies/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'shreddies'
|
7
|
+
spec.version = Shreddies::VERSION
|
8
|
+
spec.authors = ['Joel Moss']
|
9
|
+
spec.email = ['joel@developwithstyle.com']
|
10
|
+
|
11
|
+
spec.summary = 'Stupid simple Rails model and object serializer'
|
12
|
+
spec.homepage = 'https://github.com/joelmoss/shreddies'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
15
|
+
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
18
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/releases"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_runtime_dependency 'activerecord', '>= 5'
|
28
|
+
spec.add_dependency 'railties', '>= 5'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: shreddies
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joel Moss
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-06-30 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: '5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: railties
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- joel@developwithstyle.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".autotest"
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rubocop.yml"
|
51
|
+
- ".travis.yml"
|
52
|
+
- CODE_OF_CONDUCT.md
|
53
|
+
- Gemfile
|
54
|
+
- Gemfile.lock
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- config.ru
|
59
|
+
- lib/shreddies.rb
|
60
|
+
- lib/shreddies/as_json.rb
|
61
|
+
- lib/shreddies/engine.rb
|
62
|
+
- lib/shreddies/json.rb
|
63
|
+
- lib/shreddies/version.rb
|
64
|
+
- shreddies.gemspec
|
65
|
+
homepage: https://github.com/joelmoss/shreddies
|
66
|
+
licenses:
|
67
|
+
- MIT
|
68
|
+
metadata:
|
69
|
+
homepage_uri: https://github.com/joelmoss/shreddies
|
70
|
+
source_code_uri: https://github.com/joelmoss/shreddies
|
71
|
+
changelog_uri: https://github.com/joelmoss/shreddies/releases
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 2.3.0
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubygems_version: 3.1.2
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: Stupid simple Rails model and object serializer
|
91
|
+
test_files: []
|