auxiliary_rails 0.3.1 → 0.4.1

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +32 -0
  3. data/.github/workflows/publish-gpr.yml +32 -0
  4. data/.github/workflows/publish-rubygems.yml +31 -0
  5. data/.rubocop.yml +10 -6
  6. data/.rubocop_todo.yml +1 -7
  7. data/.ruby-version +1 -1
  8. data/CHANGELOG.md +11 -1
  9. data/CODE_OF_CONDUCT.md +128 -0
  10. data/Gemfile +9 -1
  11. data/Gemfile.lock +175 -138
  12. data/README.md +77 -17
  13. data/auxiliary_rails.gemspec +12 -15
  14. data/bin/rspec +29 -0
  15. data/lib/auxiliary_rails/application/command.rb +3 -6
  16. data/lib/auxiliary_rails/application/error.rb +44 -4
  17. data/lib/auxiliary_rails/application/form.rb +1 -0
  18. data/lib/auxiliary_rails/application/query.rb +11 -7
  19. data/lib/auxiliary_rails/application/service.rb +42 -0
  20. data/lib/auxiliary_rails/concerns/callable.rb +23 -0
  21. data/lib/auxiliary_rails/concerns/errorable.rb +12 -12
  22. data/lib/auxiliary_rails/concerns/performable.rb +14 -22
  23. data/lib/auxiliary_rails/railtie.rb +2 -1
  24. data/lib/auxiliary_rails/version.rb +1 -1
  25. data/lib/auxiliary_rails/view_helpers/display_helper.rb +30 -0
  26. data/lib/auxiliary_rails/view_helpers.rb +4 -0
  27. data/lib/auxiliary_rails.rb +3 -1
  28. data/lib/generators/auxiliary_rails/install_errors_controller_generator.rb +31 -0
  29. data/lib/generators/auxiliary_rails/install_generator.rb +1 -0
  30. data/lib/generators/auxiliary_rails/service_generator.rb +48 -0
  31. data/lib/generators/auxiliary_rails/templates/commands/command_spec_template.rb +1 -1
  32. data/lib/generators/auxiliary_rails/templates/errors_controller/errors_controller_template.rb +15 -0
  33. data/lib/generators/auxiliary_rails/templates/errors_controller/not_found_template.html.erb +2 -0
  34. data/lib/generators/auxiliary_rails/templates/errors_controller/show_template.html.erb +1 -0
  35. data/lib/generators/auxiliary_rails/templates/errors_controller/unacceptable_template.html.erb +2 -0
  36. data/lib/generators/auxiliary_rails/templates/services/service_spec_template.rb +5 -0
  37. data/lib/generators/auxiliary_rails/templates/services/service_template.rb +10 -0
  38. metadata +24 -111
data/Gemfile.lock CHANGED
@@ -1,184 +1,220 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- auxiliary_rails (0.3.1)
4
+ auxiliary_rails (0.4.1)
5
5
  dry-core
6
6
  dry-initializer
7
7
  dry-initializer-rails
8
- rails (>= 5.2, < 7)
8
+ rails (>= 5.2)
9
9
  thor
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (6.0.2.1)
15
- actionpack (= 6.0.2.1)
14
+ actioncable (7.0.6)
15
+ actionpack (= 7.0.6)
16
+ activesupport (= 7.0.6)
16
17
  nio4r (~> 2.0)
17
18
  websocket-driver (>= 0.6.1)
18
- actionmailbox (6.0.2.1)
19
- actionpack (= 6.0.2.1)
20
- activejob (= 6.0.2.1)
21
- activerecord (= 6.0.2.1)
22
- activestorage (= 6.0.2.1)
23
- activesupport (= 6.0.2.1)
19
+ actionmailbox (7.0.6)
20
+ actionpack (= 7.0.6)
21
+ activejob (= 7.0.6)
22
+ activerecord (= 7.0.6)
23
+ activestorage (= 7.0.6)
24
+ activesupport (= 7.0.6)
24
25
  mail (>= 2.7.1)
