ehbrs-tools 0.39.1 → 0.40.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37d5bc6d09fd99c2b19fac22bbebd6c6817d88f1542d9eea927f7d40189be1b6
4
- data.tar.gz: ae180d116b7de37be4e2f9a38aa9b06daa0ac6ef31631ed9c151ee46a140ee5e
3
+ metadata.gz: afba1515a9a95f71e7f9ef4846ed767259fb791149c440e98dc56611c7d09104
4
+ data.tar.gz: 41bfc93b95a4d43300207e83b1f4958f27e273ee5a622e9f2a8d8220a8c44dc8
5
5
  SHA512:
6
- metadata.gz: f1294ab961b7a4ef0193cb25a582eea593930bdd9afb51850e2956c775de0094ad768a40b70e9f029285ee6880ee219294207f57a52156458e31c403000102c6
7
- data.tar.gz: cdc973943f214f78198c8f8d31052b21a03c1c6b3dd51c9758b43fc55049063f691ac6181249f45688484f90bde0b177fd91c5d1f3b08d623861582b38736560
6
+ metadata.gz: a3098c00fbcc328113d82d76801187dbd1cb85ec3b08a6a786fc6c7c00b49e550db32ff0e0ba6fd58d1301075c3ca9807e95087bce9aa318c33aff4b84408d1a
7
+ data.tar.gz: 1c5a15956bd810fb96d390872584a0aa3431e3da22ec1d39c0b942fff34c9fe6fe78f6c08267415bdc984a667e2fccb1811ddbe3ff8a9ea857ec571b42445d9d
data/Gemfile.lock CHANGED
@@ -1,37 +1,29 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ehbrs-tools (0.39.1)
5
- avm-tools (~> 0.159)
6
- eac_cli (~> 0.40)
7
- eac_ruby_utils (~> 0.120)
8
- ehbrs_ruby_utils (~> 0.41)
4
+ ehbrs-tools (0.40.0)
5
+ avm-files (~> 0.7)
6
+ eac_cli (~> 0.40, >= 0.40.1)
7
+ eac_ruby_base0 (~> 0.19)
8
+ eac_ruby_utils (~> 0.121)
9
+ ehbrs_ruby_utils (~> 0.41, >= 0.41.2)
9
10
  filesize (~> 0.2)
10
11
  os (~> 1.1, >= 1.1.4)
11
12
  telegram-bot-ruby (~> 0.23)
12
13
 
13
- PATH
14
- remote: sub/eac_cli
15
- specs:
16
- eac_cli (0.40.0)
17
- colorize (~> 0.8, >= 0.8.1)
18
- eac_config (~> 0.14, >= 0.14.1)
19
- eac_ruby_utils (~> 0.120)
20
- tty-table (~> 0.12)
21
-
22
14
  PATH
23
15
  remote: sub/ehbrs_ruby_utils
24
16
  specs:
25
- ehbrs_ruby_utils (0.41.0)
17
+ ehbrs_ruby_utils (0.41.2)
26
18
  aranha (~> 0.19, >= 0.19.2)
27
19
  aranha-parsers (~> 0.22)
28
- aranha-selenium (~> 0.8)
29
- avm (~> 0.84, >= 0.84.2)
20
+ aranha-selenium (~> 0.10, >= 0.10.1)
21
+ avm (~> 0.90, >= 0.90.1)
30
22
  dentaku (~> 3.5, >= 3.5.2)
31
23
  eac_fs (~> 0.17)
32
24
  eac_rest (~> 0.12)
33
- eac_ruby_utils (~> 0.120)
34
- eac_templates (~> 0.5)
25
+ eac_ruby_utils (~> 0.121)
26
+ eac_templates (~> 0.5, >= 0.5.1)
35
27
  inifile (~> 3.0)
36
28
  srt (~> 0.1, >= 0.1.5)
37
29
  taglib-ruby (~> 1.1, >= 1.1.3)
@@ -40,7 +32,7 @@ PATH
40
32
  GEM
41
33
  remote: https://rubygems.org/
42
34
  specs:
43
- activesupport (6.1.7.6)
35
+ activesupport (6.1.7.7)
44
36
  concurrent-ruby (~> 1.0, >= 1.0.2)
45
37
  i18n (>= 1.6, < 2)
46
38
  minitest (>= 5.1)
