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
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module EacRubyUtils
|
6
|
-
module Templates
|
7
|
-
module VariableProviders
|
8
|
-
require_sub __FILE__
|
9
|
-
|
10
|
-
PROVIDERS = %w[entries_reader hash generic].map do |name|
|
11
|
-
"eac_ruby_utils/templates/variable_providers/#{name}".camelize.constantize
|
12
|
-
end
|
13
|
-
|
14
|
-
class << self
|
15
|
-
def build(variables_source)
|
16
|
-
PROVIDERS.each do |provider|
|
17
|
-
return provider.new(variables_source) if provider.accept?(variables_source)
|
18
|
-
end
|
19
|
-
|
20
|
-
raise "Variables provider not found for #{variables_source}"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/templates/variable_not_found_error'
|
4
|
-
|
5
|
-
module EacRubyUtils
|
6
|
-
module Templates
|
7
|
-
module VariableProviders
|
8
|
-
class Base
|
9
|
-
attr_reader :source
|
10
|
-
|
11
|
-
def initialize(source)
|
12
|
-
@source = source
|
13
|
-
end
|
14
|
-
|
15
|
-
def variable_value(name)
|
16
|
-
return variable_fetch(name) if variable_exist?(name)
|
17
|
-
|
18
|
-
raise VariableNotFoundError, "Variable \"#{name}\" not found in #{source}"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/entries_reader.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/templates/variable_providers/base'
|
4
|
-
|
5
|
-
module EacRubyUtils
|
6
|
-
module Templates
|
7
|
-
module VariableProviders
|
8
|
-
class EntriesReader < ::EacRubyUtils::Templates::VariableProviders::Base
|
9
|
-
class << self
|
10
|
-
def accept?(variables_source)
|
11
|
-
variables_source.respond_to?(:read_entry)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def variable_exist?(_name)
|
16
|
-
true
|
17
|
-
end
|
18
|
-
|
19
|
-
def variable_fetch(name)
|
20
|
-
source.read_entry(name)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/templates/variable_providers/base'
|
4
|
-
|
5
|
-
module EacRubyUtils
|
6
|
-
module Templates
|
7
|
-
module VariableProviders
|
8
|
-
class Generic < ::EacRubyUtils::Templates::VariableProviders::Base
|
9
|
-
class << self
|
10
|
-
def accept?(variables_source)
|
11
|
-
variables_source.is_a?(::Object)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def variable_exist?(name)
|
16
|
-
source.respond_to?(name)
|
17
|
-
end
|
18
|
-
|
19
|
-
def variable_fetch(name)
|
20
|
-
source.send(name)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/templates/variable_providers/base'
|
4
|
-
|
5
|
-
module EacRubyUtils
|
6
|
-
module Templates
|
7
|
-
module VariableProviders
|
8
|
-
class Hash < ::EacRubyUtils::Templates::VariableProviders::Base
|
9
|
-
class << self
|
10
|
-
def accept?(variables_source)
|
11
|
-
variables_source.is_a?(::Hash)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize(source)
|
16
|
-
super(source.with_indifferent_access)
|
17
|
-
end
|
18
|
-
|
19
|
-
def variable_exist?(name)
|
20
|
-
source.key?(name)
|
21
|
-
end
|
22
|
-
|
23
|
-
def variable_fetch(name)
|
24
|
-
source.fetch(name)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'tempfile'
|
4
|
-
require 'eac_ruby_utils/configs'
|
5
|
-
|
6
|
-
RSpec.describe ::EacRubyUtils::Configs do
|
7
|
-
let(:configs_key) { 'configsspec' }
|
8
|
-
let(:storage_path) do
|
9
|
-
file = ::Tempfile.new(configs_key)
|
10
|
-
path = file.path
|
11
|
-
file.close
|
12
|
-
file.unlink
|
13
|
-
path
|
14
|
-
end
|
15
|
-
let(:instance) { described_class.new(configs_key, storage_path: storage_path) }
|
16
|
-
|
17
|
-
describe '#storage_path' do
|
18
|
-
it { expect(instance.storage_path).to eq(storage_path) }
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#write' do
|
22
|
-
let(:entry_key) { 'parent.child' }
|
23
|
-
|
24
|
-
before do
|
25
|
-
instance[entry_key] = 'value1'
|
26
|
-
instance.save
|
27
|
-
end
|
28
|
-
|
29
|
-
it { expect(::YAML.load_file(storage_path)).to eq(parent: { child: 'value1' }) }
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#read' do
|
33
|
-
let(:present_key) { 'a.present.key' }
|
34
|
-
let(:blank_key) { 'a.blank.key' }
|
35
|
-
|
36
|
-
before do
|
37
|
-
instance[present_key] = 'A value'
|
38
|
-
instance[blank_key] = ''
|
39
|
-
instance.save
|
40
|
-
instance.load
|
41
|
-
end
|
42
|
-
|
43
|
-
it { expect(instance[present_key]).to be_present }
|
44
|
-
it { expect(instance[blank_key]).to be_present }
|
45
|
-
end
|
46
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/patches/module/console_speaker'
|
4
|
-
|
5
|
-
RSpec.describe ::Module do
|
6
|
-
class StubClass
|
7
|
-
enable_console_speaker
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '#enable_console_speaker' do
|
11
|
-
it { expect(StubClass.included_modules).to include(::EacRubyUtils::Console::Speaker) }
|
12
|
-
end
|
13
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/patches/object/template'
|
4
|
-
|
5
|
-
RSpec.describe ::Object do
|
6
|
-
class MyStubWithTemplate
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:instance) { ::MyStubWithTemplate.new }
|
10
|
-
let(:templates_path) { ::File.join(__dir__, 'template_spec_files', 'path') }
|
11
|
-
|
12
|
-
before do
|
13
|
-
::EacRubyUtils::Templates::Searcher.default.included_paths.add(templates_path)
|
14
|
-
end
|
15
|
-
|
16
|
-
after do
|
17
|
-
::EacRubyUtils::Templates::Searcher.default.included_paths.delete(templates_path)
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '#template' do
|
21
|
-
it { expect(instance.template).to be_a(::EacRubyUtils::Templates::File) }
|
22
|
-
end
|
23
|
-
end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/paths_hash'
|
4
|
-
|
5
|
-
RSpec.describe ::EacRubyUtils::PathsHash do
|
6
|
-
let(:source_hash) do
|
7
|
-
{
|
8
|
-
parent: {
|
9
|
-
child1: {
|
10
|
-
child1_1: 'v1_1',
|
11
|
-
child1_2: 'v1_2'
|
12
|
-
},
|
13
|
-
child2: 'v2'
|
14
|
-
}
|
15
|
-
}
|
16
|
-
end
|
17
|
-
let(:instance) { described_class.new(source_hash) }
|
18
|
-
|
19
|
-
describe '#[]' do
|
20
|
-
{
|
21
|
-
'parent.child1.child1_1' => 'v1_1',
|
22
|
-
'parent.child1.child1_2' => 'v1_2',
|
23
|
-
'parent.child2' => 'v2',
|
24
|
-
'no_exist' => nil,
|
25
|
-
'parent.child1' => {
|
26
|
-
child1_1: 'v1_1',
|
27
|
-
child1_2: 'v1_2'
|
28
|
-
}
|
29
|
-
}.each do |entry_key, expected_value|
|
30
|
-
it { expect(instance[entry_key]).to eq(expected_value) }
|
31
|
-
end
|
32
|
-
|
33
|
-
['.only_suffix', '', '.', 'only_prefx.', 'empty..part'].each do |entry_key|
|
34
|
-
it "invalid entry key \"#{entry_key}\" raises EntryKeyError" do
|
35
|
-
expect { instance[entry_key] }.to raise_error(::EacRubyUtils::PathsHash::EntryKeyError)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#[]=' do
|
41
|
-
let(:source_hash) { {} }
|
42
|
-
|
43
|
-
before do
|
44
|
-
instance['a.b.c'] = '123'
|
45
|
-
end
|
46
|
-
|
47
|
-
it { expect(instance.to_h).to eq(a: { b: { c: '123' } }) }
|
48
|
-
end
|
49
|
-
|
50
|
-
describe '#fetch' do
|
51
|
-
{
|
52
|
-
'parent.child1.child1_1' => 'v1_1',
|
53
|
-
'parent.child1.child1_2' => 'v1_2',
|
54
|
-
'parent.child1.child1_2.no_exist' => ::EacRubyUtils::PathsHash::EntryKeyError,
|
55
|
-
'parent.child1.child1_3' => ::EacRubyUtils::PathsHash::EntryKeyError,
|
56
|
-
'parent.child2' => 'v2',
|
57
|
-
'no_exist' => ::EacRubyUtils::PathsHash::EntryKeyError,
|
58
|
-
'parent.child1' => {
|
59
|
-
child1_1: 'v1_1',
|
60
|
-
child1_2: 'v1_2'
|
61
|
-
}
|
62
|
-
}.each do |entry_key, expected_value|
|
63
|
-
if expected_value.is_a?(::Class) && expected_value < ::Exception
|
64
|
-
it "raise error #{expected_value}" do
|
65
|
-
expect { instance.fetch(entry_key) }.to raise_error(expected_value)
|
66
|
-
end
|
67
|
-
else
|
68
|
-
it "\#fetch return \"#{expected_value}\"" do
|
69
|
-
expect(instance.fetch(entry_key)).to eq(expected_value)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe '#key?' do
|
76
|
-
{
|
77
|
-
'parent.child1.child1_1' => true,
|
78
|
-
'parent.child1.child1_2' => true,
|
79
|
-
'parent.child1.child1_2.no_exist' => false,
|
80
|
-
'parent.child1.child1_3' => false,
|
81
|
-
'parent.child2' => true,
|
82
|
-
'no_exist' => false,
|
83
|
-
'parent.child1' => true
|
84
|
-
}.each do |entry_key, expected_value|
|
85
|
-
it { expect(instance.key?(entry_key)).to eq(expected_value) }
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/configs'
|
4
|
-
require 'eac_ruby_utils/templates/file'
|
5
|
-
|
6
|
-
RSpec.describe ::EacRubyUtils::Templates::File do
|
7
|
-
let(:files_dir) { ::File.join(__dir__, 'file_spec_files') }
|
8
|
-
let(:source_path) { ::File.join(files_dir, 'source.template') }
|
9
|
-
let(:instance) { described_class.new(source_path) }
|
10
|
-
let(:expected_content) { ::File.read(::File.join(files_dir, 'expected_content')) }
|
11
|
-
|
12
|
-
describe '#apply' do
|
13
|
-
context 'when config is a hash' do
|
14
|
-
let(:config) { { name: 'Fulano de Tal', age: 33 } }
|
15
|
-
|
16
|
-
it { expect(instance.apply(config)).to eq(expected_content) }
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'when config responds to read_entry' do
|
20
|
-
let(:config) { ::EacRubyUtils::Configs.new('rspec_describe_eac_ruby_utils_templates_file') }
|
21
|
-
|
22
|
-
before do
|
23
|
-
config.clear
|
24
|
-
config['name'] = 'Fulano de Tal'
|
25
|
-
config['age'] = '33'
|
26
|
-
end
|
27
|
-
|
28
|
-
it { expect(instance.apply(config)).to eq(expected_content) }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#variables' do
|
33
|
-
it { expect(instance.variables).to eq(::Set.new(%w[name age])) }
|
34
|
-
end
|
35
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/templates/searcher'
|
4
|
-
|
5
|
-
RSpec.describe ::EacRubyUtils::Templates::Searcher do
|
6
|
-
let(:files_dir) { ::File.join(__dir__, 'searcher_spec_files') }
|
7
|
-
let(:instance) do
|
8
|
-
r = described_class.new
|
9
|
-
r.included_paths << ::File.join(files_dir, 'path1')
|
10
|
-
r.included_paths << ::File.join(files_dir, 'path2')
|
11
|
-
r
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '#template' do
|
15
|
-
{
|
16
|
-
::EacRubyUtils::Templates::Directory => %w[subdir1],
|
17
|
-
::EacRubyUtils::Templates::File => %w[subdir1/file1.template subdir1/file2
|
18
|
-
subdir1/file3.template],
|
19
|
-
::NilClass => %w[does_not_exist]
|
20
|
-
}.each do |klass, subpaths|
|
21
|
-
subpaths.each do |subpath|
|
22
|
-
context "when subpath is \"#{subpath}\"" do
|
23
|
-
it "returns a #{klass}'s instance" do
|
24
|
-
expect(instance.template(subpath, false)).to be_a(klass)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
|