snfoil-rails 0.8.3 → 1.0.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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. metadata +146 -65
  3. data/CODE_OF_CONDUCT.md +0 -74
  4. data/MIT-LICENSE +0 -20
  5. data/README.md +0 -28
  6. data/Rakefile +0 -29
  7. data/lib/generators/sn_foil/all/all_generator.rb +0 -50
  8. data/lib/generators/sn_foil/context/context_generator.rb +0 -41
  9. data/lib/generators/sn_foil/context/templates/context.erb +0 -9
  10. data/lib/generators/sn_foil/controller/controller_generator.rb +0 -52
  11. data/lib/generators/sn_foil/controller/templates/api_controller.erb +0 -14
  12. data/lib/generators/sn_foil/controller/templates/controller.erb +0 -14
  13. data/lib/generators/sn_foil/jsonapi_deserializer/jsonapi_deserializer_generator.rb +0 -41
  14. data/lib/generators/sn_foil/jsonapi_deserializer/templates/jsonapi_deserializer.erb +0 -12
  15. data/lib/generators/sn_foil/jsonapi_serializer/jsonapi_serializer_generator.rb +0 -41
  16. data/lib/generators/sn_foil/jsonapi_serializer/templates/jsonapi_serializer.erb +0 -20
  17. data/lib/generators/sn_foil/policy/policy_generator.rb +0 -41
  18. data/lib/generators/sn_foil/policy/templates/policy.erb +0 -22
  19. data/lib/generators/sn_foil/searcher/searcher_generator.rb +0 -41
  20. data/lib/generators/sn_foil/searcher/templates/searcher.erb +0 -7
  21. data/lib/sn_foil/configuration/lazy_jsonapi_serializer.rb +0 -87
  22. data/lib/sn_foil/controller/api.rb +0 -90
  23. data/lib/sn_foil/controller/base.rb +0 -19
  24. data/lib/sn_foil/controller/concerns/change_controller_concern.rb +0 -21
  25. data/lib/sn_foil/controller/concerns/create_controller_concern.rb +0 -38
  26. data/lib/sn_foil/controller/concerns/destroy_controller_concern.rb +0 -40
  27. data/lib/sn_foil/controller/concerns/index_controller_concern.rb +0 -67
  28. data/lib/sn_foil/controller/concerns/setup_controller_concern.rb +0 -85
  29. data/lib/sn_foil/controller/concerns/show_controller_concern.rb +0 -36
  30. data/lib/sn_foil/controller/concerns/update_controller_concern.rb +0 -38
  31. data/lib/sn_foil/jsonapi_deserializer.rb +0 -159
  32. data/lib/sn_foil/jsonapi_serializer.rb +0 -16
  33. data/lib/sn_foil/rails/engine.rb +0 -23
  34. data/lib/sn_foil/rails/version.rb +0 -7
  35. data/lib/sn_foil/rails.rb +0 -25
  36. data/lib/sn_foil/searcher.rb +0 -122
  37. data/lib/snfoil-rails.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8317d5da3fd8d19a7ddc0c090c3065578d39ace6a431da7d3920e7dde76c92b0
4
- data.tar.gz: ac1beda041a2d44d7e5066b3c9f39d9b8a1f28d1a8fe0f0c5cbdaf93047054d0
3
+ metadata.gz: 5306949c4295cfde76959a28c9ef66300d157690a0d436097483ad0ca2c7e242
4
+ data.tar.gz: 19157fbb48e70a81d55e4a2dbd7e043d9e51af5a2185e1e5993968c0995e50bb
5
5
  SHA512:
6
- metadata.gz: 70da8fe5e43597103002d545e6e48362ea855ffc78bf3edd1c6e4c4fcf2de745b28bed82bd1526c8801a23395b2d9a85436c69daa01f0243669c7786f73e9a68
7
- data.tar.gz: 0c0e11fed83253c68c9c393e96b9328cc6f4081b4aa832d4963cf4cf0402f795624dc38481dfbc4f2887f8fbf6762b1f15afb09cb82140307e1c4ca28dbc5090
6
+ metadata.gz: c19cd5a2a490a5a94d163d3575ac9ca2a45941712fb752363d9a15240d090b783fcda45364df8d4522476ec6461085f7bb73389965a5b7e1ff2c3ee4ee9be223
7
+ data.tar.gz: 6c402d3ca67b0c2e99c9bd5e3ff656822dcc0f79cf53b7b44dc27fb51953caf2626ec90f32fb4656fc64a1db6f6a5812ca48482f3ae9efa605ad867eedd4efda
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snfoil-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Howes
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-09-14 00:00:00.000000000 Z
13
+ date: 2022-08-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -27,47 +27,145 @@ dependencies:
27
27
  - !ruby/object:Gem::Version
