ehbrs-tools 0.45.2 → 0.46.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6aba6b05cd60aaf98219dddf7c312166d8b4ed51ca0ac13f554bb28a41c48f19
4
- data.tar.gz: 6ec134de9eadc5da32af0ff130434a5c3da878fa3d6ed1dd1e3f6657304dc488
3
+ metadata.gz: af4ca110d8ae0fe4a7d3ec9babaab037b95d092041368a2b44c198a3233e2dcd
4
+ data.tar.gz: 0f0c9571e3009fe0f43a3dd080973152f76a7a2c5ccc88ecf35ac9923818a9ce
5
5
  SHA512:
6
- metadata.gz: cd7d52e2f220ea58401320df6df0eb53f951fb2f470426875e76ac86af4cecf0ea95926e17bf0c108d9fca101c7f4af11357f7cfbb05ca33cf1382dd4d855a00
7
- data.tar.gz: 3c8111f133260588f7ba446dcb2827a8a11583bd08d46303a4cc9b900519956c4b3dec2e877ca51f965906b9646c4e46fff9be5c8a399de4cacadd010ad10c09
6
+ metadata.gz: 2a6da9a5c28abecb0652c9fff402e3c0c1a0e0ecc7d759d636f9264d77e03433d896822041bc20d8ab9963411514330cd8d30d650521d41414a2b298fcebe361
7
+ data.tar.gz: 9819b74f39c4610845554eeece8903431100a2cd7faf4663673ca7c9d5db0906885753a654e2f32bb7490b887371dcbeff7ad96978fd5741633092c227b23fd7
data/Gemfile.lock CHANGED
@@ -1,44 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ehbrs-tools (0.45.2)
4
+ ehbrs-tools (0.46.0)
5
5
  avm-tools (~> 0.164, >= 0.164.1)
6
- eac_cli (~> 0.47, >= 0.47.1)
7
- eac_fs (~> 0.20, >= 0.20.2)
8
- eac_ruby_base0 (~> 0.19, >= 0.19.3)
9
- eac_ruby_base1 (~> 0.1.1, ~> 0.1)
10
- ehbrs_ruby_utils (~> 0.49, >= 0.49.2)
6
+ eac_cli (~> 0.47, >= 0.47.2)
7
+ eac_fs (~> 0.20, >= 0.20.3)
8
+ eac_ruby_base0 (~> 0.22)
9
+ eac_ruby_base1 (~> 0.1, >= 0.1.2)
10
+ ehbrs_ruby_utils (~> 0.51)
11
11
  filesize (~> 0.2)
12
12
  os (~> 1.1, >= 1.1.4)
13
13
  telegram-bot-ruby (~> 0.23)
14
14
 
15
- PATH
16
- remote: sub/eac_envs-http
17
- specs:
18
- eac_envs-http (0.7.2)
19
- eac_fs (~> 0.20, >= 0.20.2)
20
- eac_ruby_base1 (~> 0.1, >= 0.1.1)
21
- faraday (~> 2.14, >= 2.14.3)
22
- faraday-follow_redirects (~> 0.5)
23
- faraday-gzip (~> 3.1)
24
- faraday-multipart (~> 1.2)
25
- faraday-retry (~> 2.4)
26
- random-port (~> 0.8)
27
- webrick (~> 1.9, >= 1.9.2)
28
-
29
15
  PATH
30
16
  remote: sub/ehbrs_ruby_utils
31
17
  specs:
32
- ehbrs_ruby_utils (0.49.2)
18
+ ehbrs_ruby_utils (0.51.0)
33
19
  aranha (~> 0.20, >= 0.20.1)
34
20
  aranha-parsers (~> 0.29)
35
- aranha-selenium (~> 0.14)
36
- avm (~> 0.102, >= 0.102.3)
21
+ aranha-selenium (~> 0.15)
22
+ avm (~> 0.103)
37
23
  avm-eac_rails_base0 (~> 0.11, >= 0.11.2)
38
- dentaku (~> 3.5, >= 3.5.7)
39
- eac_fs (~> 0.20, >= 0.20.2)
24
+ dentaku (~> 3.5, >= 3.5.8)
25
+ eac_fs (~> 0.20, >= 0.20.3)
40
26
  eac_rest (~> 0.13)
