ehbrs-tools 0.40.0 → 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: afba1515a9a95f71e7f9ef4846ed767259fb791149c440e98dc56611c7d09104
4
- data.tar.gz: 41bfc93b95a4d43300207e83b1f4958f27e273ee5a622e9f2a8d8220a8c44dc8
3
+ metadata.gz: 4d7f1950bd86260645e7a5bb92ec7fcb41c59c8331385f2a277c685be0ca470d
4
+ data.tar.gz: 9d8ddf77d0b5d447a6d223f30e3c9206ba97a84674219512b76cf844010f6051
5
5
  SHA512:
6
- metadata.gz: a3098c00fbcc328113d82d76801187dbd1cb85ec3b08a6a786fc6c7c00b49e550db32ff0e0ba6fd58d1301075c3ca9807e95087bce9aa318c33aff4b84408d1a
7
- data.tar.gz: 1c5a15956bd810fb96d390872584a0aa3431e3da22ec1d39c0b942fff34c9fe6fe78f6c08267415bdc984a667e2fccb1811ddbe3ff8a9ea857ec571b42445d9d
6
+ metadata.gz: b962d14dc1c1c7dd202c8c21a9686238679f29c12b160f9e4bfe4c38650f73309e16011909105f7daf7fe4daa0eaa198eea8163b25aae7c3e6009fdfdf156b73
7
+ data.tar.gz: 64741c4c119942a6f8373de136308c3b6b04b3d150f92b2665f97376b1bc1d21f5aaefce6f7ea01ebe65098a32b7f475e3870b83726fe855aa73f1a9f622f4e3
data/Gemfile.lock CHANGED
@@ -1,24 +1,33 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ehbrs-tools (0.40.0)
4
+ ehbrs-tools (0.41.0)
5
5
  avm-files (~> 0.7)
6
- eac_cli (~> 0.40, >= 0.40.1)
6
+ eac_cli (~> 0.41)
7
7
  eac_ruby_base0 (~> 0.19)
8
8
  eac_ruby_utils (~> 0.121)
9
- ehbrs_ruby_utils (~> 0.41, >= 0.41.2)
9
+ ehbrs_ruby_utils (~> 0.43)
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/eac_cli
16
+ specs:
17
+ eac_cli (0.41.0)
18
+ colorize (~> 0.8, >= 0.8.1)
19
+ eac_config (~> 0.14, >= 0.14.2)
20
+ eac_ruby_utils (~> 0.121)
21
+ tty-table (~> 0.12)
22
+
14
23
  PATH
15
24
  remote: sub/ehbrs_ruby_utils
16
25
  specs:
17
- ehbrs_ruby_utils (0.41.2)
26
+ ehbrs_ruby_utils (0.43.0)
18
27
  aranha (~> 0.19, >= 0.19.2)
19
28
  aranha-parsers (~> 0.22)
20
29
  aranha-selenium (~> 0.10, >= 0.10.1)
21
- avm (~> 0.90, >= 0.90.1)
30
+ avm (~> 0.91)
22
31
  dentaku (~> 3.5, >= 3.5.2)
23
32
  eac_fs (~> 0.17)
24
33
  eac_rest (~> 0.12)
@@ -57,7 +66,7 @@ GEM
57
66
  eac_templates (~> 0.5, >= 0.5.1)
58
67
  selenium-webdriver (~> 3.142, >= 3.142.7)
59
68
  ast (2.4.2)
60
- avm (0.90.1)
69
+ avm (0.91.0)
61
70
  eac_cli (~> 0.40, >= 0.40.1)
62
71
  eac_config (~> 0.14, >= 0.14.2)
63
72
  eac_docker (~> 0.7)
@@ -99,11 +108,6 @@ GEM
99
108
  thread_safe (~> 0.3, >= 0.3.1)
100
109
  diff-lcs (1.5.1)
101
110
  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
111
  eac_config (0.14.2)
108
112
  addressable (~> 2.8, >= 2.8.6)
109
113
  eac_ruby_utils (~> 0.121)
@@ -169,7 +173,7 @@ GEM
169
173
  json (2.7.2)
170
174
  language_server-protocol (3.17.0.3)
171
175
  minitar (0.9)
172
- minitest (5.22.3)
176
+ minitest (5.23.0)
173
177
  multipart-post (2.4.1)
174
178
  net-ssh (4.2.0)
175
179
  nokogiri (1.15.6-x86_64-linux)
@@ -188,8 +192,9 @@ GEM
188
192
  racc (1.7.3)
189
193
  rack (3.0.11)
190
194
  rainbow (3.1.1)
191
- regexp_parser (2.9.1)
192
- rexml (3.2.6)
195
+ regexp_parser (2.9.2)
196
+ rexml (3.2.8)
197
+ strscan (>= 3.0.9)
193
198
  rspec (3.13.0)
194
199
  rspec-core (~> 3.13.0)
195
200
  rspec-expectations (~> 3.13.0)
@@ -245,6 +250,7 @@ GEM
245
250
  unicode-display_width (>= 1.5, < 3.0)
246
251
  unicode_utils (~> 1.4)
247
252
  strings-ansi (0.2.0)
253
+ strscan (3.1.0)
248
254
  taglib-ruby (1.1.3)
249
255
  telegram-bot-ruby (0.23.0)
250
256
  dry-inflector
@@ -269,13 +275,14 @@ GEM
269
275
  axiom-types (~> 0.1)
270
276
  coercible (~> 1.0)
271
277
  descendants_tracker (~> 0.0, >= 0.0.3)
272
- zeitwerk (2.6.13)
278
+ zeitwerk (2.6.14)
273
279
  zlib (2.1.1)
274
280
 
275
281
  PLATFORMS
276
282
  x86_64-linux
277
283
 
278
284
  DEPENDENCIES
285
+ eac_cli!
279
286
  eac_ruby_gem_support (~> 0.9)
280
287
  ehbrs-tools!
281
288
  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,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!
@@ -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.40.0'
5
+ VERSION = '0.41.0'
6
6
  end
7
7
  end
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.40.0
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-05-13 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
14
  name: avm-files
@@ -30,20 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.40'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 0.40.1
33
+ version: '0.41'
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.40'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 0.40.1
40
+ version: '0.41'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: eac_ruby_base0
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -78,20 +72,14 @@ dependencies:
78
72
  requirements:
79
73
  - - "~>"
80
74
  - !ruby/object:Gem::Version
81
- version: '0.41'
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- version: 0.41.2
75
+ version: '0.43'
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.41'
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- version: 0.41.2
82
+ version: '0.43'
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,6 +169,7 @@ 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
187
175
  - lib/ehbrs/tools/runner/cooking_book.rb
@@ -197,6 +185,10 @@ files:
197
185
  - lib/ehbrs/tools/runner/music/lyrics.rb
198
186
  - lib/ehbrs/tools/runner/music/lyrics_book.rb
199
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
200
192
  - lib/ehbrs/tools/runner/music/spread.rb
201
193
  - lib/ehbrs/tools/runner/telegram.rb
202
194
  - lib/ehbrs/tools/runner/telegram/send_message.rb
@@ -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