25
- actionmailer (6.0.2.1)
26
- actionpack (= 6.0.2.1)
27
- actionview (= 6.0.2.1)
28
- activejob (= 6.0.2.1)
26
+ net-imap
27
+ net-pop
28
+ net-smtp
29
+ actionmailer (7.0.6)
30
+ actionpack (= 7.0.6)
31
+ actionview (= 7.0.6)
32
+ activejob (= 7.0.6)
33
+ activesupport (= 7.0.6)
29
34
  mail (~> 2.5, >= 2.5.4)
35
+ net-imap
36
+ net-pop
37
+ net-smtp
30
38
  rails-dom-testing (~> 2.0)
31
- actionpack (6.0.2.1)
32
- actionview (= 6.0.2.1)
33
- activesupport (= 6.0.2.1)
34
- rack (~> 2.0, >= 2.0.8)
39
+ actionpack (7.0.6)
40
+ actionview (= 7.0.6)
41
+ activesupport (= 7.0.6)
42
+ rack (~> 2.0, >= 2.2.4)
35
43
  rack-test (>= 0.6.3)
36
44
  rails-dom-testing (~> 2.0)
37
45
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
38
- actiontext (6.0.2.1)
39
- actionpack (= 6.0.2.1)
40
- activerecord (= 6.0.2.1)
41
- activestorage (= 6.0.2.1)
42
- activesupport (= 6.0.2.1)
46
+ actiontext (7.0.6)
47
+ actionpack (= 7.0.6)
48
+ activerecord (= 7.0.6)
49
+ activestorage (= 7.0.6)
50
+ activesupport (= 7.0.6)
51
+ globalid (>= 0.6.0)
43
52
  nokogiri (>= 1.8.5)
44
- actionview (6.0.2.1)
45
- activesupport (= 6.0.2.1)
53
+ actionview (7.0.6)
54
+ activesupport (= 7.0.6)
46
55
  builder (~> 3.1)
47
56
  erubi (~> 1.4)
48
57
  rails-dom-testing (~> 2.0)
49
58
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
50
- activejob (6.0.2.1)
51
- activesupport (= 6.0.2.1)
59
+ activejob (7.0.6)
60
+ activesupport (= 7.0.6)
52
61
  globalid (>= 0.3.6)
53
- activemodel (6.0.2.1)
54
- activesupport (= 6.0.2.1)
55
- activerecord (6.0.2.1)
56
- activemodel (= 6.0.2.1)
57
- activesupport (= 6.0.2.1)
58
- activestorage (6.0.2.1)
59
- actionpack (= 6.0.2.1)
60
- activejob (= 6.0.2.1)
61
- activerecord (= 6.0.2.1)
62
- marcel (~> 0.3.1)
63
- activesupport (6.0.2.1)
62
+ activemodel (7.0.6)
63
+ activesupport (= 7.0.6)
64
+ activerecord (7.0.6)
65
+ activemodel (= 7.0.6)
66
+ activesupport (= 7.0.6)
67
+ activestorage (7.0.6)
68
+ actionpack (= 7.0.6)
69
+ activejob (= 7.0.6)
70
+ activerecord (= 7.0.6)
71
+ activesupport (= 7.0.6)
72
+ marcel (~> 1.0)
73
+ mini_mime (>= 1.1.0)
74
+ activesupport (7.0.6)
64
75
  concurrent-ruby (~> 1.0, >= 1.0.2)
65
- i18n (>= 0.7, < 2)
66
- minitest (~> 5.1)
67
- tzinfo (~> 1.1)
68
- zeitwerk (~> 2.2)
69
- ast (2.4.0)
76
+ i18n (>= 1.6, < 2)
77
+ minitest (>= 5.1)
78
+ tzinfo (~> 2.0)
79
+ ast (2.4.2)
70
80
  builder (3.2.4)
71
- coderay (1.1.2)
72
- concurrent-ruby (1.1.6)
81
+ coderay (1.1.3)
82
+ concurrent-ruby (1.2.2)
73
83
  crass (1.0.6)
74
- diff-lcs (1.3)
75
- dry-core (0.4.9)
84
+ date (3.3.3)
85
+ diff-lcs (1.5.0)
86
+ dry-core (1.0.0)
76
87
  concurrent-ruby (~> 1.0)
77
- dry-initializer (3.0.3)
88
+ zeitwerk (~> 2.6)
89
+ dry-initializer (3.1.1)
78
90
  dry-initializer-rails (3.1.1)
79
91
  dry-initializer (>= 2.4, < 4)