41
- eac_ruby_base1 (~> 0.1.1, ~> 0.1)
27
+ eac_ruby_base1 (~> 0.1, >= 0.1.2)
42
28
  eac_templates (~> 0.9)
43
29
  inifile (~> 3.0)
44
30
  srt (~> 0.1, >= 0.1.5)
@@ -48,7 +34,7 @@ PATH
48
34
  GEM
49
35
  remote: https://rubygems.org/
50
36
  specs:
51
- activesupport (8.1.3.1)
37
+ activesupport (8.1.4)
52
38
  base64
53
39
  bigdecimal
54
40
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -72,26 +58,26 @@ GEM
72
58
  eac_envs-http (~> 0.7, >= 0.7.1)
73
59
  eac_ruby_utils (~> 0.131)
74
60
  nokogiri (~> 1.19, >= 1.19.3)
75
- aranha-selenium (0.14.0)
76
- aranha (~> 0.20)
77
- eac_fs (~> 0.20, >= 0.20.1)
78
- eac_ruby_utils (~> 0.130)
79
- eac_templates (~> 0.8, >= 0.8.3)
61
+ aranha-selenium (0.15.0)
62
+ aranha (~> 0.20, >= 0.20.1)
63
+ eac_fs (~> 0.20, >= 0.20.3)
64
+ eac_ruby_base1 (~> 0.1, >= 0.1.1)
65
+ eac_templates (~> 0.9)
80
66
  rexml (~> 3.4, >= 3.4.4)
81
- selenium-webdriver (~> 4.43)
67
+ selenium-webdriver (~> 4.49)
82
68
  ast (2.4.3)
83
69
  attr_extras (7.1.0)
84
- avm (0.102.3)
85
- eac_cli (~> 0.47)
70
+ avm (0.103.0)
71
+ eac_cli (~> 0.47, >= 0.47.1)
86
72
  eac_config (~> 0.15)
87
73
  eac_docker (~> 0.8, >= 0.8.1)
88
- eac_fs (~> 0.20, >= 0.20.2)
74
+ eac_fs (~> 0.20, >= 0.20.3)
89
75
  eac_ruby_base1 (~> 0.1, >= 0.1.1)
90
76
  eac_templates (~> 0.9)
91
77
  minitar (~> 0.12, >= 0.12.1)
92
- avm-eac_generic_base0 (0.15.3)
93
- avm (~> 0.100)
94
- eac_ruby_utils (~> 0.131)
78
+ avm-eac_generic_base0 (0.16.1)
79
+ avm (~> 0.103)
80
+ eac_ruby_utils (~> 0.134)
95
81
  avm-eac_postgresql_base0 (0.6.0)
96
82
  avm (~> 0.98, >= 0.98.4)
97
83
  eac_ruby_utils (~> 0.129, >= 0.129.1)
@@ -103,22 +89,23 @@ GEM
103
89
  avm-eac_ruby_base1 (~> 0.43, >= 0.43.2)
104
90
  avm-eac_webapp_base0 (~> 0.22, >= 0.22.3)
105
91
  eac_ruby_base1 (~> 0.1, >= 0.1.1)
106
- avm-eac_ruby_base1 (0.43.2)
92
+ avm-eac_ruby_base1 (0.45.2)
107
93
  aranha-parsers (~> 0.29)
108
- avm (~> 0.102, >= 0.102.3)
109
- avm-eac_generic_base0 (~> 0.15, >= 0.15.3)
110
- eac_envs-http (~> 0.7, >= 0.7.1)
94
+ avm (~> 0.103)
95
+ avm-eac_generic_base0 (~> 0.16, >= 0.16.1)
96
+ eac_envs-http (~> 0.7, >= 0.7.2)
111
97
  eac_ruby_base1 (~> 0.1, >= 0.1.1)
112
- avm-eac_ubuntu_base0 (0.7.1)
113
- avm (~> 0.102, >= 0.102.3)
98
+ avm-eac_ubuntu_base0 (0.7.2)
99
+ avm (~> 0.102, >= 0.102.4)
114
100
  eac_ruby_base1 (~> 0.1, >= 0.1.1)
115
101
  eac_templates (~> 0.9)