@@ -59,85 +51,62 @@ GEM
59
51
  eac_ruby_utils (~> 0.119, >= 0.119.2)
60
52
  nokogiri (~> 1.15, >= 1.15.4)
61
53
  ofx-parser (~> 1.1)
62
- aranha-selenium (0.8.0)
54
+ aranha-selenium (0.10.1)
63
55
  eac_fs (~> 0.17)
64
- eac_ruby_utils (~> 0.120)
56
+ eac_ruby_utils (~> 0.121)
57
+ eac_templates (~> 0.5, >= 0.5.1)
65
58
  selenium-webdriver (~> 3.142, >= 3.142.7)
66
59
  ast (2.4.2)
67
- avm (0.84.2)
68
- aranha-parsers (~> 0.22)
69
- eac_cli (~> 0.39)
70
- eac_config (~> 0.14, >= 0.14.1)
60
+ avm (0.90.1)
61
+ eac_cli (~> 0.40, >= 0.40.1)
62
+ eac_config (~> 0.14, >= 0.14.2)
71
63
  eac_docker (~> 0.7)
72
- eac_fs (~> 0.16)
73
- eac_git (~> 0.14, >= 0.14.1)
74
- eac_ruby_utils (~> 0.120)
75
- eac_templates (~> 0.5)
76
- filesize (~> 0.2)
77
- htmlbeautifier (~> 1.4, >= 1.4.2)
64
+ eac_fs (~> 0.17)
65
+ eac_ruby_utils (~> 0.121)
66
+ eac_templates (~> 0.5, >= 0.5.1)
78
67
  minitar (~> 0.9)
79
- avm-eac_generic_base0 (0.12.2)
80
- avm (~> 0.84, >= 0.84.2)
81
- eac_ruby_utils (~> 0.120)
68
+ ruby-progressbar (~> 1.13)
69
+ avm-eac_generic_base0 (0.13.0)
70
+ avm (~> 0.90)
71
+ eac_ruby_utils (~> 0.121)
82
72
  avm-eac_ruby_base1 (0.33.1)
83
73
  aranha-parsers (~> 0.22)
84
74
  avm (~> 0.84)
85
75
  avm-eac_generic_base0 (~> 0.12, >= 0.12.1)
86
76
  eac_envs-http (~> 0.4, >= 0.4.1)
87
77
  eac_ruby_utils (~> 0.119, >= 0.119.2)
88
- avm-eac_ubuntu_base0 (0.5.0)
89
- avm (~> 0.77)
90
- eac_ruby_utils (~> 0.117, >= 0.117.1)
91
- eac_templates (~> 0.5)
92
- avm-files (0.6.2)
93
- avm (~> 0.67, >= 0.67.1)
94
- eac_cli (~> 0.30, >= 0.30.1)
95
- eac_fs (~> 0.16)
96
- eac_ruby_utils (~> 0.112)
97
- eac_templates (~> 0.5)
98
- avm-git (0.14.0)
99
- avm (~> 0.82)
100
- avm-files (~> 0.6, >= 0.6.2)
101
- eac_git (~> 0.14, >= 0.14.1)
102
- eac_ruby_utils (~> 0.119, >= 0.119.2)
103
- git (~> 1.18)
104
- avm-tools (0.159.0)
105
- aranha-parsers (~> 0.21)
106
- avm (~> 0.83)
107
- avm-eac_ruby_base1 (~> 0.33)
108
- avm-eac_ubuntu_base0 (~> 0.5)
109
- avm-files (~> 0.6, >= 0.6.2)
110
- avm-git (~> 0.14)
111
- clipboard (~> 1.3, >= 1.3.6)
112
- curb (~> 0.9, >= 0.9.11)
113
- eac_git (~> 0.14, >= 0.14.1)
114
- eac_ruby_base0 (~> 0.19)
115
- eac_templates (~> 0.5)
116
- git (~> 1.18)
117
- ruby-progressbar (~> 1.13)
78
+ avm-files (0.7.0)
79
+ avm (~> 0.84, >= 0.84.2)
80
+ eac_cli (~> 0.40)
81
+ eac_fs (~> 0.17)
82
+ eac_ruby_utils (~> 0.121)
83
+ eac_templates (~> 0.5, >= 0.5.1)
118
84
  axiom-types (0.1.1)
