nucleus-rails 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/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/exe/nucleus-rails +4 -0
- data/lib/nucleus_rails/cli.rb +6 -0
- data/lib/nucleus_rails/response_adapter.rb +47 -0
- data/lib/nucleus_rails/version.rb +3 -0
- data/lib/nucleus_rails.rb +16 -0
- metadata +224 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 86b45fa495066b47a092d6c501e130da19d8cb592b88a40627984a0d3f11bd0c
|
4
|
+
data.tar.gz: c6f3090d9ad1f65f9974dc579c0870e774ab1b5e0e31c22780f99756114c912b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0e25abd35912bedb4d40c5f1dc5a5855183ec3468c35f249de623c12281da8dfdae3d10f2bdd3b9568a28d4534e827aee0feccfc5162917957053120bdaaba42
|
7
|
+
data.tar.gz: 626062746dad7254281ad7f44dd6b0d7295cc80a9aef41cab8ae4fce7d81afa162121d13164266fce355b4f7295a119119ac63e20b788693a95663c730556cc8
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 dodgerogers
|
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,41 @@
|
|
1
|
+
# NucleusRails
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/nucleus-rails.svg)](https://rubygems.org/gems/nucleus-rails)
|
4
|
+
[![Circle](https://circleci.com/gh/dodgerogers/nucleus-rails/tree/main.svg?style=shield)](https://app.circleci.com/pipelines/github/dodgerogers/nucleus-rails?branch=main)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/dodgerogers/nucleus-rails/badges/gpa.svg)](https://codeclimate.com/github/dodgerogers/nucleus-rails)
|
6
|
+
|
7
|
+
# Description...
|
8
|
+
|
9
|
+
---
|
10
|
+
|
11
|
+
- [Quick start](#quick-start)
|
12
|
+
- [Support](#support)
|
13
|
+
- [License](#license)
|
14
|
+
- [Code of conduct](#code-of-conduct)
|
15
|
+
- [Contribution guide](#contribution-guide)
|
16
|
+
|
17
|
+
## Quick start
|
18
|
+
|
19
|
+
```
|
20
|
+
$ gem install nucleus-rails
|
21
|
+
```
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require "nucleus-rails"
|
25
|
+
```
|
26
|
+
|
27
|
+
## Support
|
28
|
+
|
29
|
+
If you want to report a bug, or have ideas, feedback or questions about the gem, [let me know via GitHub issues](https://github.com/dodgerogers/nucleus-rails/issues/new) and I will do my best to provide a helpful answer. Happy hacking!
|
30
|
+
|
31
|
+
## License
|
32
|
+
|
33
|
+
The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
|
34
|
+
|
35
|
+
## Code of conduct
|
36
|
+
|
37
|
+
Everyone interacting in this project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).
|
38
|
+
|
39
|
+
## Contribution guide
|
40
|
+
|
41
|
+
Pull requests are welcome!
|
data/exe/nucleus-rails
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require "active_support"
|
2
|
+
require "action_controller/railtie"
|
3
|
+
require "nucleus_core"
|
4
|
+
|
5
|
+
module NucleusRails::ResponseAdapter
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
include ActionController::MimeResponds
|
8
|
+
include ActionController::ImplicitRender
|
9
|
+
include NucleusCore::Responder
|
10
|
+
|
11
|
+
included do
|
12
|
+
before_action { set_request_format(request) }
|
13
|
+
|
14
|
+
rescue_from Exception, with: :handle_exception
|
15
|
+
end
|
16
|
+
|
17
|
+
# <Nucleus::ResponseAdapter>
|
18
|
+
# content: Hash, String
|
19
|
+
# headers: Hash
|
20
|
+
# status: Integer
|
21
|
+
# location: String
|
22
|
+
def render_json(entity)
|
23
|
+
render(json: entity.content, **entity.to_h.except(:content))
|
24
|
+
end
|
25
|
+
|
26
|
+
def render_xml(entity)
|
27
|
+
render(xml: entity.content, **entity.to_h.except(:content))
|
28
|
+
end
|
29
|
+
|
30
|
+
def render_text(entity)
|
31
|
+
render(plain: entity.content, **entity.to_h.except(:content))
|
32
|
+
end
|
33
|
+
|
34
|
+
def render_pdf(entity)
|
35
|
+
send_data(entity.content, entity.to_h.except(:content))
|
36
|
+
end
|
37
|
+
|
38
|
+
def render_csv(entity)
|
39
|
+
send_data(entity.content, entity.to_h.except(:content))
|
40
|
+
end
|
41
|
+
|
42
|
+
def render_nothing(entity)
|
43
|
+
head(:no_content, entity.to_h)
|
44
|
+
end
|
45
|
+
|
46
|
+
delegate :set_header, to: :response
|
47
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "nucleus_rails/response_adapter"
|
2
|
+
require "active_record"
|
3
|
+
|
4
|
+
module NucleusRails
|
5
|
+
autoload :CLI, "nucleus_rails/cli"
|
6
|
+
autoload :VERSION, "nucleus_rails/version"
|
7
|
+
|
8
|
+
Nucleus.configure do |config|
|
9
|
+
config.response_adapter = NucleusRails::ResponseAdapter
|
10
|
+
config.logger = Rails.logger
|
11
|
+
config.exceptions_map = {
|
12
|
+
not_found: ActiveRecord::RecordNotFound,
|
13
|
+
unprocessable: ActiveRecord::ActiveRecordError
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,224 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nucleus-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- dodgerogers
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-02-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nucleus-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.11'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.11'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest-ci
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.4'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest-reporters
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 5.2.2
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 5.2.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '13.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '13.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.43.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.43.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-minitest
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.26.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.26.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-packaging
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.5.2
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.5.2
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop-performance
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.15.2
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.15.2
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-rails
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 2.17.4
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 2.17.4
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rubocop-rake
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.6.0
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.6.0
|
181
|
+
description:
|
182
|
+
email:
|
183
|
+
- dodgerogers@hotmail.com
|
184
|
+
executables:
|
185
|
+
- nucleus-rails
|
186
|
+
extensions: []
|
187
|
+
extra_rdoc_files: []
|
188
|
+
files:
|
189
|
+
- LICENSE.txt
|
190
|
+
- README.md
|
191
|
+
- exe/nucleus-rails
|
192
|
+
- lib/nucleus_rails.rb
|
193
|
+
- lib/nucleus_rails/cli.rb
|
194
|
+
- lib/nucleus_rails/response_adapter.rb
|
195
|
+
- lib/nucleus_rails/version.rb
|
196
|
+
homepage: https://github.com/dodgerogers/nucleus-rails
|
197
|
+
licenses:
|
198
|
+
- MIT
|
199
|
+
metadata:
|
200
|
+
bug_tracker_uri: https://github.com/dodgerogers/nucleus-rails/issues
|
201
|
+
changelog_uri: https://github.com/dodgerogers/nucleus-rails/releases
|
202
|
+
source_code_uri: https://github.com/dodgerogers/nucleus-rails
|
203
|
+
homepage_uri: https://github.com/dodgerogers/nucleus-rails
|
204
|
+
rubygems_mfa_required: 'true'
|
205
|
+
post_install_message:
|
206
|
+
rdoc_options: []
|
207
|
+
require_paths:
|
208
|
+
- lib
|
209
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - ">="
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '2.6'
|
214
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - ">="
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '0'
|
219
|
+
requirements: []
|
220
|
+
rubygems_version: 3.4.5
|
221
|
+
signing_key:
|
222
|
+
specification_version: 4
|
223
|
+
summary: A Rails wrapper for the `nucleus-core` gem
|
224
|
+
test_files: []
|