116
- avm-eac_webapp_base0 (0.22.3)
117
- avm (~> 0.102, >= 0.102.3)
118
- avm-eac_generic_base0 (~> 0.15, >= 0.15.3)
102
+ avm-eac_webapp_base0 (0.23.0)
103
+ avm (~> 0.103)
104
+ avm-eac_generic_base0 (~> 0.16, >= 0.16.1)
119
105
  avm-eac_postgresql_base0 (~> 0.6)
120
- avm-eac_ubuntu_base0 (~> 0.7, >= 0.7.1)
121
- eac_ruby_base1 (~> 0.1, >= 0.1.1)
106
+ avm-eac_ubuntu_base0 (~> 0.7, >= 0.7.2)
107
+ eac_ruby_base1 (~> 0.1, >= 0.1.2)
108
+ eac_ruby_utils (~> 0.136)
122
109
  htmlbeautifier (~> 1.4, >= 1.4.3)
123
110
  avm-tools (0.164.1)
124
111
  avm (~> 0.102, >= 0.102.2)
@@ -128,7 +115,7 @@ GEM
128
115
  ice_nine (~> 0.11.0)
129
116
  thread_safe (~> 0.3, >= 0.3.1)
130
117
  base64 (0.3.0)
131
- bigdecimal (4.1.2)
118
+ bigdecimal (4.1.3)
132
119
  clipboard (2.0.0)
133
120
  coercible (1.0.0)
134
121
  descendants_tracker (~> 0.0.1)
@@ -137,71 +124,86 @@ GEM
137
124
  connection_pool (3.0.2)
138
125
  content-type (0.0.2)
139
126
  parslet (~> 2.0)
140
- dentaku (3.5.7)
127
+ csv (3.3.6)
128
+ dentaku (3.5.8)
141
129
  bigdecimal
142
130
  concurrent-ruby
131
+ tsort
143
132
  descendants_tracker (0.0.4)
144
133
  thread_safe (~> 0.3, >= 0.3.1)
145
134
  diff-lcs (1.6.2)
146
135
  drb (2.2.3)
147
136
  dry-inflector (1.3.1)
148
- eac_cli (0.47.1)
137
+ eac_cli (0.47.2)
149
138
  clipboard (~> 2.0)
150
139
  colorize (~> 0.8, >= 0.8.1)
151
- eac_config (~> 0.15)
152
- eac_ruby_utils (~> 0.131, >= 0.131.4)
140
+ csv (~> 3.3, >= 3.3.6)
141
+ eac_config (~> 0.15, >= 0.15.2)
142
+ eac_ruby_utils (~> 0.134)
153
143
  tty-table (~> 0.12)
154
- eac_config (0.15.0)
155
- addressable (~> 2.8, >= 2.8.7)
156
- eac_ruby_utils (~> 0.127)
157
- eac_docker (0.8.1)
144
+ eac_config (0.15.2)
145
+ addressable (~> 2.9)
146
+ eac_ruby_base1 (~> 0.1, >= 0.1.1)
147
+ eac_docker (0.9.0)
158
148
  eac_ruby_base1 (~> 0.1, >= 0.1.1)
159
149
  eac_templates (~> 0.9)
160
- eac_fs (0.20.2)
150
+ eac_envs-http (0.7.2)
151
+ eac_fs (~> 0.20, >= 0.20.2)
152
+ eac_ruby_base1 (~> 0.1, >= 0.1.1)
153
+ faraday (~> 2.14, >= 2.14.3)
154
+ faraday-follow_redirects (~> 0.5)
155
+ faraday-gzip (~> 3.1)
156
+ faraday-multipart (~> 1.2)
157
+ faraday-retry (~> 2.4)
158
+ random-port (~> 0.8)
159
+ webrick (~> 1.9, >= 1.9.2)
160
+ eac_fs (0.20.3)
161
161
  content-type (~> 0.0, >= 0.0.2)
162
- eac_ruby_utils (~> 0.131)
162
+ eac_ruby_base1 (~> 0.1, >= 0.1.1)
163
163
  filesize (~> 0.2)
164
164
  ruby-filemagic (~> 0.7, >= 0.7.3)
165
165
  eac_rest (0.13.0)
166
166
  eac_envs-http (~> 0.7, >= 0.7.1)
167
167
  eac_fs (~> 0.20, >= 0.20.1)
168
168
  eac_ruby_utils (~> 0.130)