119
85
  descendants_tracker (~> 0.0.4)
120
86
  ice_nine (~> 0.11.0)
121
87
  thread_safe (~> 0.3, >= 0.3.1)
122
88
  base64 (0.2.0)
123
89
  childprocess (3.0.0)
124
- clipboard (1.3.6)
125
90
  coercible (1.0.0)
126
91
  descendants_tracker (~> 0.0.1)
127
92
  colorize (0.8.1)
128
93
  concurrent-ruby (1.2.3)
129
94
  content-type (0.0.2)
130
95
  parslet (~> 2.0)
131
- curb (0.9.11)
132
96
  dentaku (3.5.2)
133
97
  concurrent-ruby
134
98
  descendants_tracker (0.0.4)
135
99
  thread_safe (~> 0.3, >= 0.3.1)
136
- diff-lcs (1.5.0)
100
+ diff-lcs (1.5.1)
137
101
  dry-inflector (1.0.0)
138
- eac_config (0.14.1)
139
- addressable (~> 2.8, >= 2.8.5)
140
- eac_ruby_utils (~> 0.119, >= 0.119.2)
102
+ eac_cli (0.40.1)
103
+ colorize (~> 0.8, >= 0.8.1)
104
+ eac_config (~> 0.14, >= 0.14.2)
105
+ eac_ruby_utils (~> 0.121)
106
+ tty-table (~> 0.12)
107
+ eac_config (0.14.2)
108
+ addressable (~> 2.8, >= 2.8.6)
109
+ eac_ruby_utils (~> 0.121)
141
110
  eac_docker (0.7.0)
142
111
  eac_ruby_utils (~> 0.112)
143
112
  eac_templates (~> 0.3, >= 0.3.2)
@@ -153,9 +122,6 @@ GEM
153
122
  content-type (~> 0.0, >= 0.0.2)
154
123
  eac_ruby_utils (~> 0.120)
155
124
  ruby-filemagic (~> 0.7, >= 0.7.3)
156
- eac_git (0.15.0)
157
- eac_ruby_utils (~> 0.120)
158
- parseconfig (~> 1.1, >= 1.1.2)
159
125
  eac_rest (0.12.0)
160
126
  eac_envs-http (~> 0.5)
161
127
  eac_fs (~> 0.16)
@@ -165,21 +131,21 @@ GEM
165
131
  eac_cli (~> 0.35)
166
132
  eac_fs (~> 0.16)
167
133
  eac_ruby_utils (~> 0.117)
168
- eac_ruby_gem_support (0.9.0)
169
- eac_ruby_utils (~> 0.119, >= 0.119.2)
134
+ eac_ruby_gem_support (0.10.0)
135
+ eac_ruby_utils (~> 0.120)
170
136
  rspec (~> 3.12)
171
- rubocop (~> 1.57, >= 1.57.2)
172
- rubocop-rails (~> 2.22, >= 2.22.1)
173
- rubocop-rspec (~> 2.25)
174
- eac_ruby_utils (0.120.0)
137
+ rubocop (~> 1.60, >= 1.60.1)
138
+ rubocop-rails (~> 2.23, >= 2.23.1)
139
+ rubocop-rspec (~> 2.26, >= 2.26.1)
140
+ eac_ruby_utils (0.121.0)
175
141
  activesupport (>= 4, < 7)
176
- addressable (~> 2.8, >= 2.8.5)
142
+ addressable (~> 2.8, >= 2.8.6)
177
143
  bundler
178
144
  filesize (~> 0.2)
179
145
  net-ssh (~> 4.2)
180
- eac_templates (0.5.0)
181
- eac_config (~> 0.12)
182
- eac_ruby_utils (~> 0.112)
146
+ eac_templates (0.5.1)
147
+ eac_config (~> 0.14, >= 0.14.1)
148
+ eac_ruby_utils (~> 0.121)
183
149
  faraday (2.8.1)
184
150
  base64
185
151
  faraday-net_http (>= 2.0, < 3.1)
@@ -192,58 +158,52 @@ GEM
192
158
  faraday-multipart (1.0.4)
193
159
  multipart-post (~> 2)
194
160
  faraday-net_http (3.0.2)
195
- faraday-retry (2.2.0)
161
+ faraday-retry (2.2.1)
196
162
  faraday (~> 2.0)
