rrx_api 0.1.0 → 8.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c2ca699f1c99096a426dcddbf8a44befe271308ba55d0e006a021b7b1b55d82
4
- data.tar.gz: 1a50a0b62160658bd5fa5926c9ec99fbb870798bf0e51819cb9d1ad8892d6122
3
+ metadata.gz: 147f5fd76c0409efe7206adee475031281c611924bb7a8a252ad9e3bf5255cb8
4
+ data.tar.gz: a1d53995cf2bda0935196dd789194ec8c073ac9c82b80a31c6c0a0bd53728dc8
5
5
  SHA512:
6
- metadata.gz: 47db15f33ce5a696f80b35a1b1fb60eddb20037c11bf1b2792acc63ae7ff7f852f82146386f04530ba2203ab34fdcb243fade3681b06eded984078dc73c92eab
7
- data.tar.gz: 3bd316ff0e570750e5246cdb09fd15b6c2c9b101775c6d377db1cc4331b68fc858df8b73f4f164a23309c7db4961db3ce44488cea61f990d5d7fafcfe0146740
6
+ metadata.gz: bf4f7082aeae76be23b58a175e73f54d9df20ed0176cd86b12bc0ef1508adbeeea2c1e8fac5ebe07a137cf6afb71dc53ab911b9e8f3427fa39c0f30c5d357746
7
+ data.tar.gz: 30aebec9055081d21e0802d894dce6ce0ad5a100cbbe2fa696deb0b5609b2b62f7266ff1daa8d343bfee618688f1f568b7f3371a6a5582e4ed537bc4a20bd7ea
data/.rspec CHANGED
@@ -1 +1 @@
1
- --require rails_helper
1
+ --require spec_helper
data/Gemfile CHANGED
@@ -3,7 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
- gem 'sqlite3'
7
-
8
- gem 'rrx_dev', path: '~/dev/rrx/rrx_dev'
9
- gem 'rrx_logging', path: '~/dev/rrx/rrx_logging'
6
+ PARENT_FOLDER = Pathname(__FILE__).parent.parent
7
+ gem 'rrx_dev', path: PARENT_FOLDER.join('rrx_dev') if PARENT_FOLDER.join('rrx_dev').exist?
8
+ gem 'rrx_logging', path: PARENT_FOLDER.join('rrx_logging') if PARENT_FOLDER.join('rrx_logging').exist?
data/Gemfile.lock CHANGED
@@ -1,14 +1,15 @@
1
1
  PATH
2
2
  remote: ../rrx_dev
3
3
  specs:
4
- rrx_dev (0.1.0)
4
+ rrx_dev (8.0.2)
5
5
  active_record_query_trace
6
- activesupport (~> 7.1.0)
6
+ activesupport (~> 8.0.2)
7
7
  bootsnap
8
8
  debug
9
+ factory_bot
9
10
  factory_bot_rails
10
11
  listen
11
- railties (~> 7.1.0)
12
+ railties (~> 8.0.2)
12
13
  rake (>= 13.0)
13
14
  rspec (>= 3.0)
14
15
  rspec-parameterized
@@ -22,125 +23,123 @@ PATH
22
23
  PATH
23
24
  remote: ../rrx_logging
24
25
  specs:
25
- rrx_logging (0.1.0)
26
- activesupport
27
- railties
28
- rrx_config
26
+ rrx_logging (8.0.2)
27
+ activesupport (~> 8.0.2)
28
+ railties (~> 8.0.2)
29
+ rrx_config (~> 8.0.2)
29
30
 
30
31
  PATH
31
32
  remote: .
32
33
  specs:
33
- rrx_api (0.1.0)
34
+ rrx_api (8.0.2)
34
35
  actionpack-action_caching
35
36
  bootsnap
36
37
  faraday
37
38
  faraday_middleware
38
- jbuilder
39
+ jbuilder (~> 2.13)
39
40
  kaminari
40
41
  puma
41
42
  rack-cors
42
- rails (~> 7.0)
43
- rails-healthcheck
44
- rrx_config
45
- rrx_logging
43
+ rails (~> 8.0.2)
44
+ rrx_config (~> 8.0.2)
45
+ rrx_logging (~> 8.0.2)
46
46
  rswag-api
47
47
  rswag-ui