169
- eac_ruby_base0 (0.19.3)
170
- avm-eac_ruby_base1 (~> 0.39)
171
- eac_cli (~> 0.45)
172
- eac_fs (~> 0.20)
173
- eac_ruby_utils (~> 0.129)
174
- eac_ruby_base1 (0.1.1)
175
- eac_ruby_utils (~> 0.131, >= 0.131.2)
176
- eac_ruby_gem_support (0.14.0)
177
- eac_ruby_base1 (~> 0.1)
169
+ eac_ruby_base0 (0.22.0)
170
+ avm-eac_ruby_base1 (~> 0.45)
171
+ eac_cli (~> 0.47, >= 0.47.1)
172
+ eac_fs (~> 0.20, >= 0.20.3)
173
+ eac_ruby_base1 (~> 0.1, >= 0.1.1)
174
+ eac_ruby_base1 (0.1.2)
175
+ eac_ruby_utils (~> 0.135)
176
+ eac_ruby_gem_support (0.15.0)
177
+ eac_ruby_base1 (~> 0.1, >= 0.1.1)
178
178
  rspec (~> 3.13, >= 3.13.2)
179
179
  rubocop (~> 1.88, >= 1.88.2)
180
180
  rubocop-rails (~> 2.36)
181
181
  rubocop-rspec (~> 3.10, >= 3.10.2)
182
182
  super_diff (~> 0.19)
183
- eac_ruby_utils (0.131.4)
183
+ eac_ruby_utils (0.136.0)
184
184
  activesupport (>= 6.1.7.10)
185
185
  addressable (~> 2.9)
186
186
  bundler
187
+ json (< 3)
187
188
  memoized (~> 1.1, >= 1.1.3)
188
189
  net-ssh (~> 4.2)
189
- zeitwerk (~> 2.8, >= 2.8.2)
190
+ ostruct
191
+ zeitwerk (~> 2.8, >= 2.8.3)
190
192
  eac_templates (0.9.0)
191
193
  eac_config (~> 0.15)
192
194
  eac_ruby_base1 (~> 0.1, >= 0.1.1)
193
- faraday (2.14.3)
194
- faraday-net_http (>= 2.0, < 3.5)
195
+ faraday (2.15.0)
196
+ faraday-net_http (>= 2.0, < 3.6)
195
197
  json
196
198
  logger
197
199
  faraday-follow_redirects (0.5.0)
198
200
  faraday (>= 1, < 3)
199
- faraday-gzip (3.1.0)
201
+ faraday-gzip (3.2.0)
200
202
  faraday (>= 2.0, < 3)
201
203
  zlib (~> 3.0)
202
204
  faraday-multipart (1.2.0)
203
205
  multipart-post (~> 2.0)
204
- faraday-net_http (3.4.4)
206
+ faraday-net_http (3.5.0)
205
207
  net-http (~> 0.5)
206
208
  faraday-retry (2.4.0)
207
209
  faraday (~> 2.0)
@@ -211,7 +213,7 @@ GEM
211
213
  concurrent-ruby (~> 1.0)
212
214
  ice_nine (0.11.2)
213
215
  inifile (3.0.0)
214
- json (2.21.1)
216
+ json (2.21.2)
215
217
  language_server-protocol (3.17.0.6)
216
218
  lint_roller (1.1.0)
217
219
  logger (1.7.0)
@@ -221,15 +223,19 @@ GEM
221
223
  drb (~> 2.0)
222
224
  prism (~> 1.5)
223
225
  multipart-post (2.4.1)
224
- net-http (0.9.1)
226
+ net-http (0.10.0)
227
+ net-protocol (>= 0.3.0)
225
228
  uri (>= 0.11.1)
229
+ net-protocol (0.4.0)
230
+ timeout
226
231
  net-ssh (4.2.0)
227
232
  nokogiri (1.19.4-x86_64-linux-gnu)
228
233
  racc (~> 1.4)
229
234
  optimist (3.2.1)
230
235
  os (1.1.4)
231
- parallel (1.28.0)
232
- parser (3.3.12.0)
236
+ ostruct (0.6.3)
237
+ parallel (2.3.0)
238
+ parser (3.3.13.0)
233
239
  ast (~> 2.4.1)
234
240
  racc
235
241
  parslet (2.0.0)