197
163
  filesize (0.2.0)
198
- git (1.19.1)
199
- addressable (~> 2.8)
200
- rchardet (~> 1.8)
201
164
  hpricot (0.8.6)
202
- htmlbeautifier (1.4.2)
203
- i18n (1.14.1)
165
+ i18n (1.14.5)
204
166
  concurrent-ruby (~> 1.0)
205
167
  ice_nine (0.11.2)
206
168
  inifile (3.0.0)
207
- json (2.7.1)
169
+ json (2.7.2)
208
170
  language_server-protocol (3.17.0.3)
209
171
  minitar (0.9)
210
- minitest (5.21.1)
211
- multipart-post (2.3.0)
172
+ minitest (5.22.3)
173
+ multipart-post (2.4.1)
212
174
  net-ssh (4.2.0)
213
- nokogiri (1.15.5-x86_64-linux)
175
+ nokogiri (1.15.6-x86_64-linux)
214
176
  racc (~> 1.4)
215
177
  ofx-parser (1.1.0)
216
178
  hpricot (>= 0.6)
217
179
  os (1.1.4)
218
180
  parallel (1.24.0)
219
- parseconfig (1.1.2)
220
- parser (3.3.0.4)
181
+ parser (3.3.1.0)
221
182
  ast (~> 2.4.1)
222
183
  racc
223
184
  parslet (2.0.0)
224
185
  pastel (0.8.0)
225
186
  tty-color (~> 0.5)
226
- public_suffix (5.0.4)
187
+ public_suffix (5.0.5)
227
188
  racc (1.7.3)
228
- rack (3.0.8)
189
+ rack (3.0.11)
229
190
  rainbow (3.1.1)
230
- rchardet (1.8.0)
231
- regexp_parser (2.9.0)
191
+ regexp_parser (2.9.1)
232
192
  rexml (3.2.6)
233
- rspec (3.12.0)
234
- rspec-core (~> 3.12.0)
235
- rspec-expectations (~> 3.12.0)
236
- rspec-mocks (~> 3.12.0)
237
- rspec-core (3.12.2)
238
- rspec-support (~> 3.12.0)
239
- rspec-expectations (3.12.3)
193
+ rspec (3.13.0)
194
+ rspec-core (~> 3.13.0)
195
+ rspec-expectations (~> 3.13.0)
196
+ rspec-mocks (~> 3.13.0)
197
+ rspec-core (3.13.0)
198
+ rspec-support (~> 3.13.0)
199
+ rspec-expectations (3.13.0)
240
200
  diff-lcs (>= 1.2.0, < 2.0)
241
- rspec-support (~> 3.12.0)
242
- rspec-mocks (3.12.6)
201
+ rspec-support (~> 3.13.0)
202
+ rspec-mocks (3.13.1)
243
203
  diff-lcs (>= 1.2.0, < 2.0)
244
- rspec-support (~> 3.12.0)
245
- rspec-support (3.12.1)
246
- rubocop (1.60.0)
204
+ rspec-support (~> 3.13.0)
205
+ rspec-support (3.13.1)
206
+ rubocop (1.63.5)
247
207
  json (~> 2.3)
248
208
  language_server-protocol (>= 3.17.0)
249
209
  parallel (~> 1.10)
@@ -251,24 +211,27 @@ GEM
251
211
  rainbow (>= 2.2.2, < 4.0)
252
212
  regexp_parser (>= 1.8, < 3.0)
253
213
  rexml (>= 3.2.5, < 4.0)
254
- rubocop-ast (>= 1.30.0, < 2.0)
214
+ rubocop-ast (>= 1.31.1, < 2.0)
255
215
  ruby-progressbar (~> 1.7)
256
216
  unicode-display_width (>= 2.4.0, < 3.0)
257
- rubocop-ast (1.30.0)
258
- parser (>= 3.2.1.0)
217
+ rubocop-ast (1.31.3)
218
+ parser (>= 3.3.1.0)
259
219
  rubocop-capybara (2.20.0)
260
220
  rubocop (~> 1.41)
261
221
  rubocop-factory_bot (2.25.1)
262
222
  rubocop (~> 1.41)
263
- rubocop-rails (2.23.1)
223
+ rubocop-rails (2.24.1)
264
224
  activesupport (>= 4.2.0)
