ehbrs-tools 0.20.0 → 0.21.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/patches/object/template.rb +2 -2
- data/lib/ehbrs/runner/cooking_book/build.rb +20 -2
- data/lib/ehbrs/runner/fs/used_space.rb +1 -1
- data/lib/ehbrs/runner/videos/probe.rb +2 -2
- data/lib/ehbrs/tools/version.rb +1 -1
- data/lib/ehbrs/videos/convert_job.rb +1 -1
- data/lib/ehbrs/videos/series/rename/line_result.rb +1 -1
- data/lib/ehbrs/videos/unsupported/check_support.rb +2 -1
- data/lib/ehbrs/videos/unsupported/search.rb +1 -1
- data/lib/ehbrs/videos/unsupported/track.rb +1 -1
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/base.rb +8 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/chrome.rb +10 -5
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/firefox.rb +25 -11
- data/vendor/aranha-selenium/lib/aranha/selenium/version.rb +1 -1
- data/vendor/eac_cli/eac_cli.gemspec +5 -2
- data/vendor/eac_cli/lib/eac_cli/default_runner.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +5 -1
- data/vendor/eac_cli/lib/eac_cli/definition/help_formatter.rb +2 -2
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +4 -2
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +3 -3
- data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +2 -2
- data/vendor/eac_cli/lib/eac_cli/docopt_runner.rb +43 -0
- data/vendor/eac_cli/lib/eac_cli/docopt_runner/_class_methods.rb +16 -0
- data/vendor/eac_cli/lib/eac_cli/docopt_runner/_doc.rb +23 -0
- data/vendor/eac_cli/lib/eac_cli/docopt_runner/_settings.rb +17 -0
- data/vendor/eac_cli/lib/eac_cli/docopt_runner/_subcommands.rb +152 -0
- data/vendor/eac_cli/lib/eac_cli/old_configs.rb +36 -0
- data/vendor/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +80 -0
- data/vendor/eac_cli/lib/eac_cli/old_configs/password_entry_reader.rb +16 -0
- data/vendor/eac_cli/lib/eac_cli/old_configs/read_entry_options.rb +44 -0
- data/vendor/eac_cli/lib/eac_cli/old_configs/store_passwords_entry_reader.rb +25 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +4 -2
- data/vendor/eac_cli/lib/eac_cli/patches/module.rb +4 -0
- data/vendor/eac_cli/lib/eac_cli/patches/module/speaker.rb +10 -0
- data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +2 -1
- data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +8 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +5 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands/definition_concern.rb +10 -0
- data/vendor/eac_cli/lib/eac_cli/speaker.rb +131 -0
- data/vendor/eac_cli/lib/eac_cli/speaker/_class_methods.rb +37 -0
- data/vendor/eac_cli/lib/eac_cli/speaker/_constants.rb +12 -0
- data/vendor/eac_cli/lib/eac_cli/speaker/list.rb +61 -0
- data/vendor/eac_cli/lib/eac_cli/speaker/node.rb +24 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +1 -1
- data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/console → eac_cli/spec/lib/eac_cli}/docopt_runner_spec.rb +5 -5
- data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/console/configs_spec.rb → eac_cli/spec/lib/eac_cli/old_configs_spec.rb} +2 -2
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +1 -1
- data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/console → eac_cli/spec/lib/eac_cli}/speaker_spec.rb +2 -2
- data/vendor/eac_cli/spec/lib/module/speaker_spec.rb +13 -0
- data/vendor/eac_cli/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_cli/spec/spec_helper.rb +3 -0
- data/vendor/eac_docker/eac_docker.gemspec +3 -2
- data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +1 -0
- data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
- data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec.rb +2 -1
- data/vendor/eac_docker/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_docker/spec/spec_helper.rb +3 -0
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -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 +3 -5
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +36 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +36 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +58 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
- data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb +81 -0
- data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_ruby_base0/spec/spec_helper.rb +3 -0
- data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +2 -3
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +10 -5
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb +6 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/logs.rb +63 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +9 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +3 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +4 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/common_concern.rb +0 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +4 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +34 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/conditional.rb +1 -4
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +10 -29
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +69 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +18 -5
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +8 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +9 -0
- data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -5
- data/vendor/eac_ruby_utils/spec/spec_helper.rb +3 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/convert_job.rb +1 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos/files_list.rb +1 -1
- metadata +51 -58
- data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +0 -30
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +0 -53
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmable.rb +0 -21
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs.rb +0 -74
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/base.rb +0 -43
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/file.rb +0 -47
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console.rb +0 -5
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +0 -38
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/entry_reader.rb +0 -81
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/password_entry_reader.rb +0 -18
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +0 -46
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/store_passwords_entry_reader.rb +0 -27
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb +0 -45
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +0 -18
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_doc.rb +0 -25
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_settings.rb +0 -19
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +0 -154
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker.rb +0 -133
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/_class_methods.rb +0 -39
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/_constants.rb +0 -14
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/list.rb +0 -63
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/node.rb +0 -26
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/console_speaker.rb +0 -10
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/template.rb +0 -10
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb +0 -9
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb +0 -56
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/entry_key_error.rb +0 -8
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/node.rb +0 -67
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/path_search.rb +0 -39
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates.rb +0 -9
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/directory.rb +0 -110
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/file.rb +0 -50
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/searcher.rb +0 -55
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_not_found_error.rb +0 -7
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers.rb +0 -25
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/base.rb +0 -23
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/entries_reader.rb +0 -25
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/generic.rb +0 -25
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/hash.rb +0 -29
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/configs_spec.rb +0 -46
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/console_speaker_spec.rb +0 -13
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec.rb +0 -23
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/paths_hash_spec.rb +0 -88
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec.rb +0 -35
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec_files/expected_content +0 -2
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec_files/source.template +0 -2
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec.rb +0 -30
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path1/subdir1/file1.template +0 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path1/subdir1/file2 +0 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path2/subdir1/file3.template +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ea7376b27f5582e0f1c154f3a218de64c6bb27c0d0c9109b6194c2ad1dc779b
|
4
|
+
data.tar.gz: d7916decd5768e2008e43313669bfd9d605662fb95d13c7fa64d33581b86afac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6798766e6cfbe66142f7ab0100016ddcf34744a2fd8c12e021d00a67d068310fa7e901521daba98a72a9c8bd6c85a9bd5bc7afb0270b4bdf99b646c354e553f1
|
7
|
+
data.tar.gz: 6ea855740d28d2676f9723cfe86f8ba3c12e29fb5ceda65ec068d3857172ff07d79df72df76332079afdec79f2725cb752179cc35f659c426485d59068e792eb
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'ehbrs/tools/application'
|
4
|
-
require '
|
4
|
+
require 'eac_templates/patches/object/template'
|
5
5
|
|
6
|
-
::
|
6
|
+
::EacTemplates::Searcher.default.included_paths <<
|
7
7
|
::Ehbrs::Tools.application.gemspec_dir.join('template').to_path
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'eac_cli/core_ext'
|
4
4
|
require 'ehbrs/cooking_book/build'
|
5
|
+
require 'os'
|
5
6
|
|
6
7
|
module Ehbrs
|
7
8
|
class Runner
|
@@ -10,12 +11,13 @@ module Ehbrs
|
|
10
11
|
runner_with :help, :subcommands do
|
11
12
|
desc 'Operações para livros de receitas.'
|
12
13
|
arg_opt '-d', '--target-dir', 'Caminho para o diretório destino da construção.'
|
14
|
+
bool_opt '--open', 'Show the result.'
|
13
15
|
end
|
14
16
|
|
15
17
|
def run
|
16
|
-
|
17
|
-
infov 'Target directory', build.target_dir
|
18
|
+
start_banner
|
18
19
|
build.run
|
20
|
+
open
|
19
21
|
success 'Done'
|
20
22
|
end
|
21
23
|
|
@@ -26,6 +28,22 @@ module Ehbrs
|
|
26
28
|
runner_context.call(:project), target_dir: parsed.target_dir
|
27
29
|
)
|
28
30
|
end
|
31
|
+
|
32
|
+
def open
|
33
|
+
return unless parsed.open?
|
34
|
+
|
35
|
+
infom "Opening \"#{open_path}\"..."
|
36
|
+
::EacRubyUtils::Envs.local.command(OS.open_file_command, open_path).system!
|
37
|
+
end
|
38
|
+
|
39
|
+
def open_path
|
40
|
+
build.index_page.target_path
|
41
|
+
end
|
42
|
+
|
43
|
+
def start_banner
|
44
|
+
infov 'Project', build.project
|
45
|
+
infov 'Target directory', build.target_dir
|
46
|
+
end
|
29
47
|
end
|
30
48
|
end
|
31
49
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_cli/core_ext'
|
4
3
|
require 'ehbrs_ruby_utils/videos/container'
|
4
|
+
require 'eac_ruby_base0/core_ext'
|
5
5
|
require 'eac_ruby_utils/yaml'
|
6
6
|
|
7
7
|
module Ehbrs
|
8
8
|
class Runner
|
9
9
|
class Videos
|
10
10
|
class Probe
|
11
|
-
runner_with :help, :
|
11
|
+
runner_with :help, :output do
|
12
12
|
desc 'FFProbe em um arquivo de vídeo.'
|
13
13
|
pos_arg :file_path
|
14
14
|
end
|
data/lib/ehbrs/tools/version.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_cli/speaker'
|
3
4
|
require 'ehbrs/videos/unsupported/check_result'
|
4
5
|
|
5
6
|
module Ehbrs
|
@@ -9,7 +10,7 @@ module Ehbrs
|
|
9
10
|
extend ::ActiveSupport::Concern
|
10
11
|
|
11
12
|
included do
|
12
|
-
include ::
|
13
|
+
include ::EacCli::Speaker
|
13
14
|
include ::EacRubyUtils::SimpleCache
|
14
15
|
end
|
15
16
|
|
@@ -14,14 +14,19 @@ module Aranha
|
|
14
14
|
|
15
15
|
def chrome_options
|
16
16
|
r = ::Selenium::WebDriver::Chrome::Options.new
|
17
|
-
r.add_argument(
|
18
|
-
r.add_argument('--headless') if headless?
|
19
|
-
r.add_argument('--disable-popup-blocking')
|
20
|
-
r.add_argument('--disable-translate')
|
21
|
-
r.add_argument("user-agent=#{user_agent}") if user_agent.present?
|
17
|
+
chrome_arguments.each { |arg| r.add_argument(arg) }
|
22
18
|
r.add_preference(:download, prompt_for_download: false, default_directory: downloads_dir)
|
23
19
|
r
|
24
20
|
end
|
21
|
+
|
22
|
+
def chrome_arguments
|
23
|
+
r = %w[--disable-popup-blocking --disable-translate]
|
24
|
+
r << '--ignore-certificate-errors' if accept_insecure_certs?
|
25
|
+
r << '--headless' if headless?
|
26
|
+
r << "--user-agent=#{user_agent}" if user_agent.present?
|
27
|
+
r << "--user-data-dir=#{profile_dir}" if profile_dir.present?
|
28
|
+
r
|
29
|
+
end
|
25
30
|
end
|
26
31
|
end
|
27
32
|
end
|
@@ -9,10 +9,7 @@ module Aranha
|
|
9
9
|
def build
|
10
10
|
::Selenium::WebDriver.for(
|
11
11
|
:firefox,
|
12
|
-
options:
|
13
|
-
profile: build_profile,
|
14
|
-
args: build_args
|
15
|
-
),
|
12
|
+
options: build_options,
|
16
13
|
desired_capabilities: build_capabilities
|
17
14
|
)
|
18
15
|
end
|
@@ -21,7 +18,7 @@ module Aranha
|
|
21
18
|
|
22
19
|
def build_args
|
23
20
|
r = []
|
24
|
-
r << '
|
21
|
+
r << '--headless' if headless?
|
25
22
|
r
|
26
23
|
end
|
27
24
|
|
@@ -33,16 +30,33 @@ module Aranha
|
|
33
30
|
end
|
34
31
|
end
|
35
32
|
|
36
|
-
def
|
37
|
-
r = ::Selenium::WebDriver::Firefox::
|
38
|
-
|
39
|
-
r
|
40
|
-
r
|
41
|
-
|
33
|
+
def build_options
|
34
|
+
r = ::Selenium::WebDriver::Firefox::Options.new(args: build_args,
|
35
|
+
prefs: build_preferences)
|
36
|
+
build_profile.if_present { |v| r.profile = v }
|
37
|
+
r
|
38
|
+
end
|
39
|
+
|
40
|
+
def build_preferences
|
41
|
+
r = {
|
42
|
+
'browser.download.dir' => downloads_dir,
|
43
|
+
'browser.download.folderList' => 2,
|
44
|
+
'browser.helperApps.neverAsk.saveToDisk' => auto_download_mime_types.join(';'),
|
45
|
+
'pdfjs.disabled' => true
|
46
|
+
}
|
42
47
|
r['general.useragent.override'] = user_agent if user_agent.present?
|
43
48
|
r
|
44
49
|
end
|
45
50
|
|
51
|
+
def build_profile
|
52
|
+
if profile_name.present?
|
53
|
+
::Selenium::WebDriver::Firefox::Profile.from_name(v)
|
54
|
+
elsif profile_dir.present?
|
55
|
+
::FileUtils.mkdir_p(profile_dir)
|
56
|
+
::Selenium::WebDriver::Firefox::Profile.new(profile_dir)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
46
60
|
def auto_download_mime_types
|
47
61
|
::File.read(
|
48
62
|
::File.join(__dir__, 'firefox_auto_download_mime_types')
|
@@ -12,7 +12,10 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*', 'Gemfile']
|
14
14
|
|
15
|
-
s.add_dependency '
|
15
|
+
s.add_dependency 'colorize', '~> 0.8.1'
|
16
|
+
s.add_dependency 'docopt', '~> 0.6.1'
|
17
|
+
s.add_dependency 'eac_config', '~> 0.3'
|
18
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.64'
|
16
19
|
|
17
|
-
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.
|
20
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
|
18
21
|
end
|
@@ -28,7 +28,11 @@ module EacCli
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def identifier
|
31
|
-
long.
|
31
|
+
[long, short].each do |v|
|
32
|
+
v.to_s.if_present { |vv| return vv.variableize.to_sym }
|
33
|
+
end
|
34
|
+
|
35
|
+
raise 'No short or long option to build identifier'
|
32
36
|
end
|
33
37
|
|
34
38
|
def repeat?
|
@@ -27,7 +27,7 @@ module EacCli
|
|
27
27
|
|
28
28
|
def positional_argument(positional)
|
29
29
|
if positional.subcommand?
|
30
|
-
::
|
30
|
+
::EacCli::DocoptRunner::SUBCOMMANDS_MACRO
|
31
31
|
else
|
32
32
|
r = "<#{positional.name}>"
|
33
33
|
r += '...' if positional.repeat?
|
@@ -52,7 +52,7 @@ module EacCli
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def self_usage_arguments
|
55
|
-
[::
|
55
|
+
[::EacCli::DocoptRunner::PROGRAM_MACRO] +
|
56
56
|
definition.options_argument.if_present([]) { |_v| ['[options]'] } +
|
57
57
|
self_usage_arguments_options +
|
58
58
|
self_usage_arguments_positional
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
|
-
require '
|
4
|
+
require 'eac_cli/docopt_runner'
|
5
5
|
|
6
6
|
module EacCli
|
7
7
|
module Docopt
|
@@ -36,7 +36,9 @@ module EacCli
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def option_definition(option)
|
39
|
-
self.class.option_usage_full(option) +
|
39
|
+
self.class.option_usage_full(option) + option.description.if_present('') do |v|
|
40
|
+
OPTION_DESC_SEP + v
|
41
|
+
end
|
40
42
|
end
|
41
43
|
|
42
44
|
def section(header, include_header = true)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
|
-
require '
|
4
|
+
require 'eac_cli/docopt_runner'
|
5
5
|
|
6
6
|
module EacCli
|
7
7
|
module Docopt
|
@@ -11,7 +11,7 @@ module EacCli
|
|
11
11
|
|
12
12
|
def to_s
|
13
13
|
(
|
14
|
-
[::
|
14
|
+
[::EacCli::DocoptRunner::PROGRAM_MACRO] +
|
15
15
|
alternative.options_argument?.if_present([]) { |_v| ['[options]'] } +
|
16
16
|
options +
|
17
17
|
positionals
|
@@ -36,7 +36,7 @@ module EacCli
|
|
36
36
|
|
37
37
|
def positional(positional)
|
38
38
|
if positional.subcommand?
|
39
|
-
::
|
39
|
+
::EacCli::DocoptRunner::SUBCOMMANDS_MACRO
|
40
40
|
else
|
41
41
|
r = "<#{positional.name}>"
|
42
42
|
r += '...' if positional.repeat?
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'eac_cli/docopt/doc_builder'
|
4
4
|
require 'eac_cli/docopt/runner_context_replacement'
|
5
5
|
require 'eac_cli/runner'
|
6
|
-
require '
|
6
|
+
require 'eac_cli/docopt_runner'
|
7
7
|
|
8
8
|
module EacCli
|
9
9
|
module Docopt
|
@@ -16,7 +16,7 @@ module EacCli
|
|
16
16
|
|
17
17
|
class << self
|
18
18
|
def check(klass)
|
19
|
-
return unless klass < ::
|
19
|
+
return unless klass < ::EacCli::DocoptRunner
|
20
20
|
|
21
21
|
::EacCli::Runner.alias_runner_class_methods(klass, '', 'eac_cli')
|
22
22
|
::EacCli::Runner.alias_runner_class_methods(klass, 'original', '')
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
4
|
+
require 'active_support/core_ext/hash/slice'
|
5
|
+
require 'docopt'
|
6
|
+
require 'eac_ruby_utils/contextualizable'
|
7
|
+
require 'eac_ruby_utils/patches/hash/sym_keys_hash'
|
8
|
+
Dir["#{__dir__}/#{::File.basename(__FILE__, '.*')}/_*.rb"].sort.each do |partial|
|
9
|
+
require partial
|
10
|
+
end
|
11
|
+
|
12
|
+
module EacCli
|
13
|
+
class DocoptRunner
|
14
|
+
include ::EacRubyUtils::Contextualizable
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def create(settings = {})
|
18
|
+
new(settings)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
attr_reader :settings
|
23
|
+
|
24
|
+
def initialize(settings = {})
|
25
|
+
@settings = settings.with_indifferent_access.freeze
|
26
|
+
check_subcommands
|
27
|
+
end
|
28
|
+
|
29
|
+
def options
|
30
|
+
@options ||= ::Docopt.docopt(target_doc, docopt_options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def parent
|
34
|
+
settings[:parent]
|
35
|
+
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
def docopt_options
|
40
|
+
settings.slice(:version, :argv, :help, :options_first).to_sym_keys_hash
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|