80
92
  rails (> 3.0)
81
- erubi (1.9.0)
82
- globalid (0.4.2)
83
- activesupport (>= 4.2.0)
84
- i18n (1.8.2)
93
+ erubi (1.12.0)
94
+ globalid (1.1.0)
95
+ activesupport (>= 5.0)
96
+ i18n (1.14.1)
85
97
  concurrent-ruby (~> 1.0)
86
- jaro_winkler (1.5.4)
87
- loofah (2.4.0)
98
+ json (2.6.3)
99
+ language_server-protocol (3.17.0.3)
100
+ loofah (2.21.3)
88
101
  crass (~> 1.0.2)
89
- nokogiri (>= 1.5.9)
90
- mail (2.7.1)
102
+ nokogiri (>= 1.12.0)
103
+ mail (2.8.1)
91
104
  mini_mime (>= 0.1.1)
92
- marcel (0.3.3)
93
- mimemagic (~> 0.3.2)
94
- method_source (0.9.2)
95
- mimemagic (0.3.4)
96
- mini_mime (1.0.2)
97
- mini_portile2 (2.4.0)
98
- minitest (5.14.0)
99
- nio4r (2.5.2)
100
- nokogiri (1.10.9)
101
- mini_portile2 (~> 2.4.0)
102
- parallel (1.19.1)
103
- parser (2.7.0.4)
104
- ast (~> 2.4.0)
105
- pry (0.12.2)
106
- coderay (~> 1.1.0)
107
- method_source (~> 0.9.0)
108
- rack (2.2.3)
109
- rack-test (1.1.0)
110
- rack (>= 1.0, < 3)
111
- rails (6.0.2.1)
112
- actioncable (= 6.0.2.1)
113
- actionmailbox (= 6.0.2.1)
114
- actionmailer (= 6.0.2.1)
115
- actionpack (= 6.0.2.1)
116
- actiontext (= 6.0.2.1)
117
- actionview (= 6.0.2.1)
118
- activejob (= 6.0.2.1)
119
- activemodel (= 6.0.2.1)
120
- activerecord (= 6.0.2.1)
121
- activestorage (= 6.0.2.1)
122
- activesupport (= 6.0.2.1)
123
- bundler (>= 1.3.0)
124
- railties (= 6.0.2.1)
125
- sprockets-rails (>= 2.0.0)
126
- rails-dom-testing (2.0.3)
127
- activesupport (>= 4.2.0)
105
+ net-imap
106
+ net-pop
107
+ net-smtp
108
+ marcel (1.0.2)
109
+ method_source (1.0.0)
110
+ mini_mime (1.1.2)
111
+ mini_portile2 (2.8.4)
112
+ minitest (5.18.1)
113
+ net-imap (0.3.6)
114
+ date
115
+ net-protocol
116
+ net-pop (0.1.2)
117
+ net-protocol
118
+ net-protocol (0.2.1)
119
+ timeout
120
+ net-smtp (0.3.3)
121
+ net-protocol
122
+ nio4r (2.5.9)
123
+ nokogiri (1.15.3)
124
+ mini_portile2 (~> 2.8.2)
125
+ racc (~> 1.4)
126
+ parallel (1.23.0)
127
+ parser (3.2.2.3)
128
+ ast (~> 2.4.1)
129
+ racc
130
+ pry (0.14.2)
131
+ coderay (~> 1.1)
132
+ method_source (~> 1.0)
133
+ racc (1.7.1)
134
+ rack (2.2.7)
135
+ rack-test (2.1.0)
136
+ rack (>= 1.3)
137
+ rails (7.0.6)
138
+ actioncable (= 7.0.6)
139
+ actionmailbox (= 7.0.6)
140
+ actionmailer (= 7.0.6)
141
+ actionpack (= 7.0.6)
142
+ actiontext (= 7.0.6)
143
+ actionview (= 7.0.6)
144
+ activejob (= 7.0.6)
145
+ activemodel (= 7.0.6)
146
+ activerecord (= 7.0.6)
147
+ activestorage (= 7.0.6)
148
+ activesupport (= 7.0.6)
149
+ bundler (>= 1.15.0)
150
+ railties (= 7.0.6)
151
+ rails-dom-testing (2.1.1)
152
+ activesupport (>= 5.0.0)
153
+ minitest
128
154
  nokogiri (>= 1.6)