48
+ thor
48
49
  tzinfo-data
49
50
 
50
51
  GEM
51
52
  remote: https://rubygems.org/
52
53
  specs:
53
- actioncable (7.1.2)
54
- actionpack (= 7.1.2)
55
- activesupport (= 7.1.2)
54
+ actioncable (8.0.2)
55
+ actionpack (= 8.0.2)
56
+ activesupport (= 8.0.2)
56
57
  nio4r (~> 2.0)
57
58
  websocket-driver (>= 0.6.1)
58
59
  zeitwerk (~> 2.6)
59
- actionmailbox (7.1.2)
60
- actionpack (= 7.1.2)
61
- activejob (= 7.1.2)
62
- activerecord (= 7.1.2)
63
- activestorage (= 7.1.2)
64
- activesupport (= 7.1.2)
65
- mail (>= 2.7.1)
66
- net-imap
67
- net-pop
68
- net-smtp
69
- actionmailer (7.1.2)
70
- actionpack (= 7.1.2)
71
- actionview (= 7.1.2)
72
- activejob (= 7.1.2)
73
- activesupport (= 7.1.2)
74
- mail (~> 2.5, >= 2.5.4)
75
- net-imap
76
- net-pop
77
- net-smtp
60
+ actionmailbox (8.0.2)
61
+ actionpack (= 8.0.2)
62
+ activejob (= 8.0.2)
63
+ activerecord (= 8.0.2)
64
+ activestorage (= 8.0.2)
65
+ activesupport (= 8.0.2)
66
+ mail (>= 2.8.0)
67
+ actionmailer (8.0.2)
68
+ actionpack (= 8.0.2)
69
+ actionview (= 8.0.2)
70
+ activejob (= 8.0.2)
71
+ activesupport (= 8.0.2)
72
+ mail (>= 2.8.0)
78
73
  rails-dom-testing (~> 2.2)
79
- actionpack (7.1.2)
80
- actionview (= 7.1.2)
81
- activesupport (= 7.1.2)
74
+ actionpack (8.0.2)
75
+ actionview (= 8.0.2)
76
+ activesupport (= 8.0.2)
82
77
  nokogiri (>= 1.8.5)
83
- racc
84
78
  rack (>= 2.2.4)
85
79
  rack-session (>= 1.0.1)
86
80
  rack-test (>= 0.6.3)
87
81
  rails-dom-testing (~> 2.2)
88
82
  rails-html-sanitizer (~> 1.6)
83
+ useragent (~> 0.16)
89
84
  actionpack-action_caching (1.2.2)
90
85
  actionpack (>= 4.0.0)
91
- actiontext (7.1.2)
92
- actionpack (= 7.1.2)
93
- activerecord (= 7.1.2)
94
- activestorage (= 7.1.2)
95
- activesupport (= 7.1.2)
86
+ actiontext (8.0.2)
87
+ actionpack (= 8.0.2)
88
+ activerecord (= 8.0.2)
89
+ activestorage (= 8.0.2)
90
+ activesupport (= 8.0.2)
96
91
  globalid (>= 0.6.0)
97
92
  nokogiri (>= 1.8.5)
98
- actionview (7.1.2)
99
- activesupport (= 7.1.2)
93
+ actionview (8.0.2)
94
+ activesupport (= 8.0.2)
100
95
  builder (~> 3.1)
101
96
  erubi (~> 1.11)
102
97
  rails-dom-testing (~> 2.2)
103
98
  rails-html-sanitizer (~> 1.6)
104
99
  active_record_query_trace (1.8.2)
105
100
  activerecord (>= 6.0.0)
106
- activejob (7.1.2)
107
- activesupport (= 7.1.2)
101
+ activejob (8.0.2)
102
+ activesupport (= 8.0.2)
108
103
  globalid (>= 0.3.6)
109
- activemodel (7.1.2)
110
- activesupport (= 7.1.2)
111
- activerecord (7.1.2)
112
- activemodel (= 7.1.2)
113
- activesupport (= 7.1.2)
104
+ activemodel (8.0.2)
105
+ activesupport (= 8.0.2)
106
+ activerecord (8.0.2)
107
+ activemodel (= 8.0.2)
108
+ activesupport (= 8.0.2)
114
109
  timeout (>= 0.4.0)
