ehbrs-tools 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ehbrs/core_ext.rb +4 -0
- data/lib/ehbrs/music/album.rb +2 -0
- data/{vendor/eac_cli/lib/eac_cli/patches/module.rb → lib/ehbrs/patches.rb} +1 -1
- data/lib/ehbrs/runner/fs/selected.rb +79 -0
- data/lib/ehbrs/runner/fs/used_space.rb +1 -2
- data/lib/ehbrs/runner/music/selected.rb +9 -46
- data/lib/ehbrs/tools/version.rb +1 -1
- data/lib/ehbrs/videos/unsupported/check_support.rb +12 -8
- data/vendor/avm-apps/Gemfile +5 -0
- data/vendor/avm-apps/avm-apps.gemspec +18 -0
- data/vendor/avm-apps/lib/avm/apps.rb +9 -0
- data/vendor/avm-apps/lib/avm/apps/config.rb +19 -0
- data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
- data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
- data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
- data/vendor/avm-apps/lib/avm/apps/sources/configuration.rb +57 -0
- data/vendor/avm-apps/lib/avm/apps/sources/configuration/_locale.rb +18 -0
- data/vendor/avm-apps/lib/avm/apps/sources/configuration/_rubocop.rb +26 -0
- data/vendor/avm-apps/lib/avm/apps/sources/configuration/_tests.rb +29 -0
- data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
- data/vendor/avm-apps/spec/rubocop_spec.rb +3 -0
- data/vendor/avm-apps/spec/spec_helper.rb +103 -0
- data/vendor/eac_cli/eac_cli.gemspec +1 -2
- data/vendor/eac_cli/lib/eac_cli/config.rb +16 -0
- data/vendor/eac_cli/lib/eac_cli/config/entry.rb +48 -0
- data/vendor/eac_cli/lib/eac_cli/config/entry/options.rb +57 -0
- data/vendor/eac_cli/lib/eac_cli/config/entry/undefined.rb +26 -0
- data/vendor/eac_cli/lib/eac_cli/definition/help_formatter.rb +3 -2
- data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +6 -1
- data/vendor/eac_cli/lib/eac_cli/old_configs.rb +0 -1
- data/vendor/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +2 -2
- data/vendor/eac_cli/lib/eac_cli/old_configs_bridge.rb +39 -0
- data/vendor/eac_cli/lib/eac_cli/runner.rb +0 -2
- data/vendor/eac_cli/lib/eac_cli/runner/after_class_methods.rb +20 -3
- data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +5 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +9 -4
- data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder.rb +73 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb +56 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +6 -4
- data/vendor/eac_cli/lib/eac_cli/speaker.rb +15 -19
- data/vendor/eac_cli/lib/eac_cli/speaker/_constants.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/speaker/list.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/speaker/options.rb +38 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +0 -1
- data/vendor/eac_cli/spec/lib/eac_cli/speaker_spec.rb +5 -9
- data/vendor/eac_config/Gemfile +5 -0
- data/vendor/eac_config/eac_config.gemspec +19 -0
- data/vendor/eac_config/lib/eac_config.rb +7 -0
- data/vendor/eac_config/lib/eac_config/entry.rb +49 -0
- data/vendor/eac_config/lib/eac_config/entry_path.rb +41 -0
- data/vendor/eac_config/lib/eac_config/envvars_node.rb +25 -0
- data/vendor/eac_config/lib/eac_config/envvars_node/entry.rb +54 -0
- data/vendor/eac_config/lib/eac_config/load_nodes_search.rb +39 -0
- data/vendor/eac_config/lib/eac_config/load_path.rb +28 -0
- data/vendor/eac_config/lib/eac_config/node.rb +67 -0
- data/vendor/eac_config/lib/eac_config/node_entry.rb +18 -0
- data/vendor/eac_config/lib/eac_config/node_uri.rb +38 -0
- data/vendor/eac_config/lib/eac_config/old_configs.rb +75 -0
- data/vendor/eac_config/lib/eac_config/old_configs/base.rb +43 -0
- data/vendor/eac_config/lib/eac_config/old_configs/file.rb +47 -0
- data/vendor/eac_config/lib/eac_config/paths_hash.rb +56 -0
- data/vendor/eac_config/lib/eac_config/paths_hash/entry_key_error.rb +8 -0
- data/vendor/eac_config/lib/eac_config/paths_hash/node.rb +67 -0
- data/vendor/eac_config/lib/eac_config/paths_hash/path_search.rb +39 -0
- data/vendor/eac_config/lib/eac_config/version.rb +5 -0
- data/vendor/eac_config/lib/eac_config/yaml_file_node.rb +48 -0
- data/vendor/eac_config/lib/eac_config/yaml_file_node/entry.rb +37 -0
- data/vendor/eac_config/spec/lib/eac_config/entry_path_spec.rb +30 -0
- data/vendor/eac_config/spec/lib/eac_config/envvars_node/entry_spec.rb +14 -0
- data/vendor/eac_config/spec/lib/eac_config/envvars_node_spec.rb +40 -0
- data/vendor/eac_config/spec/lib/eac_config/old_configs_spec.rb +46 -0
- data/vendor/eac_config/spec/lib/eac_config/paths_hash_spec.rb +88 -0
- data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec.rb +52 -0
- data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +6 -0
- data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +2 -0
- data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +4 -0
- data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +2 -0
- data/vendor/eac_config/spec/rubocop_spec.rb +3 -0
- data/vendor/eac_config/spec/spec_helper.rb +17 -0
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +2 -2
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +23 -9
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application_xdg.rb +34 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +2 -2
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +19 -7
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +8 -1
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/context.rb +31 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/contextualizable.rb +12 -7
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/context.rb +11 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/speaker.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +10 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker.rb +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb +57 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/sender.rb +32 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/{eac_cli/spec/lib → eac_ruby_utils/spec/lib/eac_ruby_utils/patches}/module/speaker_spec.rb +2 -2
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +18 -0
- metadata +69 -18
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +0 -71
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +0 -50
- data/vendor/eac_cli/lib/eac_cli/docopt/runner_context_replacement.rb +0 -15
- data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +0 -51
- data/vendor/eac_cli/lib/eac_cli/docopt_runner.rb +0 -43
- data/vendor/eac_cli/lib/eac_cli/docopt_runner/_class_methods.rb +0 -16
- data/vendor/eac_cli/lib/eac_cli/docopt_runner/_doc.rb +0 -23
- data/vendor/eac_cli/lib/eac_cli/docopt_runner/_settings.rb +0 -17
- data/vendor/eac_cli/lib/eac_cli/docopt_runner/_subcommands.rb +0 -152
- data/vendor/eac_cli/lib/eac_cli/patches/module/speaker.rb +0 -10
- data/vendor/eac_cli/lib/eac_cli/speaker/_class_methods.rb +0 -37
- data/vendor/eac_cli/lib/eac_cli/speaker/node.rb +0 -24
- data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +0 -35
- data/vendor/eac_cli/spec/lib/eac_cli/docopt_runner_spec.rb +0 -136
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65c2d3133ff7e4ef5b4525fd989ea39ca9ba76b6993d470d47543a06258f2f9c
|
4
|
+
data.tar.gz: 42bc25487ca6b2b1aba7ce315a9a9bc311767d26480b08b7b04ee1e88fbf7b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e73a214bae3409ae28b10ecbfdccc70ccc9981af6140a6371ab158b8552cd1564c8346964f6c4dff005b53e3434e162d9a48fc404c2d321d69504c393ea4a372
|
7
|
+
data.tar.gz: 6a84239f517e9a985e9890717a6dd6a5e2db3623199913da8165bcdf0a484c264428027a3d5514464b6fe7721cc3ffb54753b58f5a4eb399c8b463ec1effb580
|
data/lib/ehbrs/music/album.rb
CHANGED
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/envs'
|
4
|
+
require 'eac_ruby_utils/fs/clearable_directory'
|
5
|
+
require 'ehbrs/core_ext'
|
6
|
+
|
7
|
+
module Ehbrs
|
8
|
+
class Runner
|
9
|
+
class Fs
|
10
|
+
class Selected
|
11
|
+
DEFAULT_TRAVERSER_RECURSIVE = true
|
12
|
+
|
13
|
+
enable_jobs_runner
|
14
|
+
runner_with :confirmation, :help, :filesystem_traverser do
|
15
|
+
desc 'Seleciona diretórios.'
|
16
|
+
arg_opt '-b', '--build-dir', 'Constrói diretório alvo.'
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
infov 'Recursive', traverser_recursive
|
21
|
+
run_jobs :show, :build
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def build_selected_directory(path)
|
27
|
+
path
|
28
|
+
end
|
29
|
+
|
30
|
+
def directory_label(directory)
|
31
|
+
directory.to_s
|
32
|
+
end
|
33
|
+
|
34
|
+
def directory_target_basename(directory)
|
35
|
+
directory.basename.to_path
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def build
|
41
|
+
infom "Building directory \"#{build_dir}\" with selected..."
|
42
|
+
build_dir.clear
|
43
|
+
selected_directories.each do |directory|
|
44
|
+
::EacRubyUtils::Envs.local.command(
|
45
|
+
'ln', '-s', directory.to_path,
|
46
|
+
build_dir.join(directory_target_basename(directory))
|
47
|
+
).system!
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def build_dir_uncached
|
52
|
+
parsed.build_dir.if_present { |v| ::EacRubyUtils::Fs::ClearableDirectory.new(v) }
|
53
|
+
end
|
54
|
+
|
55
|
+
def run_build?
|
56
|
+
build_dir.present? && confirm?('Build?')
|
57
|
+
end
|
58
|
+
|
59
|
+
def selected_directories_uncached
|
60
|
+
infom 'Searching selected directories...'
|
61
|
+
@selected = []
|
62
|
+
run_filesystem_traverser
|
63
|
+
@selected.sort
|
64
|
+
end
|
65
|
+
|
66
|
+
def show
|
67
|
+
infov 'Directories found', selected_directories.count
|
68
|
+
selected_directories.each do |directory|
|
69
|
+
puts directory_label(directory)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def traverser_check_directory(path)
|
74
|
+
@selected << build_selected_directory(path) if path.join('.selected').exist?
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -1,61 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_base0/patches'
|
4
|
-
require 'eac_ruby_utils/fs/clearable_directory'
|
5
3
|
require 'ehbrs/music/album'
|
4
|
+
require 'ehbrs/runner/fs/selected'
|
6
5
|
|
7
6
|
module Ehbrs
|
8
7
|
class Runner
|
9
8
|
class Music
|
10
|
-
class Selected
|
11
|
-
|
9
|
+
class Selected < ::Ehbrs::Runner::Fs::Selected
|
10
|
+
protected
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
desc 'Seleciona álbuns de música.'
|
16
|
-
arg_opt '-b', '--build-dir', 'Constrói diretório de músicas selecionadas.'
|
12
|
+
def build_selected_directory(path)
|
13
|
+
::Ehbrs::Music::Album.new(path)
|
17
14
|
end
|
18
15
|
|
19
|
-
def
|
20
|
-
|
21
|
-
run_jobs :show, :build
|
16
|
+
def directory_label(directory)
|
17
|
+
directory.to_label
|
22
18
|
end
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
def build
|
27
|
-
infom 'Building...'
|
28
|
-
build_dir.clear
|
29
|
-
selected_albums.each do |album|
|
30
|
-
::EacRubyUtils::Envs.local.command('ln', '-s', album.path,
|
31
|
-
build_dir.join(album.id)).system!
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def build_dir_uncached
|
36
|
-
parsed.build_dir.if_present { |v| ::EacRubyUtils::Fs::ClearableDirectory.new(v) }
|
37
|
-
end
|
38
|
-
|
39
|
-
def run_build?
|
40
|
-
build_dir.present?
|
41
|
-
end
|
42
|
-
|
43
|
-
def selected_albums_uncached
|
44
|
-
infom 'Searching selected albums...'
|
45
|
-
@selected = []
|
46
|
-
run_filesystem_traverser
|
47
|
-
@selected.sort
|
48
|
-
end
|
49
|
-
|
50
|
-
def show
|
51
|
-
infov 'Albums found', selected_albums.count
|
52
|
-
selected_albums.each do |album|
|
53
|
-
puts album.to_label
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def traverser_check_directory(path)
|
58
|
-
@selected << ::Ehbrs::Music::Album.new(path) if path.join('.selected').exist?
|
20
|
+
def directory_target_basename(directory)
|
21
|
+
directory.id
|
59
22
|
end
|
60
23
|
end
|
61
24
|
end
|
data/lib/ehbrs/tools/version.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
4
|
require 'ehbrs/videos/unsupported/check_result'
|
5
5
|
|
6
6
|
module Ehbrs
|
7
7
|
module Videos
|
8
8
|
module Unsupported
|
9
9
|
module CheckSupport
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
include ::EacCli::Speaker
|
14
|
-
include ::EacRubyUtils::SimpleCache
|
10
|
+
common_concern do
|
11
|
+
enable_simple_cache
|
12
|
+
enable_speaker
|
15
13
|
end
|
16
14
|
|
17
15
|
def aggressions_banner(title)
|
@@ -58,11 +56,17 @@ module Ehbrs
|
|
58
56
|
end
|
59
57
|
|
60
58
|
def pad_speaker
|
61
|
-
|
62
|
-
node.stderr_line_prefix = node.stderr_line_prefix.to_s + ' '
|
59
|
+
::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new(err_line_prefix: ' ')) do
|
63
60
|
yield
|
64
61
|
end
|
65
62
|
end
|
63
|
+
|
64
|
+
def new_padded_cli_speaker
|
65
|
+
::EacCli::Speaker.new(
|
66
|
+
err_line_prefix(::EacRubyUtils::Speaker.context.optional_current
|
67
|
+
.if_present('') { |v| v.is_a?(::EacCli::Speaker) ? v.err_line_prefix : '' } + ' ')
|
68
|
+
)
|
69
|
+
end
|
66
70
|
end
|
67
71
|
end
|
68
72
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
|
5
|
+
require 'avm/apps/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'avm-apps'
|
9
|
+
s.version = Avm::Apps::VERSION
|
10
|
+
s.authors = ['Eduardo H. Bogoni']
|
11
|
+
s.summary = 'AVM components for applications.'
|
12
|
+
|
13
|
+
s.files = Dir['{lib}/**/*']
|
14
|
+
|
15
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.67'
|
16
|
+
|
17
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Apps
|
7
|
+
class Config
|
8
|
+
class << self
|
9
|
+
# @deprecated Use EacConfig::Node.context instead.
|
10
|
+
# @return [EacRubyUtils::Context<EacConfig::Node>]
|
11
|
+
def context
|
12
|
+
::EacConfig::Node.context
|
13
|
+
end
|
14
|
+
|
15
|
+
delegate :current, to: :context
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/apps/jobs/variables_source'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Apps
|
8
|
+
module Jobs
|
9
|
+
module Base
|
10
|
+
common_concern do
|
11
|
+
include ::ActiveSupport::Callbacks
|
12
|
+
|
13
|
+
enable_speaker
|
14
|
+
enable_simple_cache
|
15
|
+
enable_listable
|
16
|
+
common_constructor :instance, :options, default: [{}] do
|
17
|
+
if option_list.present?
|
18
|
+
self.options = option_list.hash_keys_validate!(options.symbolize_keys)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
define_callbacks(*jobs)
|
22
|
+
end
|
23
|
+
|
24
|
+
module ClassMethods
|
25
|
+
def jobs
|
26
|
+
const_get('JOBS').dup
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
module InstanceMethods
|
31
|
+
def option_list
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
|
35
|
+
def run
|
36
|
+
start_banner if respond_to?(:start_banner)
|
37
|
+
run_jobs
|
38
|
+
::Avm::Result.success('Done!')
|
39
|
+
rescue ::Avm::Result::Error => e
|
40
|
+
e.to_result
|
41
|
+
end
|
42
|
+
|
43
|
+
def variables_source
|
44
|
+
::Avm::Apps::Jobs::VariablesSource.new(self, instance)
|
45
|
+
end
|
46
|
+
|
47
|
+
protected
|
48
|
+
|
49
|
+
def run_jobs
|
50
|
+
jobs.each do |job|
|
51
|
+
run_callbacks job do
|
52
|
+
send(job)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def jobs
|
58
|
+
self.class.jobs
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Apps
|
7
|
+
module Jobs
|
8
|
+
class VariablesSource
|
9
|
+
common_constructor :job, :instance
|
10
|
+
|
11
|
+
def read_entry(path, options = {})
|
12
|
+
entry_from_job(path) || instance.read_entry(path, options)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def entry_from_job(path)
|
18
|
+
method = path.gsub('.', '_').underscore
|
19
|
+
return job.send(method) if job.respond_to?(method, true)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_config/old_configs'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Apps
|
9
|
+
module Sources
|
10
|
+
class Configuration < ::EacConfig::OldConfigs
|
11
|
+
require_sub __FILE__
|
12
|
+
|
13
|
+
FILENAMES = %w[.avm.yml .avm.yaml].freeze
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def find_by_path(path)
|
17
|
+
path = ::Pathname.new(path.to_s) unless path.is_a?(::Pathname)
|
18
|
+
internal_find_path(path.expand_path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def find_in_path(path)
|
22
|
+
absolute_pathname = path.to_pathname.expand_path
|
23
|
+
if absolute_pathname.directory?
|
24
|
+
FILENAMES.each do |filename|
|
25
|
+
file = absolute_pathname.join(filename)
|
26
|
+
return new(file) if file.exist?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def internal_find_path(absolute_pathname)
|
35
|
+
r = find_in_path(absolute_pathname)
|
36
|
+
return r if r.present?
|
37
|
+
|
38
|
+
internal_find_path(absolute_pathname.dirname) unless absolute_pathname.root?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def initialize(path)
|
43
|
+
super(nil, storage_path: path)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Utility to read a configuration as a [EacRubyUtils::Envs::Command].
|
47
|
+
# @return [EacRubyUtils::Envs::Command]
|
48
|
+
def read_command(key)
|
49
|
+
read_entry(key).if_present do |v|
|
50
|
+
args = v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v)
|
51
|
+
::EacRubyUtils::Envs.local.command(args).chdir(::File.dirname(storage_path))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|