@@ -240,11 +246,11 @@ GEM
240
246
  prism (1.9.0)
241
247
  public_suffix (7.0.5)
242
248
  racc (1.8.1)
243
- rack (3.2.6)
249
+ rack (3.2.7)
244
250
  rainbow (3.1.1)
245
- random-port (0.8.0)
251
+ random-port (0.8.2)
246
252
  tago (~> 0.0)
247
- regexp_parser (2.12.0)
253
+ regexp_parser (2.13.1)
248
254
  rexml (3.4.4)
249
255
  rspec (3.13.2)
250
256
  rspec-core (~> 3.13.0)
@@ -259,25 +265,25 @@ GEM
259
265
  diff-lcs (>= 1.2.0, < 2.0)
260
266
  rspec-support (~> 3.13.0)
261
267
  rspec-support (3.13.7)
262
- rubocop (1.88.2)
263
- json (~> 2.3)
268
+ rubocop (1.92.1)
269
+ json (>= 2.3)
264
270
  language_server-protocol (~> 3.17.0.2)
265
271
  lint_roller (~> 1.1.0)
266
272
  parallel (>= 1.10)
267
273
  parser (>= 3.3.0.2)
268
274
  rainbow (>= 2.2.2, < 4.0)
269
- regexp_parser (>= 2.9.3, < 3.0)
275
+ regexp_parser (>= 2.11.3, < 3.0)
270
276
  rubocop-ast (>= 1.49.0, < 2.0)
271
277
  ruby-progressbar (~> 1.7)
272
278
  unicode-display_width (>= 2.4.0, < 4.0)
273
279
  rubocop-ast (1.50.0)
274
280
  parser (>= 3.3.7.2)
275
281
  prism (~> 1.7)
276
- rubocop-rails (2.36.0)
282
+ rubocop-rails (2.38.0)
277
283
  activesupport (>= 4.2.0)
278
284
  lint_roller (~> 1.1)
279
285
  rack (>= 1.1)
280
- rubocop (>= 1.75.0, < 2.0)
286
+ rubocop (>= 1.89.0, < 2.0)
281
287
  rubocop-ast (>= 1.44.0, < 2.0)
282
288
  rubocop-rspec (3.10.2)
283
289
  lint_roller (~> 1.1)
@@ -285,12 +291,11 @@ GEM
285
291
  rubocop (~> 1.86, >= 1.86.2)
286
292
  ruby-filemagic (0.7.3)
287
293
  ruby-progressbar (1.13.0)
288
- rubyzip (3.4.1)
294
+ rubyzip (3.7.0)
289
295
  securerandom (0.4.1)
290
- selenium-webdriver (4.44.0)
296
+ selenium-webdriver (4.51.0)
291
297
  base64 (~> 0.2)
292
298
  logger (~> 1.4)
293
- rexml (~> 3.2, >= 3.2.5)
294
299
  rubyzip (>= 1.2.2, < 4.0)
295
300
  websocket (~> 1.0)
296
301
  srt (0.1.5)
@@ -311,6 +316,8 @@ GEM
311
316
  faraday-multipart (~> 1.0)
312
317
  virtus (~> 2.0)
313
318
  thread_safe (0.3.6)
319
+ timeout (0.6.1)
320
+ tsort (0.2.0)
314
321
  tty-color (0.6.0)
315
322
  tty-screen (0.8.2)
316
323
  tty-table (0.12.0)
@@ -324,22 +331,21 @@ GEM
324
331
  eac_ruby_utils (~> 0.129)
325
332
  unicode-display_width (2.6.0)
326
333
  unicode_utils (1.4.0)
327
- uri (1.1.1)
334
+ uri (1.1.2)
328
335
  virtus (2.0.0)
329
336
  axiom-types (~> 0.1)
330
337
  coercible (~> 1.0)
331
338
  descendants_tracker (~> 0.0, >= 0.0.3)
332
339
  webrick (1.9.2)
333
340
  websocket (1.2.11)
334
- zeitwerk (2.8.2)
335
- zlib (3.2.3)
341
+ zeitwerk (2.8.3)
342
+ zlib (3.2.4)
336
343
 
337
344
  PLATFORMS
338
345
  x86_64-linux-gnu
339
346
 
340
347
  DEPENDENCIES