115
- activestorage (7.1.2)
116
- actionpack (= 7.1.2)
117
- activejob (= 7.1.2)
118
- activerecord (= 7.1.2)
119
- activesupport (= 7.1.2)
110
+ activestorage (8.0.2)
111
+ actionpack (= 8.0.2)
112
+ activejob (= 8.0.2)
113
+ activerecord (= 8.0.2)
114
+ activesupport (= 8.0.2)
120
115
  marcel (~> 1.0)
121
- activesupport (7.1.2)
116
+ activesupport (8.0.2)
122
117
  base64
118
+ benchmark (>= 0.3)
123
119
  bigdecimal
124
- concurrent-ruby (~> 1.0, >= 1.0.2)
120
+ concurrent-ruby (~> 1.0, >= 1.3.1)
125
121
  connection_pool (>= 2.2.5)
126
122
  drb
127
123
  i18n (>= 1.6, < 2)
124
+ logger (>= 1.4.2)
128
125
  minitest (>= 5.1)
129
- mutex_m
130
- tzinfo (~> 2.0)
126
+ securerandom (>= 0.3)
127
+ tzinfo (~> 2.0, >= 2.0.5)
128
+ uri (>= 0.13.1)
131
129
  addressable (2.8.6)
132
130
  public_suffix (>= 2.0.2, < 6.0)
133
131
  ast (2.4.2)
134
- base64 (0.2.0)
135
- bigdecimal (3.1.5)
132
+ base64 (0.3.0)
133
+ benchmark (0.4.1)
134
+ bigdecimal (3.2.2)
136
135
  binding_of_caller (1.0.0)
137
136
  debug_inspector (>= 0.0.1)
138
137
  bootsnap (1.17.0)
139
138
  msgpack (~> 1.2)
140
- builder (3.2.4)
139
+ builder (3.3.0)
141
140
  coderay (1.1.3)
142
- concurrent-ruby (1.2.2)
143
- connection_pool (2.4.1)
141
+ concurrent-ruby (1.3.5)
142
+ connection_pool (2.5.3)
144
143
  crass (1.0.6)
145
144
  date (3.3.4)
146
145
  debug (1.9.1)
@@ -148,9 +147,9 @@ GEM
148
147
  reline (>= 0.3.8)
149
148
  debug_inspector (1.2.0)
150
149
  diff-lcs (1.5.0)
151
- drb (2.2.0)
152
- ruby2_keywords
153
- erubi (1.12.0)
150
+ drb (2.2.3)
151
+ erb (5.0.2)
152
+ erubi (1.13.1)
154
153
  factory_bot (6.4.5)
155
154
  activesupport (>= 5.0.0)
156
155
  factory_bot_rails (6.4.3)
@@ -182,15 +181,19 @@ GEM
182
181
  faraday_middleware (1.2.0)
183
182
  faraday (~> 1.0)
184
183
  ffi (1.16.3)
184
+ generator_spec (0.10.0)
185
+ activesupport (>= 3.0.0)
186
+ railties (>= 3.0.0)
185
187
  globalid (1.2.1)
186
188
  activesupport (>= 6.1)
187
- i18n (1.14.1)
189
+ i18n (1.14.7)
188
190
  concurrent-ruby (~> 1.0)
189
191
  io-console (0.7.1)
190
- irb (1.11.0)
191
- rdoc
192
- reline (>= 0.3.8)
193
- jbuilder (2.11.5)
192
+ irb (1.15.2)
193
+ pp (>= 0.6.0)
194
+ rdoc (>= 4.0.0)
195
+ reline (>= 0.4.2)
196
+ jbuilder (2.13.0)
194
197
  actionview (>= 5.0.0)
195
198
  activesupport (>= 5.0.0)
196
199
  json (2.7.1)
@@ -212,7 +215,8 @@ GEM
212
215
  listen (3.8.0)
213
216
  rb-fsevent (~> 0.10, >= 0.10.3)
214
217
  rb-inotify (~> 0.9, >= 0.9.10)
215
- loofah (2.22.0)
218
+ logger (1.7.0)
219
+ loofah (2.24.1)
216
220
  crass (~> 1.0.2)
217
221
  nokogiri (>= 1.12.0)
218
222
  mail (2.8.1)
