ehbrs-tools 0.39.1 → 0.41.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: 4d7f1950bd86260645e7a5bb92ec7fcb41c59c8331385f2a277c685be0ca470d
4
+ data.tar.gz: 9d8ddf77d0b5d447a6d223f30e3c9206ba97a84674219512b76cf844010f6051
5
5
  SHA512:
6
- metadata.gz: f1294ab961b7a4ef0193cb25a582eea593930bdd9afb51850e2956c775de0094ad768a40b70e9f029285ee6880ee219294207f57a52156458e31c403000102c6
7
- data.tar.gz: cdc973943f214f78198c8f8d31052b21a03c1c6b3dd51c9758b43fc55049063f691ac6181249f45688484f90bde0b177fd91c5d1f3b08d623861582b38736560
6
+ metadata.gz: b962d14dc1c1c7dd202c8c21a9686238679f29c12b160f9e4bfe4c38650f73309e16011909105f7daf7fe4daa0eaa198eea8163b25aae7c3e6009fdfdf156b73
7
+ data.tar.gz: 64741c4c119942a6f8373de136308c3b6b04b3d150f92b2665f97376b1bc1d21f5aaefce6f7ea01ebe65098a32b7f475e3870b83726fe855aa73f1a9f622f4e3
data/Gemfile.lock CHANGED
@@ -1,11 +1,12 @@
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.41.0)
5
+ avm-files (~> 0.7)
6
+ eac_cli (~> 0.41)
7
+ eac_ruby_base0 (~> 0.19)
8
+ eac_ruby_utils (~> 0.121)
9
+ ehbrs_ruby_utils (~> 0.43)
9
10
  filesize (~> 0.2)
10
11
  os (~> 1.1, >= 1.1.4)
11
12
  telegram-bot-ruby (~> 0.23)
@@ -13,25 +14,25 @@ PATH
13
14
  PATH
14
15
  remote: sub/eac_cli
15
16
  specs:
16
- eac_cli (0.40.0)
17
+ eac_cli (0.41.0)
17
18
  colorize (~> 0.8, >= 0.8.1)
18
- eac_config (~> 0.14, >= 0.14.1)
19
- eac_ruby_utils (~> 0.120)
19
+ eac_config (~> 0.14, >= 0.14.2)
20
+ eac_ruby_utils (~> 0.121)
20
21
  tty-table (~> 0.12)
21
22
 
22
23
  PATH
23
24
  remote: sub/ehbrs_ruby_utils
24
25
  specs:
25
- ehbrs_ruby_utils (0.41.0)
26
+ ehbrs_ruby_utils (0.43.0)
26
27
  aranha (~> 0.19, >= 0.19.2)
27
28
  aranha-parsers (~> 0.22)
28
- aranha-selenium (~> 0.8)
29
- avm (~> 0.84, >= 0.84.2)
29
+ aranha-selenium (~> 0.10, >= 0.10.1)
30
+ avm (~> 0.91)
30
31
  dentaku (~> 3.5, >= 3.5.2)
31
32
  eac_fs (~> 0.17)
32
33
  eac_rest (~> 0.12)
33
- eac_ruby_utils (~> 0.120)
34
- eac_templates (~> 0.5)
34
+ eac_ruby_utils (~> 0.121)
35
+ eac_templates (~> 0.5, >= 0.5.1)
35
36
  inifile (~> 3.0)
36
37
  srt (~> 0.1, >= 0.1.5)
37
38
  taglib-ruby (~> 1.1, >= 1.1.3)
@@ -40,7 +41,7 @@ PATH
40
41
  GEM
41
42
  remote: https://rubygems.org/
42
43
  specs:
43
- activesupport (6.1.7.6)
44
+ activesupport (6.1.7.7)
44
45
  concurrent-ruby (~> 1.0, >= 1.0.2)
45
46
  i18n (>= 1.6, < 2)
46
47
  minitest (>= 5.1)
@@ -59,85 +60,57 @@ GEM
59
60
  eac_ruby_utils (~> 0.119, >= 0.119.2)
60
61
  nokogiri (~> 1.15, >= 1.15.4)
61
62
  ofx-parser (~> 1.1)
62
- aranha-selenium (0.8.0)
63
+ aranha-selenium (0.10.1)
63
64
  eac_fs (~> 0.17)
