ehbrs-tools 0.40.0 → 0.42.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +59 -48
- data/lib/ehbrs/observers/with_persistence.rb +1 -1
- data/lib/ehbrs/tools/executables.rb +30 -0
- data/lib/ehbrs/tools/runner/booking/accommodations.rb +64 -0
- data/lib/ehbrs/tools/runner/booking.rb +18 -0
- data/lib/ehbrs/tools/runner/music/sort/dump.rb +70 -0
- data/lib/ehbrs/tools/runner/music/sort/load.rb +39 -0
- data/lib/ehbrs/tools/runner/music/sort/shuffle.rb +60 -0
- data/lib/ehbrs/tools/runner/music/sort.rb +40 -0
- data/lib/ehbrs/tools/runner/vg/ips.rb +2 -2
- data/lib/ehbrs/tools/runner/videos/languages.rb +1 -1
- data/lib/ehbrs/tools/version.rb +1 -1
- metadata +15 -21
- data/lib/ehbrs/executables.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17103baebd9aeaadd439e2f9d655af21e97ce4e5e717e4d95220cef79eb5822e
|
4
|
+
data.tar.gz: 41818ac788289578893d8f4c3717e848029c59d9a43ed2c60f2c99fd8db8a8db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdb1007d0ad9b51d7833bf82914e9f1c64082a43c08f6dc5fadab0301ed20d9feccca382e00ecdafc052b3f7d3063693143db976ae4c92ea614365b736e0277d
|
7
|
+
data.tar.gz: 9c39e8cda2a8bf90ffa4cf96bedeab2fbbca4bca8c48961636b32d3017fd60b208e29787d3899b11c4d314ce5ed00aa34e7240926c06435555c5ff25b68e8f34
|
data/Gemfile.lock
CHANGED
@@ -1,29 +1,47 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ehbrs-tools (0.
|
4
|
+
ehbrs-tools (0.42.0)
|
5
5
|
avm-files (~> 0.7)
|
6
|
-
eac_cli (~> 0.
|
6
|
+
eac_cli (~> 0.42)
|
7
7
|
eac_ruby_base0 (~> 0.19)
|
8
|
-
eac_ruby_utils (~> 0.
|
9
|
-
ehbrs_ruby_utils (~> 0.
|
8
|
+
eac_ruby_utils (~> 0.122)
|
9
|
+
ehbrs_ruby_utils (~> 0.44)
|
10
10
|
filesize (~> 0.2)
|
11
11
|
os (~> 1.1, >= 1.1.4)
|
12
12
|
telegram-bot-ruby (~> 0.23)
|
13
13
|
|
14
|
+
PATH
|
15
|
+
remote: sub/aranha-selenium
|
16
|
+
specs:
|
17
|
+
aranha-selenium (0.11.0)
|
18
|
+
eac_fs (~> 0.17)
|
19
|
+
eac_ruby_utils (~> 0.122)
|
20
|
+
eac_templates (~> 0.7)
|
21
|
+
selenium-webdriver (~> 3.142, >= 3.142.7)
|
22
|
+
|
23
|
+
PATH
|
24
|
+
remote: sub/eac_cli
|
25
|
+
specs:
|
26
|
+
eac_cli (0.42.0)
|
27
|
+
colorize (~> 0.8, >= 0.8.1)
|
28
|
+
eac_config (~> 0.14, >= 0.14.2)
|
29
|
+
eac_ruby_utils (~> 0.122)
|
30
|
+
tty-table (~> 0.12)
|
31
|
+
|
14
32
|
PATH
|
15
33
|
remote: sub/ehbrs_ruby_utils
|
16
34
|
specs:
|
17
|
-
ehbrs_ruby_utils (0.
|
35
|
+
ehbrs_ruby_utils (0.44.0)
|
18
36
|
aranha (~> 0.19, >= 0.19.2)
|
19
37
|
aranha-parsers (~> 0.22)
|
20
|
-
aranha-selenium (~> 0.
|
21
|
-
avm (~> 0.
|
38
|
+
aranha-selenium (~> 0.11)
|
39
|
+
avm (~> 0.92)
|
22
40
|
dentaku (~> 3.5, >= 3.5.2)
|
23
41
|
eac_fs (~> 0.17)
|
24
42
|
eac_rest (~> 0.12)
|
25
|
-
eac_ruby_utils (~> 0.
|
26
|
-
eac_templates (~> 0.
|
43
|
+
eac_ruby_utils (~> 0.122)
|
44
|
+
eac_templates (~> 0.7)
|
27
45
|
inifile (~> 3.0)
|
28
46
|
srt (~> 0.1, >= 0.1.5)
|
29
47
|
taglib-ruby (~> 1.1, >= 1.1.3)
|
@@ -32,7 +50,7 @@ PATH
|
|
32
50
|
GEM
|
33
51
|
remote: https://rubygems.org/
|
34
52
|
specs:
|
35
|
-
activesupport (6.1.7.
|
53
|
+
activesupport (6.1.7.8)
|
36
54
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
37
55
|
i18n (>= 1.6, < 2)
|
38
56
|
minitest (>= 5.1)
|
@@ -51,30 +69,24 @@ GEM
|
|
51
69
|
eac_ruby_utils (~> 0.119, >= 0.119.2)
|
52
70
|
nokogiri (~> 1.15, >= 1.15.4)
|
53
71
|
ofx-parser (~> 1.1)
|
54
|
-
aranha-selenium (0.10.1)
|
55
|
-
eac_fs (~> 0.17)
|
56
|
-
eac_ruby_utils (~> 0.121)
|
57
|
-
eac_templates (~> 0.5, >= 0.5.1)
|
58
|
-
selenium-webdriver (~> 3.142, >= 3.142.7)
|
59
72
|
ast (2.4.2)
|
60
|
-
avm (0.
|
61
|
-
eac_cli (~> 0.
|
73
|
+
avm (0.92.0)
|
74
|
+
eac_cli (~> 0.41)
|
62
75
|
eac_config (~> 0.14, >= 0.14.2)
|
63
76
|
eac_docker (~> 0.7)
|
64
77
|
eac_fs (~> 0.17)
|
65
|
-
eac_ruby_utils (~> 0.
|
66
|
-
eac_templates (~> 0.
|
78
|
+
eac_ruby_utils (~> 0.122)
|
79
|
+
eac_templates (~> 0.7)
|
67
80
|
minitar (~> 0.9)
|
68
81
|
ruby-progressbar (~> 1.13)
|
69
82
|
avm-eac_generic_base0 (0.13.0)
|
70
83
|
avm (~> 0.90)
|
71
84
|
eac_ruby_utils (~> 0.121)
|
72
|
-
avm-eac_ruby_base1 (0.
|
73
|
-
|
74
|
-
avm (~> 0.
|
75
|
-
|
76
|
-
|
77
|
-
eac_ruby_utils (~> 0.119, >= 0.119.2)
|
85
|
+
avm-eac_ruby_base1 (0.34.1)
|
86
|
+
avm (~> 0.92)
|
87
|
+
avm-eac_generic_base0 (~> 0.13)
|
88
|
+
eac_envs-http (~> 0.5, >= 0.5.1)
|
89
|
+
eac_ruby_utils (~> 0.122)
|
78
90
|
avm-files (0.7.0)
|
79
91
|
avm (~> 0.84, >= 0.84.2)
|
80
92
|
eac_cli (~> 0.40)
|
@@ -90,7 +102,7 @@ GEM
|
|
90
102
|
coercible (1.0.0)
|
91
103
|
descendants_tracker (~> 0.0.1)
|
92
104
|
colorize (0.8.1)
|
93
|
-
concurrent-ruby (1.2
|
105
|
+
concurrent-ruby (1.3.2)
|
94
106
|
content-type (0.0.2)
|
95
107
|
parslet (~> 2.0)
|
96
108
|
dentaku (3.5.2)
|
@@ -99,11 +111,6 @@ GEM
|
|
99
111
|
thread_safe (~> 0.3, >= 0.3.1)
|
100
112
|
diff-lcs (1.5.1)
|
101
113
|
dry-inflector (1.0.0)
|
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
114
|
eac_config (0.14.2)
|
108
115
|
addressable (~> 2.8, >= 2.8.6)
|
109
116
|
eac_ruby_utils (~> 0.121)
|
@@ -137,15 +144,15 @@ GEM
|
|
137
144
|
rubocop (~> 1.60, >= 1.60.1)
|
138
145
|
rubocop-rails (~> 2.23, >= 2.23.1)
|
139
146
|
rubocop-rspec (~> 2.26, >= 2.26.1)
|
140
|
-
eac_ruby_utils (0.
|
147
|
+
eac_ruby_utils (0.122.0)
|
141
148
|
activesupport (>= 4, < 7)
|
142
149
|
addressable (~> 2.8, >= 2.8.6)
|
143
150
|
bundler
|
144
151
|
filesize (~> 0.2)
|
145
152
|
net-ssh (~> 4.2)
|
146
|
-
eac_templates (0.
|
147
|
-
eac_config (~> 0.14, >= 0.14.
|
148
|
-
eac_ruby_utils (~> 0.
|
153
|
+
eac_templates (0.7.0)
|
154
|
+
eac_config (~> 0.14, >= 0.14.2)
|
155
|
+
eac_ruby_utils (~> 0.122)
|
149
156
|
faraday (2.8.1)
|
150
157
|
base64
|
151
158
|
faraday-net_http (>= 2.0, < 3.1)
|
@@ -169,7 +176,7 @@ GEM
|
|
169
176
|
json (2.7.2)
|
170
177
|
language_server-protocol (3.17.0.3)
|
171
178
|
minitar (0.9)
|
172
|
-
minitest (5.
|
179
|
+
minitest (5.23.1)
|
173
180
|
multipart-post (2.4.1)
|
174
181
|
net-ssh (4.2.0)
|
175
182
|
nokogiri (1.15.6-x86_64-linux)
|
@@ -177,19 +184,20 @@ GEM
|
|
177
184
|
ofx-parser (1.1.0)
|
178
185
|
hpricot (>= 0.6)
|
179
186
|
os (1.1.4)
|
180
|
-
parallel (1.
|
181
|
-
parser (3.3.
|
187
|
+
parallel (1.25.1)
|
188
|
+
parser (3.3.2.0)
|
182
189
|
ast (~> 2.4.1)
|
183
190
|
racc
|
184
191
|
parslet (2.0.0)
|
185
192
|
pastel (0.8.0)
|
186
193
|
tty-color (~> 0.5)
|
187
194
|
public_suffix (5.0.5)
|
188
|
-
racc (1.
|
195
|
+
racc (1.8.0)
|
189
196
|
rack (3.0.11)
|
190
197
|
rainbow (3.1.1)
|
191
|
-
regexp_parser (2.9.
|
192
|
-
rexml (3.2.
|
198
|
+
regexp_parser (2.9.2)
|
199
|
+
rexml (3.2.9)
|
200
|
+
strscan
|
193
201
|
rspec (3.13.0)
|
194
202
|
rspec-core (~> 3.13.0)
|
195
203
|
rspec-expectations (~> 3.13.0)
|
@@ -203,7 +211,7 @@ GEM
|
|
203
211
|
diff-lcs (>= 1.2.0, < 2.0)
|
204
212
|
rspec-support (~> 3.13.0)
|
205
213
|
rspec-support (3.13.1)
|
206
|
-
rubocop (1.
|
214
|
+
rubocop (1.64.1)
|
207
215
|
json (~> 2.3)
|
208
216
|
language_server-protocol (>= 3.17.0)
|
209
217
|
parallel (~> 1.10)
|
@@ -216,21 +224,21 @@ GEM
|
|
216
224
|
unicode-display_width (>= 2.4.0, < 3.0)
|
217
225
|
rubocop-ast (1.31.3)
|
218
226
|
parser (>= 3.3.1.0)
|
219
|
-
rubocop-capybara (2.
|
227
|
+
rubocop-capybara (2.21.0)
|
220
228
|
rubocop (~> 1.41)
|
221
|
-
rubocop-factory_bot (2.
|
229
|
+
rubocop-factory_bot (2.26.0)
|
222
230
|
rubocop (~> 1.41)
|
223
|
-
rubocop-rails (2.
|
231
|
+
rubocop-rails (2.25.0)
|
224
232
|
activesupport (>= 4.2.0)
|
225
233
|
rack (>= 1.1)
|
226
234
|
rubocop (>= 1.33.0, < 2.0)
|
227
235
|
rubocop-ast (>= 1.31.1, < 2.0)
|
228
|
-
rubocop-rspec (2.
|
236
|
+
rubocop-rspec (2.31.0)
|
229
237
|
rubocop (~> 1.40)
|
230
238
|
rubocop-capybara (~> 2.17)
|
231
239
|
rubocop-factory_bot (~> 2.22)
|
232
240
|
rubocop-rspec_rails (~> 2.28)
|
233
|
-
rubocop-rspec_rails (2.
|
241
|
+
rubocop-rspec_rails (2.29.0)
|
234
242
|
rubocop (~> 1.40)
|
235
243
|
ruby-filemagic (0.7.3)
|
236
244
|
ruby-progressbar (1.13.0)
|
@@ -245,6 +253,7 @@ GEM
|
|
245
253
|
unicode-display_width (>= 1.5, < 3.0)
|
246
254
|
unicode_utils (~> 1.4)
|
247
255
|
strings-ansi (0.2.0)
|
256
|
+
strscan (3.1.0)
|
248
257
|
taglib-ruby (1.1.3)
|
249
258
|
telegram-bot-ruby (0.23.0)
|
250
259
|
dry-inflector
|
@@ -269,13 +278,15 @@ GEM
|
|
269
278
|
axiom-types (~> 0.1)
|
270
279
|
coercible (~> 1.0)
|
271
280
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
272
|
-
zeitwerk (2.6.
|
281
|
+
zeitwerk (2.6.15)
|
273
282
|
zlib (2.1.1)
|
274
283
|
|
275
284
|
PLATFORMS
|
276
285
|
x86_64-linux
|
277
286
|
|
278
287
|
DEPENDENCIES
|
288
|
+
aranha-selenium!
|
289
|
+
eac_cli!
|
279
290
|
eac_ruby_gem_support (~> 0.9)
|
280
291
|
ehbrs-tools!
|
281
292
|
ehbrs_ruby_utils!
|
@@ -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,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_base0/core_ext'
|
4
|
+
require 'ehbrs_ruby_utils/booking/processors/list'
|
5
|
+
|
6
|
+
module Ehbrs
|
7
|
+
module Tools
|
8
|
+
class Runner
|
9
|
+
class Booking
|
10
|
+
class Accommodations
|
11
|
+
FIELDS = [
|
12
|
+
[:link, 'Link'],
|
13
|
+
[:price, 'Diárias'],
|
14
|
+
[:tax, 'Taxas'],
|
15
|
+
[:total, 'Total'],
|
16
|
+
[:address, 'Localização'],
|
17
|
+
[:distance, 'Dist. centro (Km)'],
|
18
|
+
[:review_score, 'Nota'],
|
19
|
+
[:review_count, 'Avaliações'],
|
20
|
+
[:unit_title, 'Descrição']
|
21
|
+
].freeze
|
22
|
+
|
23
|
+
runner_with :help, :output_list do
|
24
|
+
desc 'Extrai as acomodações de uma página-lista do Booking.'
|
25
|
+
pos_arg :url
|
26
|
+
end
|
27
|
+
|
28
|
+
def run
|
29
|
+
run_output
|
30
|
+
infov 'Actual count found', list_rows.count
|
31
|
+
infov 'Declared count', processor.declared_count
|
32
|
+
if list_rows.count == processor.declared_count
|
33
|
+
success 'Ok!'
|
34
|
+
else
|
35
|
+
fatal_error 'Actual and declared counts are different'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
protected
|
40
|
+
|
41
|
+
# @return [EhbrsRubyUtils::Booking::Processors::List]
|
42
|
+
def processor_uncached
|
43
|
+
::EhbrsRubyUtils::Booking::Processors::List.new(url)
|
44
|
+
end
|
45
|
+
|
46
|
+
# @return [Array<Symbol>]
|
47
|
+
def list_columns
|
48
|
+
FIELDS.map(&:first)
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [Array<Object>]
|
52
|
+
def list_rows
|
53
|
+
processor.accommodations
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [Addressable::URI]
|
57
|
+
def url
|
58
|
+
parsed.url.to_uri
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
|
5
|
+
module Ehbrs
|
6
|
+
module Tools
|
7
|
+
class Runner
|
8
|
+
class Booking
|
9
|
+
require_sub __FILE__
|
10
|
+
|
11
|
+
runner_with :help, :subcommands do
|
12
|
+
desc 'Utilidades para o site booking.com.'
|
13
|
+
subcommands
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
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
|
@@ -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!
|
data/lib/ehbrs/tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ehbrs-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.42.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-
|
11
|
+
date: 2024-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm-files
|
@@ -30,20 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 0.40.1
|
33
|
+
version: '0.42'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - "~>"
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0.
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 0.40.1
|
40
|
+
version: '0.42'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: eac_ruby_base0
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,34 +58,28 @@ dependencies:
|
|
64
58
|
requirements:
|
65
59
|
- - "~>"
|
66
60
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0.
|
61
|
+
version: '0.122'
|
68
62
|
type: :runtime
|
69
63
|
prerelease: false
|
70
64
|
version_requirements: !ruby/object:Gem::Requirement
|
71
65
|
requirements:
|
72
66
|
- - "~>"
|
73
67
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0.
|
68
|
+
version: '0.122'
|
75
69
|
- !ruby/object:Gem::Dependency
|
76
70
|
name: ehbrs_ruby_utils
|
77
71
|
requirement: !ruby/object:Gem::Requirement
|
78
72
|
requirements:
|
79
73
|
- - "~>"
|
80
74
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0.
|
82
|
-
- - ">="
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: 0.41.2
|
75
|
+
version: '0.44'
|
85
76
|
type: :runtime
|
86
77
|
prerelease: false
|
87
78
|
version_requirements: !ruby/object:Gem::Requirement
|
88
79
|
requirements:
|
89
80
|
- - "~>"
|
90
81
|
- !ruby/object:Gem::Version
|
91
|
-
version: '0.
|
92
|
-
- - ">="
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: 0.41.2
|
82
|
+
version: '0.44'
|
95
83
|
- !ruby/object:Gem::Dependency
|
96
84
|
name: filesize
|
97
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,7 +154,6 @@ files:
|
|
166
154
|
- Gemfile.lock
|
167
155
|
- exe/ehbrs
|
168
156
|
- lib/ehbrs.rb
|
169
|
-
- lib/ehbrs/executables.rb
|
170
157
|
- lib/ehbrs/google.rb
|
171
158
|
- lib/ehbrs/google/translate.rb
|
172
159
|
- lib/ehbrs/google/translate/session.rb
|
@@ -182,8 +169,11 @@ files:
|
|
182
169
|
- lib/ehbrs/tools.rb
|
183
170
|
- lib/ehbrs/tools/application.rb
|
184
171
|
- lib/ehbrs/tools/core_ext.rb
|
172
|
+
- lib/ehbrs/tools/executables.rb
|
185
173
|
- lib/ehbrs/tools/instance.rb
|
186
174
|
- lib/ehbrs/tools/runner.rb
|
175
|
+
- lib/ehbrs/tools/runner/booking.rb
|
176
|
+
- lib/ehbrs/tools/runner/booking/accommodations.rb
|
187
177
|
- lib/ehbrs/tools/runner/cooking_book.rb
|
188
178
|
- lib/ehbrs/tools/runner/cooking_book/build.rb
|
189
179
|
- lib/ehbrs/tools/runner/finances.rb
|
@@ -197,6 +187,10 @@ files:
|
|
197
187
|
- lib/ehbrs/tools/runner/music/lyrics.rb
|
198
188
|
- lib/ehbrs/tools/runner/music/lyrics_book.rb
|
199
189
|
- lib/ehbrs/tools/runner/music/selected.rb
|
190
|
+
- lib/ehbrs/tools/runner/music/sort.rb
|
191
|
+
- lib/ehbrs/tools/runner/music/sort/dump.rb
|
192
|
+
- lib/ehbrs/tools/runner/music/sort/load.rb
|
193
|
+
- lib/ehbrs/tools/runner/music/sort/shuffle.rb
|
200
194
|
- lib/ehbrs/tools/runner/music/spread.rb
|
201
195
|
- lib/ehbrs/tools/runner/telegram.rb
|
202
196
|
- lib/ehbrs/tools/runner/telegram/send_message.rb
|
data/lib/ehbrs/executables.rb
DELETED
@@ -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
|