@@ -222,10 +226,9 @@ GEM
222
226
  net-smtp
223
227
  marcel (1.0.2)
224
228
  mini_mime (1.1.5)
225
- minitest (5.20.0)
229
+ minitest (5.25.5)
226
230
  msgpack (1.7.2)
227
231
  multipart-post (2.3.0)
228
- mutex_m (0.2.0)
229
232
  net-imap (0.4.9)
230
233
  date
231
234
  net-protocol
@@ -236,12 +239,15 @@ GEM
236
239
  net-smtp (0.4.0)
237
240
  net-protocol
238
241
  nio4r (2.7.0)
239
- nokogiri (1.16.0-x86_64-linux)
242
+ nokogiri (1.18.8-x86_64-linux-gnu)
240
243
  racc (~> 1.4)
241
244
  parallel (1.24.0)
242
245
  parser (3.2.2.4)
243
246
  ast (~> 2.4.1)
244
247
  racc
248
+ pp (0.6.2)
249
+ prettyprint
250
+ prettyprint (0.2.0)
245
251
  proc_to_ast (0.1.0)
246
252
  coderay
247
253
  parser
@@ -251,7 +257,7 @@ GEM
251
257
  public_suffix (5.0.4)
252
258
  puma (6.4.0)
253
259
  nio4r (~> 2.0)
254
- racc (1.7.3)
260
+ racc (1.8.1)
255
261
  rack (3.0.8)
256
262
  rack-cors (2.0.1)
257
263
  rack (>= 2.0.0)
@@ -262,34 +268,31 @@ GEM
262
268
  rackup (2.1.0)
263
269
  rack (>= 3)
264
270
  webrick (~> 1.8)
265
- rails (7.1.2)
266
- actioncable (= 7.1.2)
267
- actionmailbox (= 7.1.2)
268
- actionmailer (= 7.1.2)
269
- actionpack (= 7.1.2)
270
- actiontext (= 7.1.2)
271
- actionview (= 7.1.2)
272
- activejob (= 7.1.2)
273
- activemodel (= 7.1.2)
274
- activerecord (= 7.1.2)
275
- activestorage (= 7.1.2)
276
- activesupport (= 7.1.2)
271
+ rails (8.0.2)
272
+ actioncable (= 8.0.2)
273
+ actionmailbox (= 8.0.2)
274
+ actionmailer (= 8.0.2)
275
+ actionpack (= 8.0.2)
276
+ actiontext (= 8.0.2)
277
+ actionview (= 8.0.2)
278
+ activejob (= 8.0.2)
279
+ activemodel (= 8.0.2)
280
+ activerecord (= 8.0.2)
281
+ activestorage (= 8.0.2)
282
+ activesupport (= 8.0.2)
277
283
  bundler (>= 1.15.0)
278
- railties (= 7.1.2)
279
- rails-dom-testing (2.2.0)
284
+ railties (= 8.0.2)
285
+ rails-dom-testing (2.3.0)
280
286
  activesupport (>= 5.0.0)
281
287
  minitest
282
288
  nokogiri (>= 1.6)
283
- rails-healthcheck (1.4.0)
284
- actionpack
285
- railties
286
- rails-html-sanitizer (1.6.0)
289
+ rails-html-sanitizer (1.6.2)
287
290
  loofah (~> 2.21)
288
- nokogiri (~> 1.14)
289
- railties (7.1.2)
290
- actionpack (= 7.1.2)
291
- activesupport (= 7.1.2)
292
- irb
291
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
292
+ railties (8.0.2)
293
+ actionpack (= 8.0.2)
294
+ activesupport (= 8.0.2)
295
+ irb (~> 1.13)
293
296
  rackup (>= 1.0.0)
294
297
  rake (>= 12.2)
295
298
  thor (~> 1.0, >= 1.2.2)
@@ -299,13 +302,15 @@ GEM
299
302
  rb-fsevent (0.11.2)
300
303
  rb-inotify (0.10.1)
301
304
  ffi (~> 1.0)
302
- rdoc (6.6.2)
305
+ rdoc (6.14.2)
306
+ erb
303
307
  psych (>= 4.0.0)
304
308
  regexp_parser (2.8.3)
305
- reline (0.4.1)
309
+ reline (0.6.1)
306
310
  io-console (~> 0.5)