341
- eac_envs-http!
342
- eac_ruby_gem_support (~> 0.14)
348
+ eac_ruby_gem_support (~> 0.15)
343
349
  ehbrs-tools!
344
350
  ehbrs_ruby_utils!
345
351
 
@@ -5,57 +5,143 @@ module Ehbrs
5
5
  class Runner
6
6
  class Finances
7
7
  class BbBrowser
8
+ CONTAINER_ENV_FORMAT = '{{range .Config.Env}}{{println .}}{{end}}'
9
+ DEFAULT_CONTAINER_NAME = 'ehbrs-tools-bb-browser'
10
+ DEFAULT_DOCKER_COMMAND = 'podman'
11
+ DOWNLOADS_CONTAINER_PATH = '/downloads'
12
+ NOVNC_ADDRESS = '127.0.0.1'
13
+ NOVNC_CONTAINER_PORT = 6080
14
+ NOVNC_HOST_PORT = 6080
15
+ PODMAN_RUN_EXTRA_ARGS = %w[--userns=keep-id --user 0].freeze
16
+ SHM_SIZE = '2g'
17
+ VNC_PASSWORD_LENGTH = 8
18
+
8
19
  runner_with :help do
9
20
  desc 'Bankline para Banco do Brasil com módulo de segurança.'
21
+ arg_opt '-n', '--container-name', 'Nome do contêiner.',
22
+ default: DEFAULT_CONTAINER_NAME
10
23
  end
11
24
 
12
25
  def run
13
- infov 'Docker run arguments', ::Shellwords.join(docker_container.run_command_args)
14
- infov 'System result', docker_container.run_command.system
26
+ setup_docker_command
27
+ infov 'Container name', parsed.container_name
28
+ infov 'Browser URL', browser_url
29
+ open_browser_when_ready
30
+ infov 'System result', container_command.system
15
31
  end
16
32
 
17
33
  private
18
34
 
19
- def docker_image_uncached
20
- ::EhbrsRubyUtils::Finances::BbBrowser::DockerImage.create
35
+ # @return [String]
36
+ memoize def browser_url
37
+ "http://#{NOVNC_ADDRESS}:#{NOVNC_HOST_PORT}/vnc.html?autoconnect=1&resize=remote" \
38
+ "&password=#{vnc_password}"
21
39
  end
22
40
 
23
- def docker_container_uncached
24
- r = docker_image.container
25
- .temporary(true).interactive(true).tty(true)
26
- .command_arg('seg.bb.com.br')
27
- %w[capabilities environment_variables volumes].inject(r) do |a, e|
28
- send("docker_container_#{e}", a)
41
+ # @return [EacRubyUtils::Envs::Command]
42
+ def container_command
43
+ if container_exist?
44
+ docker_container.start_command
45
+ else
46
+ docker_container.env('VNC_PASSWORD', vnc_password)
47
+ .run_command(docker_run_extra_args)
29
48
  end
30
49
  end
31
50
 
32
- def docker_container_capabilities(container)
33
- %w[CAP_AUDIT_WRITE CAP_SYS_PTRACE].inject(container) { |a, e| a.capability(e) }
51
+ # @return [Hash<String, String>]
52
+ def container_env
53
+ ::EacDocker::Executables.docker
54
+ .command('container', 'inspect', '--format', CONTAINER_ENV_FORMAT,
55
+ parsed.container_name)
56
+ .execute!.lines.filter_map { |line| line.chomp.split('=', 2).presence }.to_h
57
+ end
58
+
59
+ # @return [Boolean]
60
+ memoize def container_exist?
61
+ docker_container.exist?
62
+ end
63
+
64
+ # @return [EacDocker::Container]
65
+ memoize def docker_container
66
+ r = docker_image.container.name(parsed.container_name).interactive(true).tty(true)
67
+ %w[environment_variables volumes].inject(r) do |a, e|
68
+ send("docker_container_#{e}", a)
69
+ end
34
70
  end
35
71
 
72
+ # @param container [EacDocker::Container]
73
+ # @return [EacDocker::Container]
36
74
  def docker_container_environment_variables(container)
37
75
  {
38
- 'USER_UID' => user_id,
39
- 'USER_GID' => group_id
76
+ 'USER_GID' => group_id,
77
+ 'USER_UID' => user_id
40
78
  }.inject(container) { |a, e| a.env(e[0], e[1]) }