64
- eac_ruby_utils (~> 0.120)
65
+ eac_ruby_utils (~> 0.121)
66
+ eac_templates (~> 0.5, >= 0.5.1)
65
67
  selenium-webdriver (~> 3.142, >= 3.142.7)
66
68
  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)
69
+ avm (0.91.0)
70
+ eac_cli (~> 0.40, >= 0.40.1)
71
+ eac_config (~> 0.14, >= 0.14.2)
71
72
  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)
73
+ eac_fs (~> 0.17)
74
+ eac_ruby_utils (~> 0.121)
75
+ eac_templates (~> 0.5, >= 0.5.1)
78
76
  minitar (~> 0.9)
79
- avm-eac_generic_base0 (0.12.2)
80
- avm (~> 0.84, >= 0.84.2)
81
- eac_ruby_utils (~> 0.120)
77
+ ruby-progressbar (~> 1.13)
78
+ avm-eac_generic_base0 (0.13.0)
79
+ avm (~> 0.90)
80
+ eac_ruby_utils (~> 0.121)
82
81
  avm-eac_ruby_base1 (0.33.1)
83
82
  aranha-parsers (~> 0.22)
84
83
  avm (~> 0.84)
85
84
  avm-eac_generic_base0 (~> 0.12, >= 0.12.1)
86
85
  eac_envs-http (~> 0.4, >= 0.4.1)
87
86
  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)
87
+ avm-files (0.7.0)
88
+ avm (~> 0.84, >= 0.84.2)
89
+ eac_cli (~> 0.40)
90
+ eac_fs (~> 0.17)
91
+ eac_ruby_utils (~> 0.121)
92
+ eac_templates (~> 0.5, >= 0.5.1)
118
93
  axiom-types (0.1.1)
119
94
  descendants_tracker (~> 0.0.4)
120
95
  ice_nine (~> 0.11.0)
121
96
  thread_safe (~> 0.3, >= 0.3.1)
122
97
  base64 (0.2.0)
123
98
  childprocess (3.0.0)
124
- clipboard (1.3.6)
125
99
  coercible (1.0.0)
126
100
  descendants_tracker (~> 0.0.1)
127
101
  colorize (0.8.1)
128
102
  concurrent-ruby (1.2.3)
129
103
  content-type (0.0.2)
130
104
  parslet (~> 2.0)
131
- curb (0.9.11)
132
105
  dentaku (3.5.2)
133
106
  concurrent-ruby
134
107
  descendants_tracker (0.0.4)
135
108
  thread_safe (~> 0.3, >= 0.3.1)
136
- diff-lcs (1.5.0)
109
+ diff-lcs (1.5.1)
137
110
  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)
111
+ eac_config (0.14.2)
112
+ addressable (~> 2.8, >= 2.8.6)
113
+ eac_ruby_utils (~> 0.121)
141
114
  eac_docker (0.7.0)
142
115
  eac_ruby_utils (~> 0.112)
143
116
  eac_templates (~> 0.3, >= 0.3.2)
@@ -153,9 +126,6 @@ GEM
153
126
  content-type (~> 0.0, >= 0.0.2)
154
127
  eac_ruby_utils (~> 0.120)
155
128
  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
129
  eac_rest (0.12.0)
160
130
  eac_envs-http (~> 0.5)
161
131
  eac_fs (~> 0.16)
@@ -165,21 +135,21 @@ GEM
165
135
  eac_cli (~> 0.35)
166
136
  eac_fs (~> 0.16)
167
137
  eac_ruby_utils (~> 0.117)
168
- eac_ruby_gem_support (0.9.0)
169
- eac_ruby_utils (~> 0.119, >= 0.119.2)
138
+ eac_ruby_gem_support (0.10.0)
139
+ eac_ruby_utils (~> 0.120)
170
140
  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)
141
+ rubocop (~> 1.60, >= 1.60.1)
142
+ rubocop-rails (~> 2.23, >= 2.23.1)
143
+ rubocop-rspec (~> 2.26, >= 2.26.1)
144
+ eac_ruby_utils (0.121.0)
175
145
  activesupport (>= 4, < 7)
176
- addressable (~> 2.8, >= 2.8.5)
146
+ addressable (~> 2.8, >= 2.8.6)
177
147
  bundler
178
148
  filesize (~> 0.2)