28
28
  version: 5.2.6
29
29
  - !ruby/object:Gem::Dependency
30
- name: jsonapi-serializer
30
+ name: snfoil
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '2.2'
35
+ version: 1.0.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '2.2'
42
+ version: 1.0.0
43
43
  - !ruby/object:Gem::Dependency
44
- name: snfoil
44
+ name: snfoil-controller
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '0.8'
49
+ version: 1.0.1
50
50
  type: :runtime
51
51
  prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 1.0.1
57
+ - !ruby/object:Gem::Dependency
58
+ name: blueprinter
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ - !ruby/object:Gem::Dependency
72
+ name: bundle-audit
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: 0.1.0
78
+ type: :development
79
+ prerelease: false
52
80
  version_requirements: !ruby/object:Gem::Requirement
53
81
  requirements:
54
82
  - - "~>"
55
83
  - !ruby/object:Gem::Version
56
- version: '0.8'
84
+ version: 0.1.0
85
+ - !ruby/object:Gem::Dependency
86
+ name: database_cleaner-active_record
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
57
99
  - !ruby/object:Gem::Dependency
58
- name: bundler
100
+ name: factory_bot
59
101
  requirement: !ruby/object:Gem::Requirement
60
102
  requirements:
61
103
  - - "~>"
62
104
  - !ruby/object:Gem::Version
63
- version: '2.2'
105
+ version: '6.0'
64
106
  type: :development
65
107
  prerelease: false
66
108
  version_requirements: !ruby/object:Gem::Requirement
67
109
  requirements:
68
110
  - - "~>"
69
111
  - !ruby/object:Gem::Version
70
- version: '2.2'
112
+ version: '6.0'
113
+ - !ruby/object:Gem::Dependency
114
+ name: fasterer
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: 0.10.0
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: 0.10.0
127
+ - !ruby/object:Gem::Dependency
128
+ name: kaminari
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ - !ruby/object:Gem::Dependency
142
+ name: net-smtp
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ type: :development
149
+ prerelease: false
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ - !ruby/object:Gem::Dependency
156
+ name: oj
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ type: :development
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
71
169
  - !ruby/object:Gem::Dependency
72
170
  name: pry-byebug
73
171
  requirement: !ruby/object:Gem::Requirement
@@ -82,20 +180,34 @@ dependencies:
82
180
  - - "~>"
83
181
  - !ruby/object:Gem::Version
84
182
  version: '3.9'
183
+ - !ruby/object:Gem::Dependency
184
+ name: puma
185
+ requirement: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ type: :development
191
+ prerelease: false
192
+ version_requirements: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
85
197
  - !ruby/object:Gem::Dependency
86
198
  name: rails
87
199
  requirement: !ruby/object:Gem::Requirement
88
200
  requirements:
89
- - - '='
201
+ - - "~>"
90
202
  - !ruby/object:Gem::Version
91
- version: 5.2.6
203
+ version: '6.0'
92
204
  type: :development
93
205
  prerelease: false
94
206
  version_requirements: !ruby/object:Gem::Requirement
95
207
  requirements:
96
- - - '='
208
+ - - "~>"
97
209
  - !ruby/object:Gem::Version
98
- version: 5.2.6
210
+ version: '6.0'
99
211
  - !ruby/object:Gem::Dependency
100
212
  name: rake
101
213
  requirement: !ruby/object:Gem::Requirement
@@ -130,56 +242,56 @@ dependencies:
130
242
  requirements:
131
243
  - - "~>"
132
244
  - !ruby/object:Gem::Version
133
- version: '1.18'
245
+ version: '1.29'
134
246
  type: :development
135
247
  prerelease: false
136
248
  version_requirements: !ruby/object:Gem::Requirement