265
225
  rack (>= 1.1)
266
226
  rubocop (>= 1.33.0, < 2.0)
267
- rubocop-ast (>= 1.30.0, < 2.0)
268
- rubocop-rspec (2.26.1)
227
+ rubocop-ast (>= 1.31.1, < 2.0)
228
+ rubocop-rspec (2.29.2)
269
229
  rubocop (~> 1.40)
270
230
  rubocop-capybara (~> 2.17)
271
231
  rubocop-factory_bot (~> 2.22)
232
+ rubocop-rspec_rails (~> 2.28)
233
+ rubocop-rspec_rails (2.28.3)
234
+ rubocop (~> 1.40)
272
235
  ruby-filemagic (0.7.3)
273
236
  ruby-progressbar (1.13.0)
274
237
  ruby2_keywords (0.0.5)
@@ -306,17 +269,16 @@ GEM
306
269
  axiom-types (~> 0.1)
307
270
  coercible (~> 1.0)
308
271
  descendants_tracker (~> 0.0, >= 0.0.3)
309
- zeitwerk (2.6.12)
272
+ zeitwerk (2.6.13)
310
273
  zlib (2.1.1)
311
274
 
312
275
  PLATFORMS
313
276
  x86_64-linux
314
277
 
315
278
  DEPENDENCIES
316
- eac_cli!
317
279
  eac_ruby_gem_support (~> 0.9)
318
280
  ehbrs-tools!
319
281
  ehbrs_ruby_utils!
320
282
 
321
283
  BUNDLED WITH
322
- 2.4.19
284
+ 2.4.22
@@ -11,10 +11,38 @@ module Ehbrs
11
11
  class Spread
12
12
  runner_with :help do
13
13
  bool_opt '-i', '--ids', 'Escreve IDs em STDOUT no lugar de labels em STDERR.'
14
+ bool_opt '-v', '--verbose'
14
15
  pos_arg :albums, repeat: true
15
16
  end
16
17
 
17
18
  def run
19
+ start_info
20
+ show_results
21
+ end
22
+
23
+ def spreader_uncached
24
+ ::EhbrsRubyUtils::CircularListSpreader.new(albums)
25
+ end
26
+
27
+ protected
28
+
29
+ # @return [Array<EhbrsRubyUtils::Music::Ous::Album>]
30
+ def albums_uncached
31
+ parsed.albums.map do |path|
32
+ ::EhbrsRubyUtils::Music::Ous::Album.new(path)
33
+ end
34
+ end
35
+
36
+ # @return [void]
37
+ def albums_info
38
+ infov 'Albums', albums.count
39
+ albums.each do |album|
40
+ infov ' * ', album
41
+ end
42
+ end
43
+
44
+ # @return [void]
45
+ def show_results
18
46
  spreader.result.each do |album|
19
47
  if parsed.ids?
20
48
  out("#{album.id}\n")
@@ -24,14 +52,11 @@ module Ehbrs
24
52
  end
25
53
  end
26
54
 
27
- def spreader_uncached
28
- ::EhbrsRubyUtils::CircularListSpreader.new(albums)
29
- end
55
+ # @return [void]
56
+ def start_info
57
+ return unless parsed.verbose?
30
58
 
31
- def albums
32
- parsed.albums.map do |path|
33
- ::EhbrsRubyUtils::Music::Ous::Album.new(path)
34
- end
59
+ albums_info
35
60
  end
36
61
  end
37
62
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ehbrs
4
4
  module Tools
5
- VERSION = '0.39.1'
5
+ VERSION = '0.40.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ehbrs-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.1
4
+ version: 0.40.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-17 00:00:00.000000000 Z
11
+ date: 2024-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: avm-tools
14
+ name: avm-files
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.159'
19
+ version: '0.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.159'
26
+ version: '0.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: eac_cli
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.40'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 0.40.1
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,20 +41,37 @@ dependencies:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
43
  version: '0.40'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.40.1
47
+ - !ruby/object:Gem::Dependency
48
+ name: eac_ruby_base0
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.19'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.19'
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: eac_ruby_utils
43
63
  requirement: !ruby/object:Gem::Requirement
44
64
  requirements:
45
65
  - - "~>"
46
66
  - !ruby/object:Gem::Version
47
- version: '0.120'
67
+ version: '0.121'
48
68
  type: :runtime