179
149
  net-ssh (~> 4.2)
180
- eac_templates (0.5.0)
181
- eac_config (~> 0.12)
182
- eac_ruby_utils (~> 0.112)
150
+ eac_templates (0.5.1)
151
+ eac_config (~> 0.14, >= 0.14.1)
152
+ eac_ruby_utils (~> 0.121)
183
153
  faraday (2.8.1)
184
154
  base64
185
155
  faraday-net_http (>= 2.0, < 3.1)
@@ -192,58 +162,53 @@ GEM
192
162
  faraday-multipart (1.0.4)
193
163
  multipart-post (~> 2)
194
164
  faraday-net_http (3.0.2)
195
- faraday-retry (2.2.0)
165
+ faraday-retry (2.2.1)
196
166
  faraday (~> 2.0)
197
167
  filesize (0.2.0)
198
- git (1.19.1)
199
- addressable (~> 2.8)
200
- rchardet (~> 1.8)
201
168
  hpricot (0.8.6)
202
- htmlbeautifier (1.4.2)
203
- i18n (1.14.1)
169
+ i18n (1.14.5)
204
170
  concurrent-ruby (~> 1.0)
205
171
  ice_nine (0.11.2)
206
172
  inifile (3.0.0)
207
- json (2.7.1)
173
+ json (2.7.2)
208
174
  language_server-protocol (3.17.0.3)
209
175
  minitar (0.9)
210
- minitest (5.21.1)
211
- multipart-post (2.3.0)
176
+ minitest (5.23.0)
177
+ multipart-post (2.4.1)
212
178
  net-ssh (4.2.0)
213
- nokogiri (1.15.5-x86_64-linux)
179
+ nokogiri (1.15.6-x86_64-linux)
214
180
  racc (~> 1.4)
215
181
  ofx-parser (1.1.0)
216
182
  hpricot (>= 0.6)
217
183
  os (1.1.4)
218
184
  parallel (1.24.0)
219
- parseconfig (1.1.2)
220
- parser (3.3.0.4)
185
+ parser (3.3.1.0)
221
186
  ast (~> 2.4.1)
222
187
  racc
223
188
  parslet (2.0.0)
224
189
  pastel (0.8.0)
225
190
  tty-color (~> 0.5)
226
- public_suffix (5.0.4)
191
+ public_suffix (5.0.5)
227
192
  racc (1.7.3)
228
- rack (3.0.8)
193
+ rack (3.0.11)
229
194
  rainbow (3.1.1)
230
- rchardet (1.8.0)
231
- regexp_parser (2.9.0)
232
- 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)
195
+ regexp_parser (2.9.2)
196
+ rexml (3.2.8)
197
+ strscan (>= 3.0.9)
198
+ rspec (3.13.0)
199
+ rspec-core (~> 3.13.0)
200
+ rspec-expectations (~> 3.13.0)
201
+ rspec-mocks (~> 3.13.0)
202
+ rspec-core (3.13.0)
203
+ rspec-support (~> 3.13.0)
204
+ rspec-expectations (3.13.0)
240
205
  diff-lcs (>= 1.2.0, < 2.0)
241
- rspec-support (~> 3.12.0)
242
- rspec-mocks (3.12.6)
206
+ rspec-support (~> 3.13.0)
207
+ rspec-mocks (3.13.1)
243
208
  diff-lcs (>= 1.2.0, < 2.0)
244
- rspec-support (~> 3.12.0)
245
- rspec-support (3.12.1)
246
- rubocop (1.60.0)
209
+ rspec-support (~> 3.13.0)
210
+ rspec-support (3.13.1)
211
+ rubocop (1.63.5)
247
212
  json (~> 2.3)
248
213
  language_server-protocol (>= 3.17.0)
249
214
  parallel (~> 1.10)
@@ -251,24 +216,27 @@ GEM
251
216
  rainbow (>= 2.2.2, < 4.0)
252
217
  regexp_parser (>= 1.8, < 3.0)
253
218
  rexml (>= 3.2.5, < 4.0)
254
- rubocop-ast (>= 1.30.0, < 2.0)
219
+ rubocop-ast (>= 1.31.1, < 2.0)
255
220
  ruby-progressbar (~> 1.7)
256
221
  unicode-display_width (>= 2.4.0, < 3.0)