41
79
  end
42
80
 
81
+ # @param container [EacDocker::Container]
82
+ # @return [EacDocker::Container]
43
83
  def docker_container_volumes(container)
44
- {
45
- ::File.join(Dir.home, 'Downloads') => '/home/user/Downloads',
46
- ::File.join(Dir.home, '.Xauthority') => '/home/user/.Xauthority:ro',
47
- '/tmp/.X11-unix' => '/tmp/.X11-unix:ro',
48
- '/etc/machine-id' => '/etc/machine-id:ro'
49
- }.inject(container) { |a, e| a.volume(e[0], e[1]) }
84
+ container.volume(::File.join(Dir.home, 'Downloads'), DOWNLOADS_CONTAINER_PATH)
50
85
  end
51
86
 
52
- def user_id
53
- ::EacRubyUtils::Envs.local.command('id', '-u').execute!.strip
87
+ # @return [EhbrsRubyUtils::Finances::BbBrowser::DockerImage]
88
+ memoize def docker_image
89
+ ::EhbrsRubyUtils::Finances::BbBrowser::DockerImage.create
54
90
  end
55
91
 
92
+ # @return [Array<String>]
93
+ def docker_run_extra_args
94
+ ['--init', '--shm-size', SHM_SIZE, '--publish',
95
+ "#{NOVNC_ADDRESS}:#{NOVNC_HOST_PORT}:#{NOVNC_CONTAINER_PORT}"] +
96
+ (podman? ? PODMAN_RUN_EXTRA_ARGS : [])
97
+ end
98
+
99
+ # @return [String]
56
100
  def group_id
57
101
  ::EacRubyUtils::Envs.local.command('id', '-g').execute!.strip
58
102
  end
103
+
104
+ # @return [Boolean]
105
+ def novnc_ready?
106
+ ::Net::HTTP.get_response(::URI.parse(browser_url)).is_a?(::Net::HTTPSuccess)
107
+ rescue ::SystemCallError, ::IOError
108
+ false
109
+ end
110
+
111
+ # @return [void]
112
+ def open_browser
113
+ ::EacRubyUtils::Envs.local.command('xdg-open', browser_url).execute
114
+ end
115
+
116
+ # @return [Thread]
117
+ def open_browser_when_ready
118
+ ::Thread.new do
119
+ sleep 1 until novnc_ready?
120
+ open_browser
121
+ end
122
+ end
123
+
124
+ # @return [Boolean]
125
+ memoize def podman?
126
+ ::EacDocker::Executables.docker.command('--version').execute!.downcase.include?('podman')
127
+ end
128
+
129
+ # @return [void]
130
+ def setup_docker_command
131
+ ENV[::EacDocker::Executables.docker.executable_args_envvar] ||= DEFAULT_DOCKER_COMMAND
132
+ end
133
+
134
+ # @return [String]
135
+ def user_id
136
+ ::EacRubyUtils::Envs.local.command('id', '-u').execute!.strip
137
+ end
138
+
139
+ # @return [String]
140
+ memoize def vnc_password
141
+ return container_env.fetch('VNC_PASSWORD') if container_exist?
142
+
143
+ ::SecureRandom.alphanumeric(VNC_PASSWORD_LENGTH)
144
+ end
59
145
  end
60
146
  end
61
147
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ehbrs
4
4
  module Tools
5
- VERSION = '0.45.2'
5
+ VERSION = '0.46.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ehbrs-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.45.2
4
+ version: 0.46.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-07-30 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: avm-tools
@@ -39,7 +38,7 @@ dependencies:
39
38
  version: '0.47'
40
39
  - - ">="
41
40
  - !ruby/object:Gem::Version
42
- version: 0.47.1
41
+ version: 0.47.2
43
42
  type: :runtime
44
43
  prerelease: false
45
44
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +48,7 @@ dependencies:
49
48
  version: '0.47'
50
49
  - - ">="
51
50
  - !ruby/object:Gem::Version
52
- version: 0.47.1
51
+ version: 0.47.2
53
52
  - !ruby/object:Gem::Dependency
54
53
  name: eac_fs
55
54
  requirement: !ruby/object:Gem::Requirement
@@ -59,7 +58,7 @@ dependencies:
59
58
  version: '0.20'