137
249
  requirements:
138
250
  - - "~>"
139
251
  - !ruby/object:Gem::Version
140
- version: '1.18'
252
+ version: '1.29'
141
253
  - !ruby/object:Gem::Dependency
142
254
  name: rubocop-performance
143
255
  requirement: !ruby/object:Gem::Requirement
144
256
  requirements:
145
257
  - - "~>"
146
258
  - !ruby/object:Gem::Version
147
- version: '1.11'
259
+ version: '1.13'
148
260
  type: :development
149
261
  prerelease: false
150
262
  version_requirements: !ruby/object:Gem::Requirement
151
263
  requirements:
152
264
  - - "~>"
153
265
  - !ruby/object:Gem::Version
154
- version: '1.11'
266
+ version: '1.13'
155
267
  - !ruby/object:Gem::Dependency
156
268
  name: rubocop-rails
157
269
  requirement: !ruby/object:Gem::Requirement
158
270
  requirements:
159
271
  - - "~>"
160
272
  - !ruby/object:Gem::Version
161
- version: '2.11'
273
+ version: '2.14'
162
274
  type: :development
163
275
  prerelease: false
164
276
  version_requirements: !ruby/object:Gem::Requirement
165
277
  requirements:
166
278
  - - "~>"
167
279
  - !ruby/object:Gem::Version
168
- version: '2.11'
280
+ version: '2.14'
169
281
  - !ruby/object:Gem::Dependency
170
282
  name: rubocop-rspec
171
283
  requirement: !ruby/object:Gem::Requirement
172
284
  requirements:
173
285
  - - "~>"
174
286
  - !ruby/object:Gem::Version
175
- version: '2.4'
287
+ version: '2.10'
176
288
  type: :development
177
289
  prerelease: false
178
290
  version_requirements: !ruby/object:Gem::Requirement
179
291
  requirements:
180
292
  - - "~>"
181
293
  - !ruby/object:Gem::Version
182
- version: '2.4'
294
+ version: '2.10'
183
295
  - !ruby/object:Gem::Dependency
184
296
  name: sqlite3
185
297
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +306,7 @@ dependencies:
194
306
  - - ">="
195
307
  - !ruby/object:Gem::Version
196
308
  version: '0'
197
- description:
309
+ description: Additional functionality gem for using SnFoil with Rails
198
310
  email:
199
311
  - howeszy@gmail.com
200
312
  - dmurph24@gmail.com
@@ -202,46 +314,15 @@ email:
202
314
  executables: []
203
315
  extensions: []
204
316
  extra_rdoc_files: []
205
- files:
206
- - CODE_OF_CONDUCT.md
207
- - MIT-LICENSE
208
- - README.md
209
- - Rakefile
210
- - lib/generators/sn_foil/all/all_generator.rb
211
- - lib/generators/sn_foil/context/context_generator.rb
212
- - lib/generators/sn_foil/context/templates/context.erb
213
- - lib/generators/sn_foil/controller/controller_generator.rb
214
- - lib/generators/sn_foil/controller/templates/api_controller.erb
215
- - lib/generators/sn_foil/controller/templates/controller.erb
216
- - lib/generators/sn_foil/jsonapi_deserializer/jsonapi_deserializer_generator.rb
217
- - lib/generators/sn_foil/jsonapi_deserializer/templates/jsonapi_deserializer.erb
218
- - lib/generators/sn_foil/jsonapi_serializer/jsonapi_serializer_generator.rb
219
- - lib/generators/sn_foil/jsonapi_serializer/templates/jsonapi_serializer.erb
220
- - lib/generators/sn_foil/policy/policy_generator.rb
221
- - lib/generators/sn_foil/policy/templates/policy.erb
222
- - lib/generators/sn_foil/searcher/searcher_generator.rb
223
- - lib/generators/sn_foil/searcher/templates/searcher.erb
224
- - lib/sn_foil/configuration/lazy_jsonapi_serializer.rb
225
- - lib/sn_foil/controller/api.rb
226
- - lib/sn_foil/controller/base.rb
227
- - lib/sn_foil/controller/concerns/change_controller_concern.rb
228
- - lib/sn_foil/controller/concerns/create_controller_concern.rb
229
- - lib/sn_foil/controller/concerns/destroy_controller_concern.rb
230
- - lib/sn_foil/controller/concerns/index_controller_concern.rb
231
- - lib/sn_foil/controller/concerns/setup_controller_concern.rb
232
- - lib/sn_foil/controller/concerns/show_controller_concern.rb
233
- - lib/sn_foil/controller/concerns/update_controller_concern.rb
234
- - lib/sn_foil/jsonapi_deserializer.rb
235
- - lib/sn_foil/jsonapi_serializer.rb
236
- - lib/sn_foil/rails.rb
237
- - lib/sn_foil/rails/engine.rb
238
- - lib/sn_foil/rails/version.rb
239
- - lib/sn_foil/searcher.rb
240
- - lib/snfoil-rails.rb
317
+ files: []
241
318
  homepage: https://github.com/limited-effort/snfoil-rails