257
- rubocop-ast (1.30.0)
258
- parser (>= 3.2.1.0)
222
+ rubocop-ast (1.31.3)
223
+ parser (>= 3.3.1.0)
259
224
  rubocop-capybara (2.20.0)
260
225
  rubocop (~> 1.41)
261
226
  rubocop-factory_bot (2.25.1)
262
227
  rubocop (~> 1.41)
263
- rubocop-rails (2.23.1)
228
+ rubocop-rails (2.24.1)
264
229
  activesupport (>= 4.2.0)
265
230
  rack (>= 1.1)
266
231
  rubocop (>= 1.33.0, < 2.0)
267
- rubocop-ast (>= 1.30.0, < 2.0)
268
- rubocop-rspec (2.26.1)
232
+ rubocop-ast (>= 1.31.1, < 2.0)
233
+ rubocop-rspec (2.29.2)
269
234
  rubocop (~> 1.40)
270
235
  rubocop-capybara (~> 2.17)
271
236
  rubocop-factory_bot (~> 2.22)
237
+ rubocop-rspec_rails (~> 2.28)
238
+ rubocop-rspec_rails (2.28.3)
239
+ rubocop (~> 1.40)
272
240
  ruby-filemagic (0.7.3)
273
241
  ruby-progressbar (1.13.0)
274
242
  ruby2_keywords (0.0.5)
@@ -282,6 +250,7 @@ GEM
282
250
  unicode-display_width (>= 1.5, < 3.0)
283
251
  unicode_utils (~> 1.4)
284
252
  strings-ansi (0.2.0)
253
+ strscan (3.1.0)
285
254
  taglib-ruby (1.1.3)
286
255
  telegram-bot-ruby (0.23.0)
287
256
  dry-inflector
@@ -306,7 +275,7 @@ GEM
306
275
  axiom-types (~> 0.1)
307
276
  coercible (~> 1.0)
308
277
  descendants_tracker (~> 0.0, >= 0.0.3)
309
- zeitwerk (2.6.12)
278
+ zeitwerk (2.6.14)
310
279
  zlib (2.1.1)
311
280
 
312
281
  PLATFORMS
@@ -319,4 +288,4 @@ DEPENDENCIES
319
288
  ehbrs_ruby_utils!
320
289
 
321
290
  BUNDLED WITH