129
- rails-html-sanitizer (1.3.0)
130
- loofah (~> 2.3)
131
- railties (6.0.2.1)
132
- actionpack (= 6.0.2.1)
133
- activesupport (= 6.0.2.1)
155
+ rails-html-sanitizer (1.6.0)
156
+ loofah (~> 2.21)
157
+ nokogiri (~> 1.14)
158
+ railties (7.0.6)
159
+ actionpack (= 7.0.6)
160
+ activesupport (= 7.0.6)
134
161
  method_source
135
- rake (>= 0.8.7)
136
- thor (>= 0.20.3, < 2.0)
137
- rainbow (3.0.0)
138
- rake (13.0.1)
139
- rexml (3.2.4)
140
- rspec (3.9.0)
141
- rspec-core (~> 3.9.0)
142
- rspec-expectations (~> 3.9.0)
143
- rspec-mocks (~> 3.9.0)
144
- rspec-core (3.9.1)
145
- rspec-support (~> 3.9.1)
146
- rspec-expectations (3.9.0)
162
+ rake (>= 12.2)
163
+ thor (~> 1.0)
164
+ zeitwerk (~> 2.5)
165
+ rainbow (3.1.1)
166
+ rake (13.0.6)
167
+ regexp_parser (2.8.1)
168
+ rexml (3.2.5)
169
+ rspec (3.12.0)
170
+ rspec-core (~> 3.12.0)
171
+ rspec-expectations (~> 3.12.0)
172
+ rspec-mocks (~> 3.12.0)
173
+ rspec-core (3.12.2)
174
+ rspec-support (~> 3.12.0)
175
+ rspec-expectations (3.12.3)
147
176
  diff-lcs (>= 1.2.0, < 2.0)
148
- rspec-support (~> 3.9.0)
149
- rspec-mocks (3.9.1)
177
+ rspec-support (~> 3.12.0)
178
+ rspec-mocks (3.12.6)
150
179
  diff-lcs (>= 1.2.0, < 2.0)
151
- rspec-support (~> 3.9.0)
152
- rspec-support (3.9.2)
153
- rubocop (0.80.1)
154
- jaro_winkler (~> 1.5.1)
180
+ rspec-support (~> 3.12.0)
181
+ rspec-support (3.12.1)
182
+ rubocop (1.54.2)
183
+ json (~> 2.3)
184
+ language_server-protocol (>= 3.17.0)
155
185
  parallel (~> 1.10)
156
- parser (>= 2.7.0.1)
186
+ parser (>= 3.2.2.3)
157
187
  rainbow (>= 2.2.2, < 4.0)
158
- rexml
188
+ regexp_parser (>= 1.8, < 3.0)
189
+ rexml (>= 3.2.5, < 4.0)
190
+ rubocop-ast (>= 1.28.0, < 2.0)
159
191
  ruby-progressbar (~> 1.7)
160
- unicode-display_width (>= 1.4.0, < 1.7)
161
- rubocop-performance (1.5.2)
162
- rubocop (>= 0.71.0)
163
- rubocop-rspec (1.38.1)
164
- rubocop (>= 0.68.1)
165
- ruby-progressbar (1.10.1)
166
- sprockets (4.0.0)
192
+ unicode-display_width (>= 2.4.0, < 3.0)
193
+ rubocop-ast (1.29.0)
194
+ parser (>= 3.2.1.0)
195
+ rubocop-capybara (2.18.0)
196
+ rubocop (~> 1.41)
197
+ rubocop-factory_bot (2.23.1)
198
+ rubocop (~> 1.33)
199
+ rubocop-performance (1.18.0)
200
+ rubocop (>= 1.7.0, < 2.0)
201
+ rubocop-ast (>= 0.4.0)
202
+ rubocop-rake (0.6.0)
203
+ rubocop (~> 1.0)
204
+ rubocop-rspec (2.22.0)
205
+ rubocop (~> 1.33)
206
+ rubocop-capybara (~> 2.17)
207
+ rubocop-factory_bot (~> 2.22)
208
+ ruby-progressbar (1.13.0)
209
+ thor (1.2.2)
210
+ timeout (0.4.0)
211
+ tzinfo (2.0.6)
167
212
  concurrent-ruby (~> 1.0)