307
311
  rexml (3.2.6)
308
- rrx_config (0.1.0)
312
+ rrx_config (8.0.2)
313
+ activesupport
309
314
  railties
310
315
  rspec (3.12.0)
311
316
  rspec-core (~> 3.12.0)
@@ -339,17 +344,17 @@ GEM
339
344
  rspec-mocks (~> 3.12)
340
345
  rspec-support (~> 3.12)
341
346
  rspec-support (3.12.1)
342
- rswag-api (2.13.0)
343
- activesupport (>= 3.1, < 7.2)
344
- railties (>= 3.1, < 7.2)
345
- rswag-specs (2.13.0)
346
- activesupport (>= 3.1, < 7.2)
347
- json-schema (>= 2.2, < 5.0)
348
- railties (>= 3.1, < 7.2)
347
+ rswag-api (2.16.0)
348
+ activesupport (>= 5.2, < 8.1)
349
+ railties (>= 5.2, < 8.1)
350
+ rswag-specs (2.16.0)
351
+ activesupport (>= 5.2, < 8.1)
352
+ json-schema (>= 2.2, < 6.0)
353
+ railties (>= 5.2, < 8.1)
349
354
  rspec-core (>= 2.14)
350
- rswag-ui (2.13.0)
351
- actionpack (>= 3.1, < 7.2)
352
- railties (>= 3.1, < 7.2)
355
+ rswag-ui (2.16.0)
356
+ actionpack (>= 5.2, < 8.1)
357
+ railties (>= 5.2, < 8.1)
353
358
  rubocop (1.59.0)
354
359
  json (~> 2.3)
355
360
  language_server-protocol (>= 3.17.0)
@@ -370,8 +375,9 @@ GEM
370
375
  rubocop-ast (>= 1.30.0, < 2.0)
371
376
  ruby-progressbar (1.13.0)
372
377
  ruby2_keywords (0.0.5)
378
+ securerandom (0.4.1)
373
379
  spring (4.1.3)
374
- sqlite3 (1.7.0-x86_64-linux)
380
+ sqlite3 (2.7.3-x86_64-linux-gnu)
375
381
  stringio (3.1.0)
376
382
  thor (1.3.0)
377
383
  timeout (0.4.1)
@@ -383,6 +389,8 @@ GEM
383
389
  unparser (0.6.10)
384
390
  diff-lcs (~> 1.3)
385
391
  parser (>= 3.2.2.4)
392
+ uri (1.0.3)
393
+ useragent (0.16.11)
386
394
  webrick (1.8.1)
387
395
  websocket-driver (0.7.6)
388
396
  websocket-extensions (>= 0.1.0)
@@ -393,6 +401,7 @@ PLATFORMS
393
401
  x86_64-linux
394
402
 
395
403
  DEPENDENCIES
404
+ generator_spec
396
405
  rrx_api!
397
406
  rrx_dev!
398
407
  rrx_logging!
data/README.md CHANGED
@@ -25,7 +25,7 @@ After installing, initialize your project with `rrx_api_setup`. Note this will a
25
25
  perform development and test setup.
26
26
 
27
27
  ```shell
28
- $ rrx_api_setup
28
+ $ rrx_api
29
29
  ```
30
30
 
31
31
  ## Usage
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RrxApi
4
+ # Replaces the default Rails health check controller
5
+ class HealthController < RrxApi::Controller
6
+ rescue_from(Exception) { |error| render_down(error) }
7
+
8
+ def show
9
+ check
10
+ render_up
11
+ end
12
+
13
+ protected
14
+
15
+ def check
16
+ healthcheck = Rails.application.config.healthcheck
17
+ instance_exec(&healthcheck) if healthcheck.respond_to?(:call)
18
+ end
19
+
20
+ def render_up
21
+ render json: { status: 'up' }, status: :ok
22
+ end
23
+
24
+ # @param [Exception] error
25
+ def render_down(error)
26
+ render json: {
27
+ status: 'down',
28
+ message: error.message,
29
+ full_message: error.full_message(order: :top)
30
+ }, status: :internal_server_error
31
+ end
32
+ end
33
+ end
@@ -4,9 +4,19 @@ module RrxApi
4
4
  class Record < ActiveRecord::Base
5
5
  self.abstract_class = true