322
- 2.4.19
291
+ 2.4.22
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/envs'
4
+ require 'eac_ruby_utils/simple_cache'
5
+
6
+ module Ehbrs
7
+ module Tools
8
+ module Executables
9
+ class << self
10
+ include ::EacRubyUtils::SimpleCache
11
+
12
+ def env
13
+ ::EacRubyUtils::Envs.local
14
+ end
15
+
16
+ private
17
+
18
+ {
19
+ '--version' => %w[flips]
20
+ }.each do |validate_arg, commands|
21
+ commands.each do |command|
22
+ define_method("#{command}_uncached") do
23
+ env.executable(command, validate_arg)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehbrs_ruby_utils/core_ext'
4
+ require 'ehbrs_ruby_utils/music/sort/files/base'
5
+ require 'ehbrs_ruby_utils/music/sort/files/factory'
6
+
7
+ module Ehbrs
8
+ module Tools
9
+ class Runner
10
+ class Music
11
+ class Sort
12
+ class Dump
13
+ runner_with :confirmation
14
+
15
+ private
16
+
17
+ def run
18
+ if File.exist?(config_file)
19
+ @config = YAML.load_file(config_file)
20
+ to_rename.each { |sf| rename(sf) }
21
+ else
22
+ fatal_error("File \"#{config_file}\" does not exist")
23
+ end
24
+ end
25
+
26
+ def to_rename
27
+ r = []
28
+ ::EhbrsRubyUtils::Music::Sort::Files::Factory::SECTIONS.each do |section|
29
+ i = 1
30
+ (@config[section] || []).each do |name|
31
+ r << ::EhbrsRubyUtils::Music::Sort::Files::Base.new(section, i, name, nil)
32
+ i += 1
33
+ end
34
+ end
35
+ r
36
+ end
37
+
38
+ def rename(source_file)
39
+ o = scanner.search(source_file.name)
40
+ if o
41
+ rename_on_found(source_file, o)
42
+ else
43
+ warn("File not found for \"#{source_file}\"")
44
+ end
45
+ end
46
+
47
+ def rename_on_found(source_file, sorted_file)
48
+ o = sorted_file.reorder(source_file.section, source_file.order, order_padding)
49
+ info("\"#{o.source_basename}\" => \"#{o.target_basename}\"")
50
+ confirm_rename(o.source_basename, o.target_basename)
51
+ end
52
+
53
+ def confirm_rename(old_basename, new_basename)
54
+ op = File.expand_path(old_basename, path)
55
+ np = File.expand_path(new_basename, path)
56
+ return if np == op
57
+ raise "\"#{np}\" (From \"#{op}\") already exists" if File.exist?(np)
58
+
59
+ File.rename(op, np) if confirm?
60
+ end
61
+
62
+ def order_padding_uncached
63
+ scanner.count.to_s.length
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_base0/core_ext'
4
+
5
+ module Ehbrs
6
+ module Tools
7
+ class Runner
8
+ class Music
9
+ class Sort
10
+ class Load
11
+ runner_with :help, :confirmation
12
+
13
+ def run
14
+ info "Reading \"#{path}\"..."
15
+ config = build_config
16
+ s = config.to_yaml
17
+ puts s
18
+ if confirm?
19
+ info("Writing to \"#{config_file}\"...")
20
+ File.write(config_file, s)
21
+ end
22
+ puts 'Done!'.green
23
+ end
24
+
25
+ private
26
+
27
+ def build_config
28
+ config = {}
29
+ scanner.by_section.each do |section, fs|
30
+ config[section] = fs.sort.map(&:name)
31
+ end
32
+ config
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehbrs_ruby_utils/core_ext'
4
+ require 'ehbrs_ruby_utils/music/sort/files/factory'
5
+
6
+ module Ehbrs
7
+ module Tools
8
+ class Runner
9
+ class Music
10
+ class Sort
11
+ class Shuffle
12
+ runner_with :help do
13
+ bool_opt '-l', '--load'
14
+ end
15
+
16
+ def run
17
+ if parsed.load?
18
+ load_last_shuffle
19
+ else
20
+ dump_last_shuffle
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def dump_last_shuffle
27
+ s = build_config.to_yaml
28
+ puts s
29
+ info("Writing to \"#{last_shuffle_file}\"...")
30
+ File.write(last_shuffle_file, s)
31
+ puts 'Done!'.green
32
+ end
33
+
34
+ def load_last_shuffle
35
+ if File.exist?(last_shuffle_file)
36
+ IO.copy_stream(last_shuffle_file, config_file)
37
+ File.unlink(last_shuffle_file)
38
+ puts 'Done!'.green
39
+ else
40
+ fatal_error "File \"#{last_shuffle_file}\" does not exist"
41
+ end
42
+ end
43
+
44
+ def last_shuffle_file
45
+ File.join(path, '.last_shuffle')
46
+ end
47
+
48
+ def build_config
49
+ config = {}
50
+ config[::EhbrsRubyUtils::Music::Sort::Files::Factory::SECTION_CURRENT] =
51
+ scanner.all.to_a.shuffle.map(&:name)
52
+ config[::EhbrsRubyUtils::Music::Sort::Files::Factory::SECTION_NEW] = []
53
+ config
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_base0/core_ext'
4
+ require 'ehbrs_ruby_utils/music/sort/files/scanner'
5
+
6
+ module Ehbrs
7
+ module Tools
8
+ class Runner
9
+ class Music
10
+ class Sort
11
+ DEFAULT_PATH = '.'
12
+
13
+ runner_with :help, :subcommands do
14
+ desc 'Ordena arquivos/diretórios prefixando-os.'
15
+ arg_opt '-C', '--path', 'Path to the directory.', default: DEFAULT_PATH
16
+ subcommands
17
+ end
18
+ for_context :path, :scanner, :config_file
19
+
20
+ # @return [Pathname]
21
+ delegate :config_file, to: :scanner
22
+
23
+ # @return [Pathname]
24
+ def path
25
+ parsed.path.to_pathname
26
+ end
27
+
28
+ private
29
+
30
+ # @return [EhbrsRubyUtils::Music::Sort::Files::Scanner]
31
+ def scanner_uncached
32
+ ::EhbrsRubyUtils::Music::Sort::Files::Scanner.new(path)
33
+ end
34
+
35
+ require_sub __FILE__
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -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,7 +2,7 @@
2
2
 
