ehbrs-tools 0.26.0 → 0.27.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 +5 -4
- data/lib/ehbrs/tools/runner/fs/selected.rb +18 -21
- data/lib/ehbrs/tools/version.rb +1 -1
- data/lib/ehbrs/videos/extract/package.rb +2 -2
- data/lib/ehbrs/videos/extract/package_file.rb +0 -1
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +9 -1
- data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +6 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder.rb +3 -3
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +6 -5
- data/vendor/ehbrs_ruby_utils/ehbrs_ruby_utils.gemspec +1 -0
- data/{lib/ehbrs → vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils}/fs/compressed_package.rb +1 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build.rb +41 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build_file.rb +27 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected.rb +35 -0
- data/{lib/ehbrs → vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils}/fs.rb +2 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/version.rb +1 -1
- data/vendor/ultimate_lyrics/ultimate_lyrics.gemspec +4 -2
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2fcd84889771b212325a7f4315bb2e03a9584ffd36dfa13184efa56fe0294c7
|
4
|
+
data.tar.gz: e4fba78ac97dfd0628bb7f1f4efc0c8fc2f46b6b598b74cb50c71bf5e3785156
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b28bbf0f2abcf8cf7c4ff92f27b96a0f9d3761316cfa5796750606cc3249f00df80187410156b93caae02a649945b7bc2bc87afe656521b5fb6394828a566ee8
|
7
|
+
data.tar.gz: f6e325bb6fd61d6ee7eca4cae4de5c0a057b2c1954df5e693cb28143be82c411804771071dcffdbee482ac6aee53412889fbb6eeab4bb21d45c8074abb49d6d6
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ehbrs-tools (0.
|
4
|
+
ehbrs-tools (0.27.0)
|
5
5
|
avm-tools (~> 0.82, >= 0.82.1)
|
6
6
|
eac_cli (~> 0.12, >= 0.12.5)
|
7
7
|
eac_ruby_utils (~> 0.71)
|
@@ -33,7 +33,7 @@ PATH
|
|
33
33
|
PATH
|
34
34
|
remote: vendor/eac_cli
|
35
35
|
specs:
|
36
|
-
eac_cli (0.
|
36
|
+
eac_cli (0.23.0)
|
37
37
|
colorize (~> 0.8.1)
|
38
38
|
eac_config (~> 0.5, >= 0.5.1)
|
39
39
|
eac_ruby_utils (~> 0.70)
|
@@ -72,8 +72,9 @@ PATH
|
|
72
72
|
PATH
|
73
73
|
remote: vendor/ehbrs_ruby_utils
|
74
74
|
specs:
|
75
|
-
ehbrs_ruby_utils (0.
|
75
|
+
ehbrs_ruby_utils (0.11.0)
|
76
76
|
aranha-parsers (~> 0.8, >= 0.8.5)
|
77
|
+
avm (~> 0.3, >= 0.3.2)
|
77
78
|
eac_ruby_utils (~> 0.70)
|
78
79
|
eac_templates (~> 0.1, >= 0.1.1)
|
79
80
|
taglib-ruby (~> 1.1)
|
@@ -82,7 +83,7 @@ PATH
|
|
82
83
|
PATH
|
83
84
|
remote: vendor/ultimate_lyrics
|
84
85
|
specs:
|
85
|
-
ultimate_lyrics (0.1.
|
86
|
+
ultimate_lyrics (0.1.1)
|
86
87
|
aranha-parsers (~> 0.8, >= 0.8.5)
|
87
88
|
eac_ruby_utils (~> 0.74)
|
88
89
|
|
@@ -1,24 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/envs'
|
4
|
-
|
4
|
+
|
5
5
|
require 'ehbrs/tools/core_ext'
|
6
|
+
require 'ehbrs_ruby_utils/fs/selected'
|
6
7
|
|
7
8
|
module Ehbrs
|
8
9
|
module Tools
|
9
10
|
class Runner
|
10
11
|
class Fs
|
11
12
|
class Selected
|
12
|
-
DEFAULT_TRAVERSER_RECURSIVE = true
|
13
|
-
|
14
13
|
enable_jobs_runner
|
15
|
-
runner_with :confirmation, :help
|
14
|
+
runner_with :confirmation, :help do
|
16
15
|
desc 'Seleciona diretórios.'
|
17
16
|
arg_opt '-b', '--build-dir', 'Constrói diretório alvo.'
|
17
|
+
arg_opt '-f', '--filename', 'Nome do arquivo que anota o diretório como selecionado.',
|
18
|
+
default: ::EhbrsRubyUtils::Fs::Selected::DEFAULT_FILENAME
|
19
|
+
|
20
|
+
pos_arg :root_path
|
18
21
|
end
|
19
22
|
|
20
23
|
def run
|
21
|
-
infov '
|
24
|
+
infov 'Root path', selected.root_path
|
25
|
+
infov 'Filename', selected.filename
|
26
|
+
infov 'Build directory', build_dir.if_present('-')
|
22
27
|
run_jobs :show, :build
|
23
28
|
end
|
24
29
|
|
@@ -33,24 +38,18 @@ module Ehbrs
|
|
33
38
|
end
|
34
39
|
|
35
40
|
def directory_target_basename(directory)
|
36
|
-
directory
|
41
|
+
::EhbrsRubyUtils::Fs::Selected::Build::DEFAULT_TARGET_BASENAME_PROC.call(directory)
|
37
42
|
end
|
38
43
|
|
39
44
|
private
|
40
45
|
|
41
46
|
def build
|
42
47
|
infom "Building directory \"#{build_dir}\" with selected..."
|
43
|
-
build_dir.
|
44
|
-
selected_directories.each do |directory|
|
45
|
-
::EacRubyUtils::Envs.local.command(
|
46
|
-
'ln', '-s', directory.to_path,
|
47
|
-
build_dir.join(directory_target_basename(directory))
|
48
|
-
).system!
|
49
|
-
end
|
48
|
+
selected.build(build_dir, &method(:directory_target_basename)).perform
|
50
49
|
end
|
51
50
|
|
52
51
|
def build_dir_uncached
|
53
|
-
parsed.build_dir.if_present
|
52
|
+
parsed.build_dir.if_present(&:to_pathname)
|
54
53
|
end
|
55
54
|
|
56
55
|
def run_build?
|
@@ -59,9 +58,11 @@ module Ehbrs
|
|
59
58
|
|
60
59
|
def selected_directories_uncached
|
61
60
|
infom 'Searching selected directories...'
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
selected.found.map { |path| build_selected_directory(path) }
|
62
|
+
end
|
63
|
+
|
64
|
+
def selected_uncached
|
65
|
+
::EhbrsRubyUtils::Fs::Selected.new(parsed.root_path, filename: parsed.filename)
|
65
66
|
end
|
66
67
|
|
67
68
|
def show
|
@@ -70,10 +71,6 @@ module Ehbrs
|
|
70
71
|
puts directory_label(directory)
|
71
72
|
end
|
72
73
|
end
|
73
|
-
|
74
|
-
def traverser_check_directory(path)
|
75
|
-
@selected << build_selected_directory(path) if path.join('.selected').exist?
|
76
|
-
end
|
77
74
|
end
|
78
75
|
end
|
79
76
|
end
|
data/lib/ehbrs/tools/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
|
-
require '
|
4
|
+
require 'ehbrs_ruby_utils/fs/compressed_package'
|
5
5
|
require 'ehbrs/videos/extract/package_file'
|
6
6
|
|
7
7
|
module Ehbrs
|
@@ -37,7 +37,7 @@ module Ehbrs
|
|
37
37
|
raise "Extract directory \"#{r}\" is a file" if r.file?
|
38
38
|
|
39
39
|
r.rmtree if r.directory?
|
40
|
-
::
|
40
|
+
::EhbrsRubyUtils::Fs::CompressedPackage.new(path).extract_to(r)
|
41
41
|
r
|
42
42
|
end
|
43
43
|
|
@@ -18,7 +18,7 @@ module EacCli
|
|
18
18
|
|
19
19
|
enable_listable
|
20
20
|
enable_abstract_methods :build_value, :default_value
|
21
|
-
lists.add_symbol :option, :optional, :usage, :repeat, :required
|
21
|
+
lists.add_symbol :option, :default, :optional, :usage, :repeat, :required
|
22
22
|
common_constructor :short, :long, :description, :options, default: [{}] do
|
23
23
|
raise 'Nor short neither long selector was set' if short.blank? && long.blank?
|
24
24
|
|
@@ -27,6 +27,14 @@ module EacCli
|
|
27
27
|
)
|
28
28
|
end
|
29
29
|
|
30
|
+
def default_value
|
31
|
+
default_value? ? options[OPTION_DEFAULT] : default_default_value
|
32
|
+
end
|
33
|
+
|
34
|
+
def default_value?
|
35
|
+
options.key?(OPTION_DEFAULT)
|
36
|
+
end
|
37
|
+
|
30
38
|
def identifier
|
31
39
|
[long, short].each do |v|
|
32
40
|
v.to_s.if_present { |vv| return vv.variableize.to_sym }
|
@@ -36,9 +36,9 @@ module EacCli
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def option_definition(option)
|
39
|
-
self.class.option_usage_full(option)
|
40
|
-
|
41
|
-
|
39
|
+
[self.class.option_usage_full(option), option.description,
|
40
|
+
option.default_value? ? "[Default: \"#{option.default_value}\"]" : nil]
|
41
|
+
.reject(&:blank?).join(OPTION_DESC_SEP)
|
42
42
|
end
|
43
43
|
|
44
44
|
def section(header, include_header = true)
|
@@ -13,6 +13,7 @@ RSpec.describe ::EacCli::Runner do
|
|
13
13
|
bool_opt '-p', '--opt2', 'A boolean option'
|
14
14
|
arg_opt '-q', '--opt4', 'A repeatable argument option.', repeat: true
|
15
15
|
bool_opt '-r', '--opt5', 'A repeatable boolean option', repeat: true
|
16
|
+
arg_opt '-s', '--opt6', 'A argument option with default value', default: 'DEFAULT'
|
16
17
|
pos_arg :pos1
|
17
18
|
pos_arg :pos2, repeat: true, optional: true
|
18
19
|
alt do
|
@@ -28,9 +29,9 @@ RSpec.describe ::EacCli::Runner do
|
|
28
29
|
let(:parsed_actual) { instance.parsed.to_h.symbolize_keys }
|
29
30
|
|
30
31
|
context 'when all args are supplied' do
|
31
|
-
let(:argv) { %w[--opt1 aaa --opt2 bbb ccc ddd] }
|
32
|
+
let(:argv) { %w[--opt1 aaa --opt2 bbb ccc ddd --opt6 6] }
|
32
33
|
let(:parsed_expected) do
|
33
|
-
{ opt1: 'aaa', opt2: true, opt3: false, opt4: [], opt5: 0, pos1: 'bbb',
|
34
|
+
{ opt1: 'aaa', opt2: true, opt3: false, opt4: [], opt5: 0, opt6: '6', pos1: 'bbb',
|
34
35
|
pos2: %w[ccc ddd] }
|
35
36
|
end
|
36
37
|
|
@@ -65,7 +66,7 @@ RSpec.describe ::EacCli::Runner do
|
|
65
66
|
context 'when only required args are supplied' do
|
66
67
|
let(:argv) { %w[bbb] }
|
67
68
|
let(:parsed_expected) do
|
68
|
-
{ opt1: nil, opt2: false, opt3: false, opt4: [], opt5: 0, pos1: 'bbb',
|
69
|
+
{ opt1: nil, opt2: false, opt3: false, opt4: [], opt5: 0, opt6: 'DEFAULT', pos1: 'bbb',
|
69
70
|
pos2: [] }
|
70
71
|
end
|
71
72
|
|
@@ -87,7 +88,7 @@ RSpec.describe ::EacCli::Runner do
|
|
87
88
|
context 'when alternative args are supplied' do
|
88
89
|
let(:argv) { %w[--opt3] }
|
89
90
|
let(:parsed_expected) do
|
90
|
-
{ opt1: nil, opt2: false, opt3: true, opt4: [], opt5: 0, pos1: nil,
|
91
|
+
{ opt1: nil, opt2: false, opt3: true, opt4: [], opt5: 0, opt6: 'DEFAULT', pos1: nil,
|
91
92
|
pos2: [] }
|
92
93
|
end
|
93
94
|
|
@@ -98,7 +99,7 @@ RSpec.describe ::EacCli::Runner do
|
|
98
99
|
context 'when repeated options are supplied' do
|
99
100
|
let(:argv) { %w[--opt5 -rrr --opt4=A -q B --opt4 C AAA] }
|
100
101
|
let(:parsed_expected) do
|
101
|
-
{ opt1: nil, opt2: false, opt3: false, opt4: %w[A B C], opt5: 4, pos1: 'AAA',
|
102
|
+
{ opt1: nil, opt2: false, opt3: false, opt4: %w[A B C], opt5: 4, opt6: 'DEFAULT', pos1: 'AAA',
|
102
103
|
pos2: [] }
|
103
104
|
end
|
104
105
|
|
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.test_files = Dir['{spec}/**/*', '.rubocop.yml', '.rspec']
|
17
17
|
|
18
18
|
s.add_dependency 'aranha-parsers', '~> 0.8', '>= 0.8.5'
|
19
|
+
s.add_dependency 'avm', '~> 0.3', '>= 0.3.2'
|
19
20
|
s.add_dependency 'eac_ruby_utils', '~> 0.70'
|
20
21
|
s.add_dependency 'eac_templates', '~> 0.1', '>= 0.1.1'
|
21
22
|
s.add_dependency 'taglib-ruby', '~> 1.1'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs_ruby_utils/fs/selected/build_file'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module Fs
|
8
|
+
class Selected
|
9
|
+
class Build
|
10
|
+
DEFAULT_TARGET_BASENAME_PROC = ::Proc.new { |basename| basename }
|
11
|
+
|
12
|
+
attr_reader :selected, :target_dir, :target_basename_proc
|
13
|
+
|
14
|
+
def initialize(selected, target_dir, &target_basename_proc)
|
15
|
+
@selected = selected
|
16
|
+
@target_dir = target_dir.to_pathname
|
17
|
+
@target_basename_proc = target_basename_proc.presence || DEFAULT_TARGET_BASENAME_PROC
|
18
|
+
end
|
19
|
+
|
20
|
+
def perform
|
21
|
+
clear_target_dir
|
22
|
+
link_selected_found
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def clear_target_dir
|
28
|
+
target_dir.children.each do |c|
|
29
|
+
c.unlink if c.symlink? && c.directory?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def link_selected_found
|
34
|
+
selected.found.each do |found|
|
35
|
+
::EhbrsRubyUtils::Fs::Selected::BuildFile.new(self, found).perform
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Fs
|
7
|
+
class Selected
|
8
|
+
class BuildFile
|
9
|
+
common_constructor :build, :path do
|
10
|
+
self.path = path.to_pathname
|
11
|
+
end
|
12
|
+
|
13
|
+
def perform
|
14
|
+
target_path.make_symlink(path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def target_path
|
18
|
+
build.target_dir.join(target_basename)
|
19
|
+
end
|
20
|
+
|
21
|
+
def target_basename
|
22
|
+
build.target_basename_proc.call(path.basename.to_path)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Fs
|
7
|
+
class Selected
|
8
|
+
require_sub __FILE__
|
9
|
+
DEFAULT_FILENAME = '.selected'
|
10
|
+
|
11
|
+
enable_listable
|
12
|
+
enable_simple_cache
|
13
|
+
lists.add_symbol :option, :filename, :target_name_builder
|
14
|
+
common_constructor :root_path, :options, default: [{}] do
|
15
|
+
self.root_path = root_path.to_pathname
|
16
|
+
self.options = self.class.lists.option.hash_keys_validate!(options)
|
17
|
+
end
|
18
|
+
|
19
|
+
def build(target_dir)
|
20
|
+
::EhbrsRubyUtils::Fs::Selected::Build.new(self, target_dir)
|
21
|
+
end
|
22
|
+
|
23
|
+
def filename
|
24
|
+
options[OPTION_FILENAME].if_present(DEFAULT_FILENAME)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# @return [Pathname]
|
30
|
+
def found_uncached
|
31
|
+
root_path.glob("**/#{filename}").map(&:parent).sort
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -7,8 +7,10 @@ require 'ultimate_lyrics/version'
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = 'ultimate_lyrics'
|
9
9
|
s.version = UltimateLyrics::VERSION
|
10
|
-
s.authors = ['
|
11
|
-
s.summary = '
|
10
|
+
s.authors = ['Eduardo H. Bogoni']
|
11
|
+
s.summary = 'Fetch song lyrics from popular websites.'
|
12
|
+
s.homepage = 'https://rubygems.org/gems/ultimate_lyrics'
|
13
|
+
s.metadata = { 'source_code_uri' => 'https://github.com/esquilo-azul/ultimate_lyrics' }
|
12
14
|
|
13
15
|
s.files = Dir['{lib}/**/*']
|
14
16
|
|
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.27.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: 2021-09-
|
11
|
+
date: 2021-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm-tools
|
@@ -179,8 +179,6 @@ files:
|
|
179
179
|
- lib/ehbrs/cooking_book/recipe/measure.rb
|
180
180
|
- lib/ehbrs/cooking_book/recipe/part.rb
|
181
181
|
- lib/ehbrs/executables.rb
|
182
|
-
- lib/ehbrs/fs.rb
|
183
|
-
- lib/ehbrs/fs/compressed_package.rb
|
184
182
|
- lib/ehbrs/gems.rb
|
185
183
|
- lib/ehbrs/google.rb
|
186
184
|
- lib/ehbrs/google/translate.rb
|
@@ -690,6 +688,11 @@ files:
|
|
690
688
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils.rb
|
691
689
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/executables.rb
|
692
690
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/finances/bb_browser/docker_image.rb
|
691
|
+
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs.rb
|
692
|
+
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/compressed_package.rb
|
693
|
+
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected.rb
|
694
|
+
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build.rb
|
695
|
+
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build_file.rb
|
693
696
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music.rb
|
694
697
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches/object/template.rb
|
695
698
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb
|