242
319
  licenses:
243
- - MIT
244
- metadata: {}
320
+ - Apache-2.0
321
+ metadata:
322
+ homepage_uri: https://github.com/limited-effort/snfoil-rails
323
+ source_code_uri: https://github.com/limited-effort/snfoil-rails
324
+ changelog_uri: https://github.com/limited-effort/snfoil-rails/blob/main/CHANGELOG.md
325
+ rubygems_mfa_required: 'true'
245
326
  post_install_message:
246
327
  rdoc_options: []
247
328
  require_paths:
@@ -250,7 +331,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
250
331
  requirements:
251
332
  - - ">="
252
333
  - !ruby/object:Gem::Version
253
- version: 2.5.0
334
+ version: '2.7'
254
335
  required_rubygems_version: !ruby/object:Gem::Requirement
255
336
  requirements:
256
337
  - - ">="
@@ -260,5 +341,5 @@ requirements: []
260
341
  rubygems_version: 3.1.6
261
342
  signing_key:
262
343
  specification_version: 4
263
- summary: Additional functionality gem for using SnFoil with Rails
344
+ summary: Snfoil Rails Helpers
264
345
  test_files: []
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
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 howeszy@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 [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/MIT-LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright 2019 Matthew Howes
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md DELETED
@@ -1,28 +0,0 @@
1
- # Sn::Foil::Rails
2
- Short description and motivation.
3
-
4
- ## Usage
5
- How to use my plugin.
6
-
7
- ## Installation
8
- Add this line to your application's Gemfile:
9
-
10
- ```ruby
11
- gem 'snfoil-rails'
12
- ```
13
-
14
- And then execute:
15
- ```bash
16
- $ bundle
17
- ```
18
-
19
- Or install it yourself as:
20
- ```bash
21
- $ gem install snfoil-rails
22
- ```
23
-
24
- ## Contributing
25
- Contribution directions go here.
26
-
27
- ## License
28
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile DELETED
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- begin
4
- require 'bundler/setup'
5
- rescue LoadError
6
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
- end
8
-
9
- require 'rdoc/task'
10
-
11
- RDoc::Task.new(:rdoc) do |rdoc|
12
- rdoc.rdoc_dir = 'rdoc'
13
- rdoc.title = 'SnFoil::Rails'
14
- rdoc.options << '--line-numbers'
15
- rdoc.rdoc_files.include('README.md')
16
- rdoc.rdoc_files.include('lib/**/*.rb')
17
- end
18
-
19
- require 'bundler/gem_tasks'
20
-
21
- require 'rake/testtask'
22
-
23
- Rake::TestTask.new(:test) do |t|
24
- t.libs << 'test'
25
- t.pattern = 'test/**/*_test.rb'
26
- t.verbose = false
27
- end
28
-
29
- task default: :test
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SnFoil
4
- class AllGenerator < Rails::Generators::Base
5
- source_root File.expand_path('templates', __dir__)
6
-
7
- argument :model, type: :string
8
-
9
- class_option(:type, desc: 'Generate Base or API', type: :string, default: 'base')
10
- class_option(:skip_model, desc: 'Skip Model Creation', type: :boolean, default: false)
11
-
12
- def add_model
13
- rails_command "generate model #{call_args.join(' ')}", call_options
14
- end
15
-
16
- def add_policy
17
- rails_command "generate sn_foil:policy #{call_args.join(' ')}", call_options
18
- end
19
-
20
- def add_searcher
21
- rails_command "generate sn_foil:searcher #{call_args.join(' ')}", call_options
22
- end
23
-
24
- def add_context
25
- rails_command "generate sn_foil:context #{call_args.join(' ')}", call_options
26
- end
27
-
28
- def add_jsonapi_serializer
29
- rails_command "generate sn_foil:jsonapi_serializer #{call_args.join(' ')}", call_options
30
- end
31
-
32
- def add_jsonapi_deserializer
33
- rails_command "generate sn_foil:jsonapi_deserializer #{call_args.join(' ')}", call_options
34
- end
35
-
36
- def add_controller
37
- rails_command "generate sn_foil:controller #{call_args.join(' ')}", call_options
38
- end
39
-
40
- private
41
-
42
- def call_args
43
- @call_args ||= [model].concat(args)
44
- end
45
-
46
- def call_options
47
- @call_options ||= options.deep_symbolize_keys
48
- end
49
- end
50
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SnFoil
4
- class ContextGenerator < Rails::Generators::Base
5
- source_root File.expand_path('templates', __dir__)
6
-
7
- argument :model, type: :string
8
-
9
- class_option :path, desc: 'Base path for file', type: :string, default: 'app/contexts'
10
-
11
- def add_app_file
12
- file_name = if modules.length.zero?
13
- name
14
- else
15
- "#{modules.join('/')}/#{name}"
16
- end
17
-
18
- template('context.erb', "#{options[:path]}/#{file_name}_context.rb")
19
- end
20
-
21
- private
22
-
23
- def name
24
- @name ||= model.split('/').last.underscore.singularize
25
- end
26
-
27
- def class_name
28
- @class_name ||= name.camelize
29
- end
30
-
31
- def modules
32
- @modules ||= model.split('/')[0..-2].map(&:underscore)
33
- end
34
-
35
- def class_modules
36
- return if modules.length.zero?
37
-
38
- @class_modules ||= "#{modules.map(&:camelize).join('::')}::"
39
- end
40
- end
41
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class <%= class_modules %><%= class_name %>Context
4
- include SnFoil::Context
5
-
6
- model <%= class_name %>
7
- searcher <%= class_name.pluralize %>Searcher
8
- policy <%= class_name %>Policy
9
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SnFoil
4
- class ControllerGenerator < Rails::Generators::Base
5
- source_root File.expand_path('templates', __dir__)
6
-
7
- argument :model, type: :string
8
-
9
- class_option :type, desc: 'Generate Base or API', type: :string, default: 'base'
10
- class_option :path, desc: 'Base path for file', type: :string, default: 'app/controllers'
11
-
12
- def add_app_file
13
- template(template_name, "#{options[:path]}/#{file_name}_controller.rb")
14
- end
15
-
16
- private
17
-
18
- def file_name
19
- @file_name ||= if modules.length.zero?
20
- name
21
- else
22
- "#{modules.join('/')}/#{name}"
23
- end
24
- end
25
-
26
- def template_name
27
- @template_name ||= if options[:type] == 'api'
28
- 'api_controller.erb'
29
- else
30
- 'controller.erb'
31
- end
32
- end
33
-
34
- def name
35
- @name ||= model.split('/').last.underscore.pluralize
36
- end
37
-
38
- def class_name
39
- @class_name ||= name.camelize
40
- end
41
-
42
- def modules
43
- @modules ||= model.split('/')[0..-2].map(&:underscore)
44
- end
45
-
46
- def class_modules
47
- return if modules.length.zero?
48
-
49
- @class_modules ||= "#{modules.map(&:camelize).join('::')}::"
50
- end
51
- end
52
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class <%= class_modules %><%= class_name %>Controller < SnFoil::Controller::API
4
- context <%= class_name.singularize %>Context
5
- serializer <%= class_name.singularize %>JsonapiSerializer
6
- deserializer <%= class_name.singularize %>JsonapiDeserializer
7
-
8
- # SnFoil::Controller requires current_entity or current_user defined to properly scope
9
- # all queries, otherwise data leaks could occur
10
- #
11
- # def current_entity
12
- # # logic to find authenticated user
13
- # end
14
- end