3
3
  require 'eac_cli/core_ext'
4
4
  require 'eac_ruby_utils/fs/temp'
5
- require 'ehbrs/executables'
5
+ require 'ehbrs/tools/executables'
6
6
 
7
7
  module Ehbrs
8
8
  module Tools
@@ -35,7 +35,7 @@ module Ehbrs
35
35
  end
36
36
 
37
37
  def run_patch(source_path, ips_path, output_path)
38
- command = ::Ehbrs::Executables.flips.command
38
+ command = ::Ehbrs::Tools::Executables.flips.command
39
39
  .append(['--apply', ips_path, source_path, output_path])
40
40
 
41
41
  command.system!
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_base0/core_ext'
4
- require 'ehbrs/executables'
4
+ require 'ehbrs/tools/executables'
5
5
  require 'ehbrs_ruby_utils/videos/file'
6
6
  require 'ehbrs_ruby_utils/videos/convert_job'
7
7
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ehbrs
4
4
  module Tools
5
- VERSION = '0.39.1'
5
+ VERSION = '0.41.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,71 +1,85 @@
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.41.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-16 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
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.40'
33
+ version: '0.41'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.40'
40
+ version: '0.41'
41
+ - !ruby/object:Gem::Dependency
42
+ name: eac_ruby_base0
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.19'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.19'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: eac_ruby_utils
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0.120'
61
+ version: '0.121'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0.120'
68
+ version: '0.121'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: ehbrs_ruby_utils
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0.41'
75
+ version: '0.43'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0.41'
82
+ version: '0.43'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: filesize
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -140,7 +154,6 @@ files:
140
154
  - Gemfile.lock
141
155
  - exe/ehbrs
142
156
  - lib/ehbrs.rb
143
- - lib/ehbrs/executables.rb
144
157
  - lib/ehbrs/google.rb
145
158
  - lib/ehbrs/google/translate.rb
146
159
  - lib/ehbrs/google/translate/session.rb
@@ -156,6 +169,7 @@ files:
156
169
  - lib/ehbrs/tools.rb
157
170
  - lib/ehbrs/tools/application.rb
158
171
  - lib/ehbrs/tools/core_ext.rb
172
+ - lib/ehbrs/tools/executables.rb
159
173
  - lib/ehbrs/tools/instance.rb
160
174
  - lib/ehbrs/tools/runner.rb
161
175
  - lib/ehbrs/tools/runner/cooking_book.rb
@@ -171,6 +185,10 @@ files:
171
185
  - lib/ehbrs/tools/runner/music/lyrics.rb
172
186
  - lib/ehbrs/tools/runner/music/lyrics_book.rb
173
187
  - lib/ehbrs/tools/runner/music/selected.rb
188
+ - lib/ehbrs/tools/runner/music/sort.rb
189
+ - lib/ehbrs/tools/runner/music/sort/dump.rb
190
+ - lib/ehbrs/tools/runner/music/sort/load.rb
191
+ - lib/ehbrs/tools/runner/music/sort/shuffle.rb
174
192
  - lib/ehbrs/tools/runner/music/spread.rb
175
193
  - lib/ehbrs/tools/runner/telegram.rb
176
194
  - lib/ehbrs/tools/runner/telegram/send_message.rb
@@ -200,8 +218,6 @@ files:
200
218
  - lib/ehbrs/tools/runner/web_utils/videos.rb
201
219
  - lib/ehbrs/tools/runner/web_utils/videos/download.rb
202
220
  - 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
221
  - lib/ehbrs/tools/version.rb
206
222
  - lib/ehbrs/user_dirs.rb
207
223
  - template/ehbrs/cooking_book/build/base_page/layout.html.erb
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/envs'
4
- require 'eac_ruby_utils/simple_cache'
5
-
6
- module Ehbrs
7
- module Executables
8
- class << self
9
- include ::EacRubyUtils::SimpleCache
10
-
11
- def env
12
- ::EacRubyUtils::Envs.local
13
- end
14
-
15
- private
16
-
17
- {
18
- '--version' => %w[flips]
19
- }.each do |validate_arg, commands|
20
- commands.each do |command|
21
- define_method("#{command}_uncached") do
22
- env.executable(command, validate_arg)
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -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