49
69
  prerelease: false
50
70
  version_requirements: !ruby/object:Gem::Requirement
51
71
  requirements:
52
72
  - - "~>"
53
73
  - !ruby/object:Gem::Version
54
- version: '0.120'
74
+ version: '0.121'
55
75
  - !ruby/object:Gem::Dependency
56
76
  name: ehbrs_ruby_utils
57
77
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +79,9 @@ dependencies:
59
79
  - - "~>"
60
80
  - !ruby/object:Gem::Version
61
81
  version: '0.41'
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 0.41.2
62
85
  type: :runtime
63
86
  prerelease: false
64
87
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,6 +89,9 @@ dependencies:
66
89
  - - "~>"
67
90
  - !ruby/object:Gem::Version
68
91
  version: '0.41'
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 0.41.2
69
95
  - !ruby/object:Gem::Dependency
70
96
  name: filesize
71
97
  requirement: !ruby/object:Gem::Requirement
@@ -200,8 +226,6 @@ files:
200
226
  - lib/ehbrs/tools/runner/web_utils/videos.rb
201
227
  - lib/ehbrs/tools/runner/web_utils/videos/download.rb
202
228
  - lib/ehbrs/tools/runner/web_utils/videos/upload.rb
203
- - lib/ehbrs/tools/runner_with.rb
204
- - lib/ehbrs/tools/runner_with/filesystem_renamer.rb
205
229
  - lib/ehbrs/tools/version.rb
206
230
  - lib/ehbrs/user_dirs.rb
207
231
  - template/ehbrs/cooking_book/build/base_page/layout.html.erb
@@ -1,103 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_cli/core_ext'
4
-
5
- module Ehbrs
6
- module Tools
7
- module RunnerWith
8
- module FilesystemRenamer
9
- common_concern do
10
- runner_with :confirmation, :filesystem_traverser
11
- prepend PrependMethods
12
- end
13
-
14
- class RenameFile
15
- enable_speaker
16
- common_constructor :runner, :file
17
- delegate :path, :target_path, :valid?, to: :file
18
-
19
- CONFIRM_MESSAGE = 'Rename?'
20
-
21
- def show
22
- if rename?
23
- puts [target_path_to_s, '<='.green, path_to_s].join(' ')
24
- else
25
- puts path_to_s
26
- end
27
- end
28
-
29
- def rename
30
- return unless rename?
31
-
32
- show
33
- do_rename if runner.confirm?(CONFIRM_MESSAGE)
34
- end
35
-
36
- # @return [Boolean]
37
- def rename?
38
- path.to_pathname != target_path.to_pathname
39
- end
40
-
41
- private
42
-
43
- def do_rename
44
- ::FileUtils.mv(path, target_path)
45
- end
46
-
47
- # @return [String]
48
- def path_to_s
49
- path.basename.to_path.light_black
50
- end
51
-
52
- # @return [String]
53
- def target_path_to_s
54
- target_path.relative_path_from(path.dirname).to_path
55
- end
56
- end
57
-
58
- module PrependMethods
59
- # @param path [Pathname]
60
- # @return [void]
61
- def traverser_check_file(path)
62
- file = RenameFile.new(self, file_class.new(path))
63
- files << file if file.valid?
64
- end
65
- end
66
-
67
- FILE_WRAPPER_CLASS_BASENAME = 'FileWrapper'
68
-
69
- # @return [Class]
70
- def file_class
71
- self.class.const_get(FILE_WRAPPER_CLASS_BASENAME)
72
- end
73
-
74
- # @return [void]
75
- def run_filesystem_renamer
76
- self.files = []
77
- run_filesystem_traverser
78
- show_files
79
- rename_files
80
- success 'Done'
81
- end
82
-
83
- # @return [void]
84
- def show_files
85
- infov 'Files found', files.count
86
- files.each(&:show)
87
- end
88
-
89
- # @return [void]
90
- def rename_files
91
- return if parsed.no? || files.none?(&:rename?)
92
-
93
- infom 'Renaming files...'
94
- files.each(&:rename)
95
- end
96
-
97
- private
98
-
99
- attr_accessor :files
100
- end
101
- end
102
- end
103
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Ehbrs
6
- module Tools
7
- module RunnerWith
8
- require_sub __FILE__
9
- end
10
- end
11
- end