60
59
  - - ">="
61
60
  - !ruby/object:Gem::Version
62
- version: 0.20.2
61
+ version: 0.20.3
63
62
  type: :runtime
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,27 +68,21 @@ dependencies:
69
68
  version: '0.20'
70
69
  - - ">="
71
70
  - !ruby/object:Gem::Version
72
- version: 0.20.2
71
+ version: 0.20.3
73
72
  - !ruby/object:Gem::Dependency
74
73
  name: eac_ruby_base0
75
74
  requirement: !ruby/object:Gem::Requirement
76
75
  requirements:
77
76
  - - "~>"
78
77
  - !ruby/object:Gem::Version
79
- version: '0.19'
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 0.19.3
78
+ version: '0.22'
83
79
  type: :runtime
84
80
  prerelease: false
85
81
  version_requirements: !ruby/object:Gem::Requirement
86
82
  requirements:
87
83
  - - "~>"
88
84
  - !ruby/object:Gem::Version
89
- version: '0.19'
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: 0.19.3
85
+ version: '0.22'
93
86
  - !ruby/object:Gem::Dependency
94
87
  name: eac_ruby_base1
95
88
  requirement: !ruby/object:Gem::Requirement
@@ -97,9 +90,9 @@ dependencies:
97
90
  - - "~>"
98
91
  - !ruby/object:Gem::Version
99
92
  version: '0.1'
100
- - - "~>"
93
+ - - ">="
101
94
  - !ruby/object:Gem::Version
102
- version: 0.1.1
95
+ version: 0.1.2
103
96
  type: :runtime
104
97
  prerelease: false
105
98
  version_requirements: !ruby/object:Gem::Requirement
@@ -107,29 +100,23 @@ dependencies:
107
100
  - - "~>"
108
101
  - !ruby/object:Gem::Version
109
102
  version: '0.1'
110
- - - "~>"
103
+ - - ">="
111
104
  - !ruby/object:Gem::Version
112
- version: 0.1.1
105
+ version: 0.1.2
113
106
  - !ruby/object:Gem::Dependency
114
107
  name: ehbrs_ruby_utils
115
108
  requirement: !ruby/object:Gem::Requirement
116
109
  requirements:
117
110
  - - "~>"
118
111
  - !ruby/object:Gem::Version
119
- version: '0.49'
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: 0.49.2
112
+ version: '0.51'
123
113
  type: :runtime
124
114
  prerelease: false
125
115
  version_requirements: !ruby/object:Gem::Requirement
126
116
  requirements:
127
117
  - - "~>"
128
118
  - !ruby/object:Gem::Version
129
- version: '0.49'
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: 0.49.2
119
+ version: '0.51'
133
120
  - !ruby/object:Gem::Dependency
134
121
  name: filesize
135
122
  requirement: !ruby/object:Gem::Requirement
@@ -184,16 +171,14 @@ dependencies:
184
171
  requirements:
185
172
  - - "~>"
186
173
  - !ruby/object:Gem::Version
187
- version: '0.14'
174
+ version: '0.15'
188
175
  type: :development
189
176
  prerelease: false
190
177
  version_requirements: !ruby/object:Gem::Requirement
191
178
  requirements:
192
179
  - - "~>"
193
180
  - !ruby/object:Gem::Version
194
- version: '0.14'
195
- description:
196
- email:
181
+ version: '0.15'
197
182
  executables:
198
183
  - ehbrs
199
184
  extensions: []
@@ -274,10 +259,8 @@ files:
274
259
  - template/ehbrs/cooking_book/build/index_page/inner.html.erb
275
260
  - template/ehbrs/cooking_book/build/recipe_page/inner.html.erb
276
261
  - template/ehbrs/cooking_book/build/recipe_page/part.html.erb
277
- homepage:
278
262
  licenses: []
279
263
  metadata: {}
280
- post_install_message:
281
264
  rdoc_options: []
282
265
  require_paths:
283
266
  - lib
@@ -292,8 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
275
  - !ruby/object:Gem::Version
293
276
  version: '0'
294
277
  requirements: []
295
- rubygems_version: 3.4.19
296
- signing_key:
278
+ rubygems_version: 3.6.9
297
279
  specification_version: 4
298
280
  summary: Tools for EHB/RS.
299
281
  test_files: []