ehbrs-tools 0.16.1 → 0.17.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 +25 -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/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 +32 -0
- data/lib/ehbrs/runner/videos/probe.rb +3 -3
- data/lib/ehbrs/tools/application.rb +13 -0
- data/lib/ehbrs/tools/version.rb +1 -1
- data/lib/ehbrs/videos/file.rb +4 -8
- data/lib/ehbrs/videos/track.rb +5 -13
- data/lib/ehbrs/videos/unsupported/checks/codec_extra_unlisted.rb +3 -1
- data/lib/ehbrs/videos/unsupported/checks/codec_extra_unsupported.rb +3 -1
- data/lib/ehbrs/videos/unsupported/checks/codec_unlisted.rb +4 -2
- data/lib/ehbrs/videos/unsupported/checks/codec_unsupported.rb +3 -1
- data/lib/ehbrs/videos/unsupported/checks/invalid_extension.rb +2 -0
- data/lib/ehbrs/videos/unsupported/fix_profile.rb +0 -13
- data/lib/ehbrs/videos/unsupported/fixes/supported_codec.rb +10 -10
- data/lib/ehbrs/videos/unsupported/profiles/base.rb +17 -3
- data/lib/ehbrs/videos/unsupported/profiles/philco.rb +5 -4
- 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-parsers/lib/aranha/parsers/spec/source_target_fixtures_example.rb +10 -2
- data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
- data/vendor/eac_cli/eac_cli.gemspec +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition.rb +34 -39
- data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +83 -0
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +18 -40
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +50 -0
- data/vendor/eac_cli/lib/eac_cli/parser.rb +23 -3
- data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +92 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/argv.rb +17 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +24 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb +58 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +30 -0
- data/vendor/eac_cli/lib/eac_cli/runner.rb +12 -4
- data/vendor/eac_cli/lib/eac_cli/runner/exit.rb +13 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +18 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +5 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +6 -1
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +14 -0
- data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +10 -0
- data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +140 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +17 -5
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +42 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +53 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +29 -1
- data/vendor/eac_docker/lib/eac_docker/container.rb +24 -0
- data/vendor/eac_docker/lib/eac_docker/images/coded.rb +39 -0
- data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +26 -0
- data/vendor/eac_docker/lib/eac_docker/registry.rb +17 -0
- data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
- data/vendor/eac_docker/spec/lib/eac_docker/images/coded_spec.rb +12 -0
- data/vendor/eac_docker/spec/lib/eac_docker/images/coded_spec_files/image1/Dockerfile +1 -0
- data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec.rb +17 -0
- data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec_files/stub_docker_image/Dockerfile +1 -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/runner.rb +54 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner/test_all.rb +27 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +5 -0
- data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +7 -0
- data/vendor/eac_ruby_base0/spec/spec_helper.rb +100 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb +60 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +2 -50
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/class_setup.rb +52 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/module_setup.rb +41 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +6 -50
- 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/console/docopt_runner/_subcommands.rb +10 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +4 -6
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb +33 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb +24 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +0 -21
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/abstract_methods.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/template.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb +1 -8
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb +2 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +7 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +11 -2
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/abstract_methods_spec.rb +28 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb +40 -17
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_constructor_spec.rb +96 -8
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +12 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container.rb +30 -2
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/convert_job.rb +91 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb +51 -0
- metadata +89 -13
- data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +0 -68
- data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +0 -38
- data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +0 -77
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/file.rb +0 -31
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/info.rb +0 -21
@@ -23,9 +23,17 @@ RSpec.describe ::EacCli::Runner do
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
let(:instance) { runner_class.create(argv) }
|
27
|
+
let(:parsed_actual) { instance.parsed.to_h.symbolize_keys }
|
28
|
+
|
26
29
|
context 'when all args are supplied' do
|
27
|
-
let(:
|
30
|
+
let(:argv) { %w[--opt1 aaa --opt2 bbb ccc ddd] }
|
31
|
+
let(:parsed_expected) do
|
32
|
+
{ opt1: 'aaa', opt2: true, opt3: false, pos1: 'bbb',
|
33
|
+
pos2: %w[ccc ddd] }
|
34
|
+
end
|
28
35
|
|
36
|
+
it { expect(parsed_actual).to eq(parsed_expected) }
|
29
37
|
it { expect(instance.parsed.opt1).to eq('aaa') }
|
30
38
|
it { expect(instance.parsed.opt2?).to eq(true) }
|
31
39
|
it { expect(instance.parsed.pos1).to eq('bbb') }
|
@@ -33,8 +41,10 @@ RSpec.describe ::EacCli::Runner do
|
|
33
41
|
end
|
34
42
|
|
35
43
|
context 'when only required args are supplied' do
|
36
|
-
let(:
|
44
|
+
let(:argv) { %w[bbb] }
|
45
|
+
let(:parsed_expected) { { opt1: nil, opt2: false, opt3: false, pos1: 'bbb', pos2: [] } }
|
37
46
|
|
47
|
+
it { expect(parsed_actual).to eq(parsed_expected) }
|
38
48
|
it { expect(instance.parsed.opt1).to be_nil }
|
39
49
|
it { expect(instance.parsed.opt2?).to eq(false) }
|
40
50
|
it { expect(instance.parsed.pos1).to eq('bbb') }
|
@@ -42,7 +52,7 @@ RSpec.describe ::EacCli::Runner do
|
|
42
52
|
end
|
43
53
|
|
44
54
|
context 'when required args are not supplied' do
|
45
|
-
let(:
|
55
|
+
let(:argv) { %w[] }
|
46
56
|
|
47
57
|
it do
|
48
58
|
expect { instance.parsed }.to raise_error(::EacCli::Parser::Error)
|
@@ -50,8 +60,10 @@ RSpec.describe ::EacCli::Runner do
|
|
50
60
|
end
|
51
61
|
|
52
62
|
context 'when alternative args are supplied' do
|
53
|
-
let(:
|
63
|
+
let(:argv) { %w[--opt3] }
|
64
|
+
let(:parsed_expected) { { opt1: nil, opt2: false, opt3: true, pos1: nil, pos2: [] } }
|
54
65
|
|
66
|
+
it { expect(parsed_actual).to eq(parsed_expected) }
|
55
67
|
it { expect(instance.parsed.opt3?).to eq(true) }
|
56
68
|
end
|
57
69
|
|
@@ -69,7 +81,7 @@ RSpec.describe ::EacCli::Runner do
|
|
69
81
|
end
|
70
82
|
end
|
71
83
|
|
72
|
-
let(:
|
84
|
+
let(:argv) { %w[aaa bbb] }
|
73
85
|
|
74
86
|
it do
|
75
87
|
expect { instance.parsed }.to raise_error(::EacCli::Parser::Error)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner_with/help'
|
4
|
+
require 'eac_ruby_utils/fs/temp'
|
5
|
+
|
6
|
+
RSpec.describe ::EacCli::RunnerWith::Help do
|
7
|
+
let(:runner) do
|
8
|
+
the_module = described_class
|
9
|
+
Class.new do
|
10
|
+
include the_module
|
11
|
+
|
12
|
+
runner_definition do
|
13
|
+
desc 'A stub runner.'
|
14
|
+
pos_arg :a_argument
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
puts 'Runner run'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
let(:runner_argv) { ['--help'] }
|
24
|
+
let(:instance) { runner.create(argv: runner_argv) }
|
25
|
+
let(:expected_output) do
|
26
|
+
<<~OUTPUT
|
27
|
+
A stub runner.
|
28
|
+
|
29
|
+
Usage:
|
30
|
+
__PROGRAM__ [options] <a_argument>
|
31
|
+
__PROGRAM__ --help
|
32
|
+
|
33
|
+
Options:
|
34
|
+
-h --help Show help.
|
35
|
+
|
36
|
+
OUTPUT
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'show help text' do
|
40
|
+
expect { instance.run_run }.to output(expected_output).to_stdout_from_any_process
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner_with/output_file'
|
4
|
+
require 'eac_ruby_utils/fs/temp'
|
5
|
+
|
6
|
+
RSpec.describe ::EacCli::RunnerWith::OutputFile do
|
7
|
+
let(:runner) do
|
8
|
+
the_module = described_class
|
9
|
+
Class.new do
|
10
|
+
include the_module
|
11
|
+
|
12
|
+
runner_definition do
|
13
|
+
desc 'A stub root runner.'
|
14
|
+
pos_arg :input_text
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
run_output
|
19
|
+
end
|
20
|
+
|
21
|
+
def output_content
|
22
|
+
parsed.input_text
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
let(:stub_text) { 'STUB_TEXT' }
|
28
|
+
let(:instance) { runner.create(argv: runner_argv) }
|
29
|
+
|
30
|
+
context 'without --output-file option' do
|
31
|
+
let(:runner_argv) { [stub_text] }
|
32
|
+
|
33
|
+
it do
|
34
|
+
expect { instance.run }.to output(stub_text).to_stdout_from_any_process
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'with --output-file option' do
|
39
|
+
let(:output_file) { ::EacRubyUtils::Fs::Temp.file }
|
40
|
+
let(:runner_argv) { ['--output-file', output_file.to_path, stub_text] }
|
41
|
+
|
42
|
+
before do
|
43
|
+
instance.run
|
44
|
+
end
|
45
|
+
|
46
|
+
after do
|
47
|
+
output_file.remove
|
48
|
+
end
|
49
|
+
|
50
|
+
it { expect(output_file).to exist }
|
51
|
+
it { expect(output_file.read).to eq(stub_text) }
|
52
|
+
end
|
53
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_cli/runner'
|
4
|
+
require 'eac_cli/runner_with/help'
|
4
5
|
require 'eac_cli/runner_with/subcommands'
|
5
6
|
|
6
7
|
RSpec.describe ::EacCli::RunnerWith::Subcommands do
|
@@ -8,7 +9,6 @@ RSpec.describe ::EacCli::RunnerWith::Subcommands do
|
|
8
9
|
the_module = described_class
|
9
10
|
the_child = child_runner
|
10
11
|
Class.new do
|
11
|
-
include ::EacCli::Runner
|
12
12
|
include the_module
|
13
13
|
const_set('ChildCmd', the_child)
|
14
14
|
|
@@ -54,4 +54,32 @@ RSpec.describe ::EacCli::RunnerWith::Subcommands do
|
|
54
54
|
expect { instance.run }.to raise_error(::EacCli::Parser::Error)
|
55
55
|
end
|
56
56
|
end
|
57
|
+
|
58
|
+
context 'with help' do
|
59
|
+
let(:instance) { parent_runner.create(%w[--help]) }
|
60
|
+
let(:expected_output) do
|
61
|
+
<<~OUTPUT
|
62
|
+
A stub root runner.
|
63
|
+
|
64
|
+
Usage:
|
65
|
+
__PROGRAM__ [options] __SUBCOMMANDS__ [<subcommand_args>...]
|
66
|
+
__PROGRAM__ --help
|
67
|
+
|
68
|
+
Options:
|
69
|
+
-r --root-var=<value> A root variable.
|
70
|
+
-h --help Show help.
|
71
|
+
|
72
|
+
Subcommands:
|
73
|
+
child-cmd
|
74
|
+
OUTPUT
|
75
|
+
end
|
76
|
+
|
77
|
+
before do
|
78
|
+
parent_runner.include(::EacCli::RunnerWith::Help)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'show help text' do
|
82
|
+
expect { instance.run_run }.to output(expected_output).to_stdout_from_any_process
|
83
|
+
end
|
84
|
+
end
|
57
85
|
end
|
@@ -8,6 +8,7 @@ module EacDocker
|
|
8
8
|
immutable_accessor :interactive, :temporary, :tty, type: :boolean
|
9
9
|
immutable_accessor :env, type: :hash
|
10
10
|
immutable_accessor :command_arg, :volume, type: :array
|
11
|
+
attr_reader :id
|
11
12
|
common_constructor :image
|
12
13
|
|
13
14
|
def immutable_constructor_args
|
@@ -16,6 +17,23 @@ module EacDocker
|
|
16
17
|
|
17
18
|
alias immutable_volume volume
|
18
19
|
|
20
|
+
def hostname
|
21
|
+
::EacDocker::Executables.docker.command(
|
22
|
+
'inspect', '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}',
|
23
|
+
id
|
24
|
+
).execute!.strip
|
25
|
+
end
|
26
|
+
|
27
|
+
def on_detached
|
28
|
+
command = ::EacDocker::Executables.docker.command(*(%w[run --detach] + run_command_args))
|
29
|
+
self.id = command.execute!.strip
|
30
|
+
begin
|
31
|
+
yield(self)
|
32
|
+
ensure
|
33
|
+
stop
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
19
37
|
def volume(left_part, right_part = null)
|
20
38
|
immutable_volume(right_part.if_present(left_part) { |v| "#{left_part}:#{v}" })
|
21
39
|
end
|
@@ -29,8 +47,14 @@ module EacDocker
|
|
29
47
|
command_args
|
30
48
|
end
|
31
49
|
|
50
|
+
def stop
|
51
|
+
::EacDocker::Executables.docker.command('stop', id).execute!
|
52
|
+
end
|
53
|
+
|
32
54
|
private
|
33
55
|
|
56
|
+
attr_writer :id
|
57
|
+
|
34
58
|
def run_command_boolean_args
|
35
59
|
r = []
|
36
60
|
r << '--interactive' if interactive?
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_docker/executables'
|
4
|
+
require 'eac_docker/images/base'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module EacDocker
|
8
|
+
module Images
|
9
|
+
class Coded < ::EacDocker::Images::Base
|
10
|
+
enable_simple_cache
|
11
|
+
enable_immutable
|
12
|
+
immutable_accessor :tag
|
13
|
+
common_constructor :path do
|
14
|
+
self.path = path.to_pathname
|
15
|
+
end
|
16
|
+
|
17
|
+
def immutable_constructor_args
|
18
|
+
[path]
|
19
|
+
end
|
20
|
+
|
21
|
+
def provide
|
22
|
+
id
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def id_uncached
|
29
|
+
::EacDocker::Executables.docker.command(*build_args).execute!.strip
|
30
|
+
end
|
31
|
+
|
32
|
+
def build_args
|
33
|
+
args = %w[build --quiet]
|
34
|
+
args += ['--tag', tag] if tag.present?
|
35
|
+
args + [path.to_path]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_docker/images/base'
|
4
|
+
require 'eac_docker/images/coded'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
require 'eac_ruby_utils/fs/temp'
|
7
|
+
|
8
|
+
module EacDocker
|
9
|
+
module Images
|
10
|
+
class Templatized < ::EacDocker::Images::Base
|
11
|
+
enable_immutable
|
12
|
+
immutable_accessor :tag
|
13
|
+
|
14
|
+
def provide
|
15
|
+
::EacRubyUtils::Fs::Temp.on_directory do |provide_dir|
|
16
|
+
template.apply(self, provide_dir)
|
17
|
+
coded_image(provide_dir).tag(tag).provide
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def coded_image(provide_dir)
|
22
|
+
::EacDocker::Images::Coded.new(provide_dir)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_docker/images/coded'
|
4
|
+
|
5
|
+
RSpec.describe(::EacDocker::Images::Coded, docker: true) do
|
6
|
+
let(:fixtures_dir) { ::Pathname.new('coded_spec_files').expand_path(__dir__) }
|
7
|
+
let(:instance) { described_class.new(fixtures_dir / 'image1') }
|
8
|
+
|
9
|
+
describe '#provide' do
|
10
|
+
it { expect { instance.provide }.not_to raise_error }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
from ubuntu:bionic
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_docker/images/templatized'
|
4
|
+
|
5
|
+
RSpec.describe(::EacDocker::Images::Templatized, docker: true) do
|
6
|
+
let(:fixtures_dir) { ::Pathname.new('templatized_spec_files').expand_path(__dir__) }
|
7
|
+
let(:instance) { StubDockerImage.new }
|
8
|
+
|
9
|
+
before do
|
10
|
+
::EacRubyUtils::Templates::Searcher.default.included_paths << fixtures_dir
|
11
|
+
stub_const('StubDockerImage', Class.new(described_class))
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#provide' do
|
15
|
+
it { expect { instance.provide }.not_to raise_error }
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
from ubuntu:bionic
|
@@ -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.7'
|
16
|
+
s.add_dependency 'eac_ruby_gems_utils', '~> 0.7', '>= 0.7.2'
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.46'
|
18
|
+
|
19
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.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
|