168
- rack (> 1, < 3)
169
- sprockets-rails (3.2.1)
170
- actionpack (>= 4.0)
171
- activesupport (>= 4.0)
172
- sprockets (>= 3.0.0)
173
- thor (1.0.1)
174
- thread_safe (0.3.6)
175
- tzinfo (1.2.6)
176
- thread_safe (~> 0.1)
177
- unicode-display_width (1.6.1)
178
- websocket-driver (0.7.1)
213
+ unicode-display_width (2.4.2)
214
+ websocket-driver (0.7.5)
179
215
  websocket-extensions (>= 0.1.0)
180
216
  websocket-extensions (0.1.5)
181
- zeitwerk (2.3.0)
217
+ zeitwerk (2.6.8)
182
218
 
183
219
  PLATFORMS
184
220
  ruby
@@ -189,9 +225,10 @@ DEPENDENCIES
189
225
  pry
190
226
  rake
191
227
  rspec (~> 3.8)
192
- rubocop (~> 0.80)
228
+ rubocop (~> 1.54)
193
229
  rubocop-performance
230
+ rubocop-rake
194
231
  rubocop-rspec
195
232
 
196
233
  BUNDLED WITH
197
- 2.1.4
234
+ 2.4.17
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  Collection of classes, configs, scripts, generators for Ruby on Rails helping you get things done, better.
4
4
 
