ehbrs-tools 0.16.5 → 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/cooking_book.rb +9 -0
- data/lib/ehbrs/cooking_book/build.rb +45 -0
- data/lib/ehbrs/cooking_book/build/base_page.rb +43 -0
- data/lib/ehbrs/cooking_book/build/index_page.rb +26 -0
- data/lib/ehbrs/cooking_book/build/recipe_page.rb +27 -0
- data/lib/ehbrs/cooking_book/project.rb +31 -0
- data/lib/ehbrs/cooking_book/recipe.rb +37 -0
- data/lib/ehbrs/cooking_book/recipe/ingredient.rb +21 -0
- data/lib/ehbrs/cooking_book/recipe/measure.rb +60 -0
- data/lib/ehbrs/cooking_book/recipe/part.rb +32 -0
- data/lib/ehbrs/music.rb +9 -0
- data/lib/ehbrs/music/album.rb +42 -0
- data/lib/ehbrs/observers/base.rb +1 -1
- data/lib/ehbrs/observers/with_persistence.rb +1 -1
- data/lib/ehbrs/patches/module/erb_template.rb +11 -0
- data/lib/ehbrs/patches/object/erb_template.rb +9 -0
- data/lib/ehbrs/patches/object/template.rb +7 -0
- data/lib/ehbrs/runner.rb +6 -13
- data/lib/ehbrs/runner/cooking_book.rb +30 -0
- data/lib/ehbrs/runner/cooking_book/build.rb +50 -0
- data/lib/ehbrs/runner/fs/used_space.rb +1 -1
- data/lib/ehbrs/runner/music.rb +16 -0
- data/lib/ehbrs/runner/music/selected.rb +63 -0
- data/lib/ehbrs/runner/telegram.rb +26 -0
- data/lib/ehbrs/runner/telegram/send_message.rb +29 -0
- data/lib/ehbrs/runner/videos/probe.rb +2 -2
- data/lib/ehbrs/runner/videos/unsupported.rb +1 -1
- data/lib/ehbrs/runner/web_utils/videos/upload.rb +1 -1
- data/lib/ehbrs/telegram.rb +9 -0
- data/lib/ehbrs/telegram/message_sending.rb +32 -0
- data/lib/ehbrs/tools/application.rb +13 -0
- data/lib/ehbrs/tools/instance.rb +16 -0
- 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 +3 -2
- data/lib/ehbrs/videos/unsupported/fixes/supported_codec.rb +1 -1
- data/lib/ehbrs/videos/unsupported/profiles/aoc.rb +27 -0
- data/lib/ehbrs/videos/unsupported/search.rb +1 -1
- data/lib/ehbrs/videos/unsupported/track.rb +1 -1
- data/template/ehbrs/cooking_book/build/base_page/layout.html.erb +20 -0
- data/template/ehbrs/cooking_book/build/index_page/inner.html.erb +6 -0
- data/template/ehbrs/cooking_book/build/recipe_page/inner.html.erb +6 -0
- data/template/ehbrs/cooking_book/build/recipe_page/part.html.erb +27 -0
- 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/core_ext.rb +2 -0
- data/vendor/eac_cli/lib/eac_cli/default_runner.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +26 -10
- data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
- data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
- data/vendor/eac_cli/lib/eac_cli/definition/help_formatter.rb +2 -2
- data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +12 -0
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +18 -2
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +3 -3
- data/vendor/eac_cli/lib/eac_cli/docopt/runner_context_replacement.rb +15 -0
- data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +7 -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.rb +4 -4
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/long_options.rb +37 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/option_argument.rb +29 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb +7 -36
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +47 -0
- data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
- 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 +3 -2
- data/vendor/eac_cli/lib/eac_cli/runner.rb +0 -48
- data/vendor/eac_cli/lib/eac_cli/runner/after_class_methods.rb +29 -0
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +2 -1
- data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +38 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +19 -3
- data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands/definition_concern.rb +10 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -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/definition/alternative_spec.rb +4 -0
- 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 +44 -5
- 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/Gemfile +5 -0
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +20 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0.rb +7 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +69 -0
- 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 +31 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +52 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner/test_all.rb +22 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +9 -0
- 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/filesystem_traverser.rb +52 -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 +5 -0
- 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 +3 -0
- data/vendor/eac_ruby_base0/spec/spec_helper.rb +103 -0
- data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +2 -3
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/module_setup.rb +16 -6
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +2 -99
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/class_initialize.rb +29 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/instance_initialize.rb +53 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/super_args.rb +54 -0
- 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/fs/traverser.rb +0 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +13 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +3 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +48 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +10 -0
- 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/object/if_nil.rb +17 -0
- 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/patches/time/required_zone.rb +11 -0
- 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/lib/eac_ruby_utils/yaml.rb +8 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb +14 -4
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_constructor_spec.rb +30 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/inflector_spec.rb +2 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/local_time_zone_spec.rb +17 -0
- 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 +134 -62
- 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_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 -145
- 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/object/template.rb +0 -16
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb +0 -5
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/local_time_zone.rb +0 -25
- 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
@@ -4,7 +4,7 @@ require 'eac_cli/docopt/runner_extension'
|
|
4
4
|
|
5
5
|
RSpec.describe ::EacCli::Docopt::RunnerExtension do
|
6
6
|
let(:stub_runner) do
|
7
|
-
r = Class.new(::
|
7
|
+
r = Class.new(::EacCli::DocoptRunner) do
|
8
8
|
def run; end
|
9
9
|
end
|
10
10
|
r.include ::EacCli::Runner
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'eac_cli/docopt_runner'
|
4
4
|
|
5
|
-
RSpec.describe ::
|
5
|
+
RSpec.describe ::EacCli::DocoptRunner do
|
6
6
|
context 'runner without DOC constant' do
|
7
|
-
class RunnerWithoutDocConstant < ::
|
7
|
+
class RunnerWithoutDocConstant < ::EacCli::DocoptRunner
|
8
8
|
def run
|
9
9
|
# Do nothing
|
10
10
|
end
|
@@ -35,7 +35,7 @@ RSpec.describe ::EacRubyUtils::Console::DocoptRunner do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
context 'doc with subcommands' do
|
38
|
-
class RunnerWithSubcommands < ::
|
38
|
+
class RunnerWithSubcommands < ::EacCli::DocoptRunner
|
39
39
|
attr_accessor :subarg_value, :suboption_value
|
40
40
|
|
41
41
|
DOC = <<~DOCUMENT
|
@@ -49,7 +49,7 @@ RSpec.describe ::EacRubyUtils::Console::DocoptRunner do
|
|
49
49
|
options.fetch('<parent-arg>')
|
50
50
|
end
|
51
51
|
|
52
|
-
class MySubCommand < ::
|
52
|
+
class MySubCommand < ::EacCli::DocoptRunner
|
53
53
|
DOC = <<~DOCUMENT
|
54
54
|
A root runner with subcommands.
|
55
55
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'eac_cli/old_configs'
|
4
4
|
|
5
|
-
RSpec.describe ::
|
5
|
+
RSpec.describe ::EacCli::OldConfigs do
|
6
6
|
describe '#entry_key_to_envvar_name' do
|
7
7
|
{
|
8
8
|
'a.entry.value' => 'A_ENTRY_VALUE',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'eac_cli/docopt_runner'
|
4
4
|
require 'eac_cli/runner'
|
5
5
|
|
6
6
|
RSpec.describe ::EacCli::Runner do
|
@@ -11,7 +11,9 @@ RSpec.describe ::EacCli::Runner do
|
|
11
11
|
|
12
12
|
runner_definition do
|
13
13
|
arg_opt '-o', '--opt1', 'A arg option.'
|
14
|
-
bool_opt '-
|
14
|
+
bool_opt '-p', '--opt2', 'A boolean option'
|
15
|
+
arg_opt '-q', '--opt4', 'A repeatable argument option.', repeat: true
|
16
|
+
bool_opt '-r', '--opt5', 'A repeatable boolean option', repeat: true
|
15
17
|
pos_arg :pos1
|
16
18
|
pos_arg :pos2, repeat: true, optional: true
|
17
19
|
alt do
|
@@ -29,7 +31,7 @@ RSpec.describe ::EacCli::Runner do
|
|
29
31
|
context 'when all args are supplied' do
|
30
32
|
let(:argv) { %w[--opt1 aaa --opt2 bbb ccc ddd] }
|
31
33
|
let(:parsed_expected) do
|
32
|
-
{ opt1: 'aaa', opt2: true, opt3: false, pos1: 'bbb',
|
34
|
+
{ opt1: 'aaa', opt2: true, opt3: false, opt4: [], opt5: 0, pos1: 'bbb',
|
33
35
|
pos2: %w[ccc ddd] }
|
34
36
|
end
|
35
37
|
|
@@ -40,9 +42,33 @@ RSpec.describe ::EacCli::Runner do
|
|
40
42
|
it { expect(instance.parsed.pos2).to eq(%w[ccc ddd]) }
|
41
43
|
end
|
42
44
|
|
45
|
+
context 'with long option and argument in same position' do
|
46
|
+
let(:argv) { %w[--opt1=aaa pos1] }
|
47
|
+
|
48
|
+
it { expect(instance.parsed.opt1).to eq('aaa') }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'with valid grouped short options' do
|
52
|
+
let(:argv) { %w[-po aaa pos1] }
|
53
|
+
|
54
|
+
it { expect(instance.parsed.opt1).to eq('aaa') }
|
55
|
+
it { expect(instance.parsed.opt2?).to eq(true) }
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'with invalid grouped short options' do
|
59
|
+
let(:argv) { %w[-op aaa pos1] }
|
60
|
+
|
61
|
+
it do
|
62
|
+
expect { instance.parsed }.to raise_error(::EacCli::Parser::Error)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
43
66
|
context 'when only required args are supplied' do
|
44
67
|
let(:argv) { %w[bbb] }
|
45
|
-
let(:parsed_expected)
|
68
|
+
let(:parsed_expected) do
|
69
|
+
{ opt1: nil, opt2: false, opt3: false, opt4: [], opt5: 0, pos1: 'bbb',
|
70
|
+
pos2: [] }
|
71
|
+
end
|
46
72
|
|
47
73
|
it { expect(parsed_actual).to eq(parsed_expected) }
|
48
74
|
it { expect(instance.parsed.opt1).to be_nil }
|
@@ -61,12 +87,25 @@ RSpec.describe ::EacCli::Runner do
|
|
61
87
|
|
62
88
|
context 'when alternative args are supplied' do
|
63
89
|
let(:argv) { %w[--opt3] }
|
64
|
-
let(:parsed_expected)
|
90
|
+
let(:parsed_expected) do
|
91
|
+
{ opt1: nil, opt2: false, opt3: true, opt4: [], opt5: 0, pos1: nil,
|
92
|
+
pos2: [] }
|
93
|
+
end
|
65
94
|
|
66
95
|
it { expect(parsed_actual).to eq(parsed_expected) }
|
67
96
|
it { expect(instance.parsed.opt3?).to eq(true) }
|
68
97
|
end
|
69
98
|
|
99
|
+
context 'when repeated options are supplied' do
|
100
|
+
let(:argv) { %w[--opt5 -rrr --opt4=A -q B --opt4 C AAA] }
|
101
|
+
let(:parsed_expected) do
|
102
|
+
{ opt1: nil, opt2: false, opt3: false, opt4: %w[A B C], opt5: 4, pos1: 'AAA',
|
103
|
+
pos2: [] }
|
104
|
+
end
|
105
|
+
|
106
|
+
it { expect(parsed_actual).to eq(parsed_expected) }
|
107
|
+
end
|
108
|
+
|
70
109
|
context 'when extra args are not supplied' do
|
71
110
|
let(:runner_class) do
|
72
111
|
the_module = described_class
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'eac_cli/speaker'
|
4
4
|
|
5
|
-
RSpec.describe ::
|
5
|
+
RSpec.describe ::EacCli::Speaker do
|
6
6
|
let(:instance) do
|
7
7
|
r = ::Object.new
|
8
8
|
r.extend(described_class)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/patches/module/speaker'
|
4
|
+
|
5
|
+
RSpec.describe ::Module do
|
6
|
+
class StubClass # rubocop:disable RSpec/LeakyConstantDeclaration
|
7
|
+
enable_speaker
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#enable_speaker' do
|
11
|
+
it { expect(StubClass.included_modules).to include(::EacCli::Speaker) }
|
12
|
+
end
|
13
|
+
end
|
@@ -1,7 +1,3 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
RSpec.describe ::RuboCop, slow: true do
|
6
|
-
include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
|
7
|
-
end
|
3
|
+
::EacRubyGemSupport::Rspec.default.describe_rubocop
|
@@ -97,4 +97,7 @@ RSpec.configure do |config|
|
|
97
97
|
# # test failures related to randomization by passing the same `--seed` value
|
98
98
|
# # as the one that triggered the failure.
|
99
99
|
# Kernel.srand config.seed
|
100
|
+
|
101
|
+
require 'eac_ruby_gem_support/rspec'
|
102
|
+
::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
|
100
103
|
end
|
@@ -12,7 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
15
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.64'
|
16
|
+
s.add_dependency 'eac_templates', '~> 0.1'
|
16
17
|
|
17
|
-
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.
|
18
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
|
18
19
|
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_docker/images/templatized'
|
4
|
+
require 'eac_templates/searcher'
|
4
5
|
|
5
6
|
RSpec.describe(::EacDocker::Images::Templatized, docker: true) do
|
6
7
|
let(:fixtures_dir) { ::Pathname.new('templatized_spec_files').expand_path(__dir__) }
|
7
8
|
let(:instance) { StubDockerImage.new }
|
8
9
|
|
9
10
|
before do
|
10
|
-
::
|
11
|
+
::EacTemplates::Searcher.default.included_paths << fixtures_dir
|
11
12
|
stub_const('StubDockerImage', Class.new(described_class))
|
12
13
|
end
|
13
14
|
|
@@ -1,7 +1,3 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
RSpec.describe ::RuboCop, slow: true do
|
6
|
-
include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
|
7
|
-
end
|
3
|
+
::EacRubyGemSupport::Rspec.default.describe_rubocop
|
@@ -97,6 +97,9 @@ RSpec.configure do |config|
|
|
97
97
|
# # test failures related to randomization by passing the same `--seed` value
|
98
98
|
# # as the one that triggered the failure.
|
99
99
|
# Kernel.srand config.seed
|
100
|
+
|
101
|
+
require 'eac_ruby_gem_support/rspec'
|
102
|
+
::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
|
100
103
|
end
|
101
104
|
|
102
105
|
require 'eac_docker/rspec'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
|
5
|
+
require 'eac_ruby_base0/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'eac_ruby_base0'
|
9
|
+
s.version = EacRubyBase0::VERSION
|
10
|
+
s.authors = ['Put here the authors']
|
11
|
+
s.summary = 'Put here de description.'
|
12
|
+
|
13
|
+
s.files = Dir['{lib}/**/*']
|
14
|
+
|
15
|
+
s.add_dependency 'eac_cli', '~> 0.15', '>= 0.15.1'
|
16
|
+
s.add_dependency 'eac_ruby_gems_utils', '~> 0.8'
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.64'
|
18
|
+
|
19
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
|
20
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_gems_utils/gem'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_ruby_utils/filesystem_cache'
|
6
|
+
|
7
|
+
module EacRubyBase0
|
8
|
+
class Application
|
9
|
+
enable_simple_cache
|
10
|
+
enable_listable
|
11
|
+
lists.add_symbol :option, :name, :home_dir
|
12
|
+
|
13
|
+
common_constructor :gemspec_dir, :options, default: [{}] do
|
14
|
+
self.gemspec_dir = gemspec_dir.to_pathname
|
15
|
+
self.options = options.symbolize_keys.assert_valid_keys(self.class.lists.option.values).freeze
|
16
|
+
end
|
17
|
+
|
18
|
+
delegate :version, to: :self_gem
|
19
|
+
|
20
|
+
def all_gems
|
21
|
+
vendor_gems + [self_gem]
|
22
|
+
end
|
23
|
+
|
24
|
+
{ cache: '.cache', config: '.config', data: '.local/share' }.each do |item, subpath|
|
25
|
+
xdg_env_method_name = "#{item}_xdg_env"
|
26
|
+
|
27
|
+
define_method xdg_env_method_name do
|
28
|
+
ENV["XDG_#{item.upcase}_HOME"].if_present(&:to_pathname)
|
29
|
+
end
|
30
|
+
|
31
|
+
define_method "#{item}_dir" do
|
32
|
+
(send(xdg_env_method_name) || home_dir.join(subpath)).join(name)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def fs_cache
|
37
|
+
@fs_cache ||= ::EacRubyUtils::FilesystemCache.new(
|
38
|
+
cache_dir.join(::EacRubyUtils::FilesystemCache.name.parameterize)
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def home_dir
|
43
|
+
@home_dir ||= (options[OPTION_HOME_DIR] || ENV.fetch('HOME')).to_pathname
|
44
|
+
end
|
45
|
+
|
46
|
+
def name
|
47
|
+
options[OPTION_NAME] || self_gem.name
|
48
|
+
end
|
49
|
+
|
50
|
+
def vendor_dir
|
51
|
+
gemspec_dir.join('vendor')
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def self_gem_uncached
|
57
|
+
::EacRubyGemsUtils::Gem.new(gemspec_dir)
|
58
|
+
end
|
59
|
+
|
60
|
+
def vendor_gems_uncached
|
61
|
+
r = []
|
62
|
+
vendor_dir.children.each do |c|
|
63
|
+
vgem = ::EacRubyGemsUtils::Gem.new(c)
|
64
|
+
r << vgem if vgem.gemfile_path.exist?
|
65
|
+
end
|
66
|
+
r
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/speaker'
|
4
|
+
require 'eac_ruby_utils/settings_provider'
|
5
|
+
|
6
|
+
module EacRubyBase0
|
7
|
+
module JobsRunner
|
8
|
+
common_concern do
|
9
|
+
include ::EacCli::Speaker
|
10
|
+
include ::EacRubyUtils::SettingsProvider
|
11
|
+
end
|
12
|
+
|
13
|
+
def run_job(job)
|
14
|
+
return unless run_job?(job)
|
15
|
+
|
16
|
+
infom "Running job \"#{job}\"..."
|
17
|
+
send(job)
|
18
|
+
end
|
19
|
+
|
20
|
+
def run_job?(job)
|
21
|
+
the_method = "run_#{job}?"
|
22
|
+
respond_to?(the_method, true) ? send(the_method) : true
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_jobs(*jobs)
|
26
|
+
jobs = setting_value(:jobs) if jobs.empty?
|
27
|
+
jobs.each { |job| run_job(job) }
|
28
|
+
success 'Done'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
|
5
|
+
module EacRubyBase0
|
6
|
+
module Runner
|
7
|
+
require_sub __FILE__
|
8
|
+
enable_speaker
|
9
|
+
common_concern do
|
10
|
+
include ::EacCli::RunnerWith::Help
|
11
|
+
include ::EacCli::RunnerWith::Subcommands
|
12
|
+
runner_definition do
|
13
|
+
bool_opt '-q', '--quiet', 'Quiet mode.'
|
14
|
+
bool_opt '-I', '--no-input', 'Fail if a input is requested.'
|
15
|
+
subcommands
|
16
|
+
alt do
|
17
|
+
bool_opt '-V', '--version', 'Show version.', usage: true, required: true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def run
|
23
|
+
on_speaker_node do |node|
|
24
|
+
node.stderr = ::StringIO.new if parsed.quiet?
|
25
|
+
node.stdin = FailIfRequestInput.new if parsed.no_input?
|
26
|
+
if parsed.version?
|
27
|
+
show_version
|
28
|
+
else
|
29
|
+
run_with_subcommand
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def application_version
|
35
|
+
runner_context.call(:application).version.to_s
|
36
|
+
end
|
37
|
+
|
38
|
+
def show_version
|
39
|
+
out("#{application_version}\n")
|
40
|
+
end
|
41
|
+
|
42
|
+
class FailIfRequestInput
|
43
|
+
enable_speaker
|
44
|
+
|
45
|
+
%w[gets noecho].each do |method|
|
46
|
+
define_method(method) do
|
47
|
+
raise "Input method requested (\"#{method}\") and option --no-input is set"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|