auxiliary_rails 0.3.1 → 0.4.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 +4 -4
- data/.rubocop.yml +10 -1
- data/.rubocop_todo.yml +1 -7
- data/.ruby-version +1 -1
- data/CHANGELOG.md +11 -1
- data/CODE_OF_CONDUCT.md +128 -0
- data/Gemfile.lock +157 -131
- data/README.md +76 -15
- data/auxiliary_rails.gemspec +10 -5
- data/bin/rspec +29 -0
- data/lib/auxiliary_rails/application/command.rb +3 -6
- data/lib/auxiliary_rails/application/error.rb +44 -4
- data/lib/auxiliary_rails/application/form.rb +1 -0
- data/lib/auxiliary_rails/application/query.rb +11 -7
- data/lib/auxiliary_rails/application/service.rb +42 -0
- data/lib/auxiliary_rails/concerns/callable.rb +23 -0
- data/lib/auxiliary_rails/concerns/errorable.rb +12 -12
- data/lib/auxiliary_rails/concerns/performable.rb +11 -19
- data/lib/auxiliary_rails/railtie.rb +2 -1
- data/lib/auxiliary_rails/version.rb +1 -1
- data/lib/auxiliary_rails/view_helpers/display_helper.rb +30 -0
- data/lib/auxiliary_rails/view_helpers.rb +4 -0
- data/lib/auxiliary_rails.rb +3 -1
- data/lib/generators/auxiliary_rails/install_errors_controller_generator.rb +31 -0
- data/lib/generators/auxiliary_rails/install_generator.rb +1 -0
- data/lib/generators/auxiliary_rails/service_generator.rb +48 -0
- data/lib/generators/auxiliary_rails/templates/commands/command_spec_template.rb +1 -1
- data/lib/generators/auxiliary_rails/templates/errors_controller/errors_controller_template.rb +15 -0
- data/lib/generators/auxiliary_rails/templates/errors_controller/not_found_template.html.erb +2 -0
- data/lib/generators/auxiliary_rails/templates/errors_controller/show_template.html.erb +1 -0
- data/lib/generators/auxiliary_rails/templates/errors_controller/unacceptable_template.html.erb +2 -0
- data/lib/generators/auxiliary_rails/templates/services/service_spec_template.rb +5 -0
- data/lib/generators/auxiliary_rails/templates/services/service_template.rb +10 -0
- metadata +38 -17
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module AuxiliaryRails
|
4
|
+
class ServiceGenerator < ::Rails::Generators::NamedBase
|
5
|
+
desc 'Stubs out a new Service and spec.'
|
6
|
+
|
7
|
+
source_root File.expand_path('templates/services', __dir__)
|
8
|
+
|
9
|
+
class_option :path,
|
10
|
+
type: :string,
|
11
|
+
default: 'app/services',
|
12
|
+
desc: 'Service location'
|
13
|
+
|
14
|
+
def create_service_dir
|
15
|
+
FileUtils.mkdir_p("#{service_file_path}/#{service_file_name}")
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_service_file
|
19
|
+
FileUtils.mkdir_p(service_file_path)
|
20
|
+
template 'service_template.rb',
|
21
|
+
"#{service_file_path}/#{service_file_name}.rb"
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_service_spec_file
|
25
|
+
FileUtils.mkdir_p(service_spec_path)
|
26
|
+
template 'service_spec_template.rb',
|
27
|
+
"#{service_spec_path}/#{service_file_name}_spec.rb"
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def service_module_name
|
33
|
+
"#{class_name.gsub(/Service$/, '')}Service"
|
34
|
+
end
|
35
|
+
|
36
|
+
def service_file_name
|
37
|
+
service_module_name.underscore
|
38
|
+
end
|
39
|
+
|
40
|
+
def service_file_path
|
41
|
+
options[:path]
|
42
|
+
end
|
43
|
+
|
44
|
+
def service_spec_path
|
45
|
+
service_file_path.gsub(%r{^app/}, 'spec/')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ErrorsController < ApplicationController
|
2
|
+
DEFAULT_ERROR_STATUS = 500
|
3
|
+
|
4
|
+
def show
|
5
|
+
render status: params[:status] || DEFAULT_ERROR_STATUS
|
6
|
+
end
|
7
|
+
|
8
|
+
def not_found
|
9
|
+
render status: :not_found
|
10
|
+
end
|
11
|
+
|
12
|
+
def unacceptable
|
13
|
+
render status: :unprocessable_entity
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>We're sorry, but something went wrong.</h1>
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auxiliary_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Babenko
|
8
8
|
- ErgoServ
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -71,16 +71,16 @@ dependencies:
|
|
71
71
|
name: rubocop
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - '='
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 1.20.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - '='
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 1.20.0
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: rubocop-performance
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +95,20 @@ dependencies:
|
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rubocop-rake
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
98
112
|
- !ruby/object:Gem::Dependency
|
99
113
|
name: rubocop-rspec
|
100
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,9 +172,6 @@ dependencies:
|
|
158
172
|
- - ">="
|
159
173
|
- !ruby/object:Gem::Version
|
160
174
|
version: '5.2'
|
161
|
-
- - "<"
|
162
|
-
- !ruby/object:Gem::Version
|
163
|
-
version: '7'
|
164
175
|
type: :runtime
|
165
176
|
prerelease: false
|
166
177
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -168,9 +179,6 @@ dependencies:
|
|
168
179
|
- - ">="
|
169
180
|
- !ruby/object:Gem::Version
|
170
181
|
version: '5.2'
|
171
|
-
- - "<"
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '7'
|
174
182
|
- !ruby/object:Gem::Dependency
|
175
183
|
name: thor
|
176
184
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,6 +213,7 @@ files:
|
|
205
213
|
- ".travis.yml"
|
206
214
|
- ".yardopts"
|
207
215
|
- CHANGELOG.md
|
216
|
+
- CODE_OF_CONDUCT.md
|
208
217
|
- CONTRIBUTING.md
|
209
218
|
- Gemfile
|
210
219
|
- Gemfile.lock
|
@@ -215,6 +224,7 @@ files:
|
|
215
224
|
- auxiliary_rails.gemspec
|
216
225
|
- bin/auxiliary_rails
|
217
226
|
- bin/console
|
227
|
+
- bin/rspec
|
218
228
|
- bin/rubocop
|
219
229
|
- bin/setup
|
220
230
|
- bitbucket-pipelines.yml
|
@@ -223,17 +233,22 @@ files:
|
|
223
233
|
- lib/auxiliary_rails/application/error.rb
|
224
234
|
- lib/auxiliary_rails/application/form.rb
|
225
235
|
- lib/auxiliary_rails/application/query.rb
|
236
|
+
- lib/auxiliary_rails/application/service.rb
|
226
237
|
- lib/auxiliary_rails/cli.rb
|
238
|
+
- lib/auxiliary_rails/concerns/callable.rb
|
227
239
|
- lib/auxiliary_rails/concerns/errorable.rb
|
228
240
|
- lib/auxiliary_rails/concerns/performable.rb
|
229
241
|
- lib/auxiliary_rails/railtie.rb
|
230
242
|
- lib/auxiliary_rails/version.rb
|
231
243
|
- lib/auxiliary_rails/view_helpers.rb
|
244
|
+
- lib/auxiliary_rails/view_helpers/display_helper.rb
|
232
245
|
- lib/generators/auxiliary_rails/api_resource_generator.rb
|
233
246
|
- lib/generators/auxiliary_rails/command_generator.rb
|
234
247
|
- lib/generators/auxiliary_rails/install_commands_generator.rb
|
248
|
+
- lib/generators/auxiliary_rails/install_errors_controller_generator.rb
|
235
249
|
- lib/generators/auxiliary_rails/install_errors_generator.rb
|
236
250
|
- lib/generators/auxiliary_rails/install_generator.rb
|
251
|
+
- lib/generators/auxiliary_rails/service_generator.rb
|
237
252
|
- lib/generators/auxiliary_rails/templates/apis/api_entity_template.rb.erb
|
238
253
|
- lib/generators/auxiliary_rails/templates/apis/api_helper_template.rb.erb
|
239
254
|
- lib/generators/auxiliary_rails/templates/apis/api_resource_spec_template.rb.erb
|
@@ -243,6 +258,12 @@ files:
|
|
243
258
|
- lib/generators/auxiliary_rails/templates/commands/command_spec_template.rb
|
244
259
|
- lib/generators/auxiliary_rails/templates/commands/command_template.rb
|
245
260
|
- lib/generators/auxiliary_rails/templates/commands/commands.en_template.yml
|
261
|
+
- lib/generators/auxiliary_rails/templates/errors_controller/errors_controller_template.rb
|
262
|
+
- lib/generators/auxiliary_rails/templates/errors_controller/not_found_template.html.erb
|
263
|
+
- lib/generators/auxiliary_rails/templates/errors_controller/show_template.html.erb
|
264
|
+
- lib/generators/auxiliary_rails/templates/errors_controller/unacceptable_template.html.erb
|
265
|
+
- lib/generators/auxiliary_rails/templates/services/service_spec_template.rb
|
266
|
+
- lib/generators/auxiliary_rails/templates/services/service_template.rb
|
246
267
|
- templates/rails/elementary.rb
|
247
268
|
homepage: https://github.com/ergoserv/auxiliary_rails
|
248
269
|
licenses:
|
@@ -251,7 +272,7 @@ metadata:
|
|
251
272
|
homepage_uri: https://github.com/ergoserv/auxiliary_rails
|
252
273
|
source_code_uri: https://github.com/ergoserv/auxiliary_rails
|
253
274
|
changelog_uri: https://github.com/ergoserv/auxiliary_rails/releases
|
254
|
-
post_install_message:
|
275
|
+
post_install_message:
|
255
276
|
rdoc_options: []
|
256
277
|
require_paths:
|
257
278
|
- lib
|
@@ -259,15 +280,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
259
280
|
requirements:
|
260
281
|
- - ">="
|
261
282
|
- !ruby/object:Gem::Version
|
262
|
-
version: '
|
283
|
+
version: '2.5'
|
263
284
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
264
285
|
requirements:
|
265
286
|
- - ">="
|
266
287
|
- !ruby/object:Gem::Version
|
267
288
|
version: '0'
|
268
289
|
requirements: []
|
269
|
-
rubygems_version: 3.
|
270
|
-
signing_key:
|
290
|
+
rubygems_version: 3.1.6
|
291
|
+
signing_key:
|
271
292
|
specification_version: 4
|
272
293
|
summary: AuxiliaryRails provides extra layers and utils for helping to build solid
|
273
294
|
and clean Ruby on Rails applications
|