5
5
  [![Gem](https://img.shields.io/gem/v/auxiliary_rails.svg)](https://rubygems.org/gems/auxiliary_rails)
6
- [![Build Status](https://travis-ci.org/ergoserv/auxiliary_rails.svg?branch=master)](https://travis-ci.org/ergoserv/auxiliary_rails)
7
6
  [![Maintainability](https://api.codeclimate.com/v1/badges/a317c4893a804ce577ab/maintainability)](https://codeclimate.com/github/ergoserv/auxiliary_rails/maintainability)
8
7
 
9
8
  ## Installation
@@ -11,12 +10,15 @@ Collection of classes, configs, scripts, generators for Ruby on Rails helping yo
11
10
  Add one of these lines to your application's `Gemfile`:
12
11
 
13
12
  ```ruby
14
- # version released to RubyGems
13
+ # version released to RubyGems (recommended)
15
14
  gem 'auxiliary_rails'
15
+
16
16
  # or latest version from the repository
17
17
  gem 'auxiliary_rails', git: 'https://github.com/ergoserv/auxiliary_rails'
18
- # or from a specific branch of the repository
18
+ # or from a specific branch of the GitHub repository
19
19
  gem 'auxiliary_rails', github: 'ergoserv/auxiliary_rails', branch: 'develop'
20
+ # or from a local path (for development and testing purposes)
21
+ gem 'auxiliary_rails', path: '../auxiliary_rails'
20
22
  ```
21
23
 
22
24
  And then execute:
@@ -56,17 +58,35 @@ rails generate auxiliary_rails:install
56
58
  # Install one by one
57
59
  rails generate auxiliary_rails:install_commands
58
60
  rails generate auxiliary_rails:install_errors
61
+ rails generate auxiliary_rails:install_errors_controller
59
62
 
60
63
  # API resource generator
61
64
  rails generate auxiliary_rails:api_resource
62
65
 
63
66
  # Command generator
64
67
  rails generate auxiliary_rails:command
68
+
69
+ # Service generator
70
+ rails generate auxiliary_rails:service
71
+ ```
72
+
73
+ ### API Resources
74
+
75
+ Read article [Building an API](https://github.com/ergoserv/handbook/blob/master/guides/building_api.md) for more details.
76
+
77
+ Use generator to generate appropriate classes and files (Resource, Entity, Helper, Spec) for the specified end-point:
78
+
79
+ ```sh
80
+ rails generate auxiliary_rails:api_resource
65
81
  ```
66
82
 
83
+ ## Application
84
+
67
85
  ### Command Objects
68
86
 
69
- Variation of implementation of [Command pattern](https://en.wikipedia.org/wiki/Command_pattern).
87
+ Variation of implementation of [Command pattern](https://refactoring.guru/design-patterns/command).
88
+
89
+ Read post [Command Objects - a.k.a Service Objects in Ruby on Rails - The Ergonomic Way](https://www.ergoserv.com/blog/command-objects-aka-service-objects-in-ruby-on-rails-the-ergonomic-way) for more details.
70
90
 
71
91
  ```ruby
72
92
  # app/commands/application_command.rb
@@ -81,8 +101,8 @@ class RegisterUserCommand < ApplicationCommand
81
101
  param :email
82
102
  param :password
83
103
 
84
- # Define the results of the command
85
- # using `attr_reader` and set it as a regular instance var inside the command
104
+ # Define the results of the command using `attr_reader`
105
+ # and set it as a regular instance var inside the command
86
106
  attr_reader :user
87
107
 
88
108
  # Regular Active Model Validations can be used to validate params
@@ -90,9 +110,11 @@ class RegisterUserCommand < ApplicationCommand
90
110
  # Use #valid?, #invalid?, #validate! methods to engage validations
91
111
  validates :password, length: { in: 8..32 }
92
112
 
93
- # Define the only public method `#perform`
94
- # where command's flow is defined
113
+ # Define the only public method `#perform` where command's flow is defined
95
114
  def perform
115
+ # Use `return failure!` and `return success!` inside `#perform` method
116
+ # to control exits from the command with appropriate status.
117
+
96
118
  # Use `return failure!` to exit from the command with failure
97
119
  return failure! if registration_disabled?
98
120
 
@@ -100,27 +122,27 @@ class RegisterUserCommand < ApplicationCommand
100
122
  transaction do
101
123
  # Keep the `#perform` method short and clean, put all the steps, actions
102
124
  # and business logic into meaningful and self-explanatory methods
103
- create_user
125
+ @user = create_user
104
126
 
105
127
  # Use `error!` method to interrupt the flow raising an error
106
- error! unless @user.persistent?
128
+ error! unless user.persistent?
107
129
 
108
- send_notification
130
+ send_notifications
109
131
  # ...
110
132
  end
111
133
 
112
- # Always end the `#perform` method with `success!`
113
- # this will set the proper status and allow to chain command methods.
134
+ # Always end the `#perform` method with `success!`.
135
+ # It will set the proper command's execution status.
114
136
  success!
115
137
  end
116
138
 
117
139
  private
118
140
 
119
141
  def create_user
120
- @user = User.create(email: email, password: password)
142
+ User.create(email: email, password: password)
121
143
  end
122
144
 
123
- def send_notification
145
+ def send_notifications
124
146
  # ...
125
147
  end
126
148
  end
@@ -150,6 +172,17 @@ class RegistrationsController
150
172
  end
151
173
  ```
152
174
 
175
+ ### Error Objects
176
+
177
+ Custom error objects.
178
+ Read article [Error Handling](https://github.com/ergoserv/handbook/blob/master/guides/error_handling.md) for more details.
179
+
180
+ ```ruby
181
+ # app/errors/application_error.rb
182
+ class ApplicationError < AuxiliaryRails::Application::Error
183
+ end
184
+ ```
185
+
153
186
  ### Form Objects
154
187
 
155
188
  ```ruby
@@ -252,7 +285,7 @@ end
252
285
  ### Usage ###
253
286
 
254
287
  # it is possible to wrap query object in a scope and use as a regular scope
255
- # app/models/inmate.rb
288
+ # app/models/author.rb
256
289
  class Author < ApplicationRecord
257
290
  scope :name_like, ->(value) { AuthorsQuery.call(name_like: value) }
258
291
  end
@@ -263,11 +296,38 @@ authors = Author.name_like('Arthur')
263
296
  authors = AuthorsWithBooksQuery.call(min_book_count: 10)
264
297
  ```
265
298
 
299
+ ### Service Modules
300
+
301
+ Read [Service Modules](https://github.com/ergoserv/handbook/blob/master/guides/service_modules.md) for more details.
302
+
303
+ **Service Generator**
304
+
305
+ ```sh
306
+ rails generate auxiliary_rails:service
307
+ ```
308
+
309
+ **Service Config** - provides a unified access to a service configs and loads the first found from:
310
+
311
+ - Constant (`MyService::CONFIG`)
312
+ - Application config file (`config/settings.yml`, see gem [`config`](https://github.com/rubyconfig/config))
313
+ - Service config file (`config/services/my_service.yml`)
314
+
315
+ ```ruby
316
+ # app/services/my_service.rb
317
+ module MyService
318
+ extend AuxiliaryRails::Application::Service
319
+ end
320
+
321
+ # usage
322
+ MyService.config.some_key
323
+ ```
324
+
266
325
  ### View Helpers
267
326
 
268
327
  ```ruby
269
328
  current_controller?(*ctrl_names)
270
329
  current_action?(*action_names)
330
+ display_name(resource)
271
331
  ```
272
332
 
273
333
  ## Development
@@ -284,7 +344,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/ergose
284
344
 
285
345
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
286
346
 
287
- -------------------------------------------------------------------------------
347
+ ---
288
348
 
289
349
  [![alt text](https://raw.githubusercontent.com/ergoserv/auxiliary_rails/master/assets/ErgoServ_horizontalColor@sign+text+bg.png "ErgoServ - Web and Mobile Development Company")](https://www.ergoserv.com)
290
350
 
@@ -8,9 +8,11 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Dmitry Babenko', 'ErgoServ']
9
9
  spec.email = ['dmitry@ergoserv.com', 'hello@ergoserv.com']
10
10
 
11
- spec.summary = 'AuxiliaryRails provides extra layers and utils ' \
12
- 'for helping to build solid and clean Ruby on Rails applications'
13
- spec.description = <<~DESC
11
+ spec.summary = <<~DESC
12
+ AuxiliaryRails provides extra layers and utils
13
+ for helping to build solid and clean Ruby on Rails applications
14
+ DESC
15
+ spec.description = <<~DESC
14
16
  AuxiliaryRails is a collection of classes, configs, scripts,
15
17
  generators for Ruby on Rails helping you get things done, better.
16
18
  DESC
@@ -20,6 +22,7 @@ Gem::Specification.new do |spec|
20
22
  raise 'RubyGems 2.0 or newer is required' unless spec.respond_to?(:metadata)
21
23
 
22
24
  spec.metadata['homepage_uri'] = spec.homepage
25
+ spec.metadata['rubygems_mfa_required'] = 'true'
23
26
  spec.metadata['source_code_uri'] = spec.homepage
24
27
  spec.metadata['changelog_uri'] = "#{spec.homepage}/releases"
25
28
 
@@ -31,17 +34,11 @@ Gem::Specification.new do |spec|
31
34
  spec.executables = ['auxiliary_rails']
32
35
  spec.require_paths = ['lib']
33
36
 
34
- spec.add_development_dependency 'bundler', '~> 2.0'
35
- spec.add_development_dependency 'pry'
36
- spec.add_development_dependency 'rake'
37
- spec.add_development_dependency 'rspec', '~> 3.8'
38
- spec.add_development_dependency 'rubocop', '~> 0.80'
39
- spec.add_development_dependency 'rubocop-performance'
40
- spec.add_development_dependency 'rubocop-rspec'
37
+ spec.required_ruby_version = '>= 2.5'
41
38
 
42
- spec.add_runtime_dependency 'dry-core'
43
- spec.add_runtime_dependency 'dry-initializer'
44
- spec.add_runtime_dependency 'dry-initializer-rails'
45
- spec.add_runtime_dependency 'rails', '>= 5.2', '< 7'
46
- spec.add_runtime_dependency 'thor'
39
+ spec.add_dependency 'dry-core'
40
+ spec.add_dependency 'dry-initializer'
41
+ spec.add_dependency 'dry-initializer-rails'
42
+ spec.add_dependency 'rails', '>= 5.2'
43
+ spec.add_dependency 'thor'
47
44
  end
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
@@ -28,12 +28,9 @@ module AuxiliaryRails
28
28
  # @param name [Symbol]
29
29
  # @param options [Hash]
30
30
 
31
- # Initializes command with <tt>args</tt> and runs <tt>#call</tt> method.
32
- #
33
- # @return [self]
34
- def call(*args)
35
- new(*args).call
36
- end
31
+ # @!method call(*args, **kws)
32
+ # @see AuxiliaryRails::Corcerns::Callable
33
+ # @return [self]
37
34
 
38
35
  # Defines `scope` for <tt>ActiveModel::Translation</tt>
39
36
  #