6
6
 
7
+ before_create :set_new_id
8
+
7
9
  # @return [RrxLogging::Logger]
8
10
  def logger
9
11
  @logger ||= RrxLogging.current || Rails.logger
10
12
  end
13
+
14
+ protected
15
+
16
+ def set_new_id
17
+ self.id ||= Random.uuid if has_attribute?(:id)
18
+ end
19
+
11
20
  end
21
+
12
22
  end
data/config/routes.rb ADDED
@@ -0,0 +1,13 @@
1
+ RrxApi::Engine.routes.draw do
2
+ if Rails.root.join('swagger').exist?
3
+ require 'rswag/api/engine'
4
+ require 'rswag/ui/engine'
5
+
6
+ mount Rswag::Ui::Engine => '/api-docs'
7
+ mount Rswag::Api::Engine => '/api-docs'
8
+ end
9
+
10
+ healthcheck_path = Rails.application.config.healthcheck_route
11
+ healthcheck_path = "/#{healthcheck_path}" unless healthcheck_path.start_with?('/')
12
+ get healthcheck_path => 'rrx_api/health#show', as: :rrx_health_check
13
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RrxApi
4
+ module Generators
5
+ class Base < ::Rails::Generators::Base
6
+ hide!
7
+
8
+ def self.init!(description = nil)
9
+ # noinspection RubyMismatchedArgumentType
10
+ source_root Pathname(__dir__).join('templates')
11
+ desc description if description
12
+ end
13
+
14
+ protected
15
+
16
+ # class Version
17
+ # def initialize(str)
18
+ # @version = str.to_s
19
+ # @segments = @version.split('.').map(&:to_i)
20
+ # end
21
+ #
22
+ # def to_s
23
+ # @version
24
+ # end
25
+ #
26
+ # def major
27
+ # @segments[0]
28
+ # end
29
+ #
30
+ # def minor
31
+ # @segments[1]
32
+ # end
33
+ #
34
+ # def build
35
+ # @segments[2] || 0
36
+ # end
37
+ #
38
+ # def major_minor
39
+ # "#{major}.#{minor}"
40
+ # end
41
+ #
42
+ # def <=>(other)
43
+ # return nil unless other.is_a?(Version)
44
+ #
45
+ # result = major <=> other.major
46
+ # result = minor <=> other.minor if result.zero?
47
+ # result = build <=> other.build if result.zero?
48
+ # result
49
+ # end
50
+ # end
51
+
52
+ def destination_path
53
+ @destination_path = Pathname(destination_root)
54
+ end
55
+
56
+ def app_name
57
+ @app_name ||= destination_path.basename.to_s
58
+ end
59
+
60
+ # @return [String] Current Ruby version in format "MAJOR.MINOR"
61
+ def ruby_version
62
+ @ruby_version ||= bundle_max_ruby_version || current_ruby_version
63
+ end
64
+
65
+ # @return [Bundler::Definition]
66
+ def bundle
67
+ @bundle ||= Bundler::Definition.build(
68
+ destination_path.join('Gemfile'),
69
+ destination_path.join('Gemfile.lock'),
70
+ nil
71
+ )
72
+ end
73
+
74
+ def current_ruby_version
75
+ RUBY_VERSION.split('.')[0..1].join('.')
76
+ end
77
+
78
+ def bundle_max_ruby_version
79
+ return nil unless bundle.ruby_version
80
+
81
+ version = Gem::Requirement.new(*bundle.ruby_version.versions)
82
+ max_minor = version
83
+ .requirements
84
+ .map { |_, v| v.segments[0..1] } # [major, minor]
85
+
86
+ if max_minor.any?
87
+ max_minor.min_by { |major, minor| [major, minor] }.join('.')
88
+ else
89
+ nil
90
+ end
91
+
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base'
4
+
5
+ module RrxApi
6
+ module Generators
7
+ class DockerGenerator < Base
8
+ init! 'Generates configuration files for building a docker image.'
9
+
10
+ class_option :image_name, type: :string, desc: 'Name of the Docker image. Defaults to application name.'
11
+
12
+ def docker
13
+ template 'docker/Dockerfile.tt', 'Dockerfile'
14
+ end
15
+
16
+ alias image_name app_name
17
+ end
18
+ end
19
+ end