avm-tools 0.76.0 → 0.80.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/patches/class/i18n.rb +31 -0
- data/lib/avm/patches/object/i18n.rb +2 -10
- data/lib/avm/projects/stereotypes/ruby_gem/update.rb +4 -1
- data/lib/avm/projects/stereotypes/ruby_gem/version_bump.rb +1 -2
- data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +7 -16
- data/lib/avm/tools/runner/git/subrepo/clone.rb +84 -0
- data/lib/avm/tools/runner/git/subrepo/fix.rb +65 -0
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/eac_redmine_base0/deploy/config/install.sh.template +12 -0
- data/vendor/eac_cli/eac_cli.gemspec +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition.rb +49 -22
- data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +83 -0
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +17 -1
- data/vendor/eac_cli/lib/eac_cli/{parser/options_collection.rb → definition/help_formatter.rb} +20 -49
- data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +21 -4
- 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/docopt/runner_extension.rb +1 -0
- data/vendor/eac_cli/lib/eac_cli/parser.rb +21 -3
- data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +88 -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/parser/collector.rb +4 -0
- data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
- data/vendor/eac_cli/lib/eac_cli/runner.rb +6 -2
- data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +1 -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 +96 -0
- 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 +35 -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 +57 -40
- 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 +57 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +32 -1
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +1 -1
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb +60 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +53 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +4 -69
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/entry_reader.rb +81 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/password_entry_reader.rb +18 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +7 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/store_passwords_entry_reader.rb +27 -0
- 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/enumerator.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/current.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/stopped.rb +14 -0
- 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/object/debug.rb +17 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +3 -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_constructor_spec.rb +66 -8
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/current_spec.rb +26 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/stopped_spec.rb +32 -0
- metadata +33 -5
- data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +0 -21
- data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +0 -49
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'date'
|
3
4
|
require 'yaml'
|
4
5
|
|
5
6
|
module EacRubyUtils
|
6
7
|
# A safe YAML loader/dumper with common types included.
|
7
8
|
class Yaml
|
8
9
|
class << self
|
9
|
-
DEFAULT_PERMITTED_CLASSES = [::Array, ::Date, ::FalseClass, ::Hash, ::NilClass,
|
10
|
-
::String, ::Symbol, ::Time, ::TrueClass].freeze
|
10
|
+
DEFAULT_PERMITTED_CLASSES = [::Array, ::Date, ::DateTime, ::FalseClass, ::Hash, ::NilClass,
|
11
|
+
::Numeric, ::String, ::Symbol, ::Time, ::TrueClass].freeze
|
11
12
|
|
12
13
|
def dump(object)
|
13
14
|
::YAML.dump(sanitize(object))
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/abstract_methods'
|
4
|
+
|
5
|
+
RSpec.describe(::EacRubyUtils::AbstractMethods) do
|
6
|
+
let(:base_class) do
|
7
|
+
the_module = described_class
|
8
|
+
::Class.new do
|
9
|
+
include the_module
|
10
|
+
|
11
|
+
abstract_methods :method1, :method2
|
12
|
+
end
|
13
|
+
end
|
14
|
+
let(:base_instance) { base_class.new }
|
15
|
+
let(:sub_class) do
|
16
|
+
::Class.new(base_class) do
|
17
|
+
def method1
|
18
|
+
'a result'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
let(:sub_instance) { sub_class.new }
|
23
|
+
|
24
|
+
it { expect { base_instance.method1 }.to raise_error(::NoMethodError) }
|
25
|
+
it { expect { base_instance.method2 }.to raise_error(::NoMethodError) }
|
26
|
+
it { expect(sub_instance.method1).to eq('a result') }
|
27
|
+
it { expect { sub_instance.method2 }.to raise_error(::NoMethodError) }
|
28
|
+
end
|
@@ -3,34 +3,92 @@
|
|
3
3
|
require 'eac_ruby_utils/common_constructor'
|
4
4
|
|
5
5
|
RSpec.describe ::EacRubyUtils::CommonConstructor do
|
6
|
-
ARG_LIST = %i[a b c d].freeze
|
6
|
+
ARG_LIST = %i[a b c d].freeze # rubocop:disable RSpec/LeakyConstantDeclaration
|
7
|
+
|
7
8
|
let(:instance) do
|
8
9
|
described_class.new(*ARG_LIST, default: %w[Vcc Vd]) do
|
9
10
|
@z = 'Vz'
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
let(:a_class) do
|
15
|
+
::Class.new do
|
16
|
+
attr_reader :z
|
17
|
+
end
|
15
18
|
end
|
16
19
|
|
17
|
-
let(:
|
20
|
+
let(:a_class_instance) { a_class.new('Va', 'Vb', 'Vc') }
|
18
21
|
|
19
22
|
before do
|
20
|
-
instance.setup_class(
|
23
|
+
instance.setup_class(a_class)
|
21
24
|
end
|
22
25
|
|
23
|
-
it { expect(
|
26
|
+
it { expect(a_class_instance.z).to eq('Vz') }
|
24
27
|
|
25
28
|
ARG_LIST.each do |attr|
|
26
29
|
expected_value = "V#{attr}"
|
27
30
|
it "attribute \"#{attr}\" equal to \"#{expected_value}\"" do
|
28
|
-
expect(
|
31
|
+
expect(a_class_instance.send(attr)).to eq(expected_value)
|
29
32
|
end
|
30
33
|
|
31
34
|
[false, true].each do |include_all|
|
32
35
|
it "respond_to?('#{attr}', #{include_all}) == #{include_all}" do
|
33
|
-
expect(
|
36
|
+
expect(a_class_instance.respond_to?("#{attr}=", include_all)).to eq(include_all)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'with super class' do
|
42
|
+
let(:super_class) do
|
43
|
+
::Class.new do
|
44
|
+
attr_reader :super_a, :super_b
|
45
|
+
|
46
|
+
def initialize(a, b) # rubocop:disable Naming/MethodParameterName
|
47
|
+
@super_a = a
|
48
|
+
@super_b = b
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
let(:sub_class) do
|
54
|
+
sub_constructor.setup_class(::Class.new(super_class))
|
55
|
+
end
|
56
|
+
|
57
|
+
let(:sub_object) { sub_class.new(1, 2, 3, 4) }
|
58
|
+
|
59
|
+
context 'with super_args parameter' do
|
60
|
+
let(:sub_constructor) do
|
61
|
+
described_class.new(:c, :a, :b, :d, super_args: -> { [c, a] })
|
62
|
+
end
|
63
|
+
|
64
|
+
it { expect(sub_object.a).to eq(2) }
|
65
|
+
it { expect(sub_object.b).to eq(3) }
|
66
|
+
it { expect(sub_object.c).to eq(1) }
|
67
|
+
it { expect(sub_object.d).to eq(4) }
|
68
|
+
it { expect(sub_object.super_a).to eq(1) }
|
69
|
+
it { expect(sub_object.super_b).to eq(2) }
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'without super_args parameter' do
|
73
|
+
let(:sub_constructor) do
|
74
|
+
described_class.new(:c, :a, :b, :d)
|
75
|
+
end
|
76
|
+
|
77
|
+
it { expect(sub_object.a).to eq(2) }
|
78
|
+
it { expect(sub_object.b).to eq(3) }
|
79
|
+
it { expect(sub_object.c).to eq(1) }
|
80
|
+
it { expect(sub_object.d).to eq(4) }
|
81
|
+
it { expect(sub_object.super_a).to eq(2) }
|
82
|
+
it { expect(sub_object.super_b).to eq(3) }
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'with undefined super arguments' do
|
86
|
+
let(:sub_constructor) do
|
87
|
+
described_class.new(:x, :y, :w, :a)
|
88
|
+
end
|
89
|
+
|
90
|
+
it do
|
91
|
+
expect { sub_object }.to raise_error(::ArgumentError)
|
34
92
|
end
|
35
93
|
end
|
36
94
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/patches/enumerator/current'
|
4
|
+
|
5
|
+
RSpec.describe ::Enumerator do
|
6
|
+
let(:list) { %w[a b] }
|
7
|
+
let(:instance) { list.each }
|
8
|
+
|
9
|
+
it { expect(instance).to be_a(described_class) }
|
10
|
+
it { expect(instance.current).to eq('a') }
|
11
|
+
|
12
|
+
context 'with first next' do
|
13
|
+
before { instance.next }
|
14
|
+
|
15
|
+
it { expect(instance.current).to eq('b') }
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'with last next' do
|
19
|
+
before do
|
20
|
+
instance.next
|
21
|
+
instance.next
|
22
|
+
end
|
23
|
+
|
24
|
+
it { expect(instance.current).to eq(nil) }
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/patches/enumerator/stopped'
|
4
|
+
|
5
|
+
RSpec.describe ::Enumerator do
|
6
|
+
let(:list) { %w[a b] }
|
7
|
+
let(:instance) { list.each }
|
8
|
+
|
9
|
+
it { expect(instance).to be_a(described_class) }
|
10
|
+
it { expect(instance.peek).to eq('a') }
|
11
|
+
it { expect(instance).to be_ongoing }
|
12
|
+
it { expect(instance).not_to be_stopped }
|
13
|
+
|
14
|
+
context 'with first next' do
|
15
|
+
before { instance.next }
|
16
|
+
|
17
|
+
it { expect(instance.peek).to eq('b') }
|
18
|
+
it { expect(instance).to be_ongoing }
|
19
|
+
it { expect(instance).not_to be_stopped }
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'with last next' do
|
23
|
+
before do
|
24
|
+
instance.next
|
25
|
+
instance.next
|
26
|
+
end
|
27
|
+
|
28
|
+
it { expect { instance.peek }.to raise_error(::StopIteration) }
|
29
|
+
it { expect(instance).not_to be_ongoing }
|
30
|
+
it { expect(instance).to be_stopped }
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.80.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -434,6 +434,7 @@ files:
|
|
434
434
|
- lib/avm/local_projects.rb
|
435
435
|
- lib/avm/local_projects/instance.rb
|
436
436
|
- lib/avm/patches.rb
|
437
|
+
- lib/avm/patches/class/i18n.rb
|
437
438
|
- lib/avm/patches/eac_ruby_gems_utils/gem.rb
|
438
439
|
- lib/avm/patches/i18n.rb
|
439
440
|
- lib/avm/patches/object/i18n.rb
|
@@ -507,6 +508,8 @@ files:
|
|
507
508
|
- lib/avm/tools/runner/git/revisions_test.rb
|
508
509
|
- lib/avm/tools/runner/git/subrepo.rb
|
509
510
|
- lib/avm/tools/runner/git/subrepo/check.rb
|
511
|
+
- lib/avm/tools/runner/git/subrepo/clone.rb
|
512
|
+
- lib/avm/tools/runner/git/subrepo/fix.rb
|
510
513
|
- lib/avm/tools/runner/instance.rb
|
511
514
|
- lib/avm/tools/runner/instance/info.rb
|
512
515
|
- lib/avm/tools/runner/launcher.rb
|
@@ -598,18 +601,23 @@ files:
|
|
598
601
|
- vendor/eac_cli/lib/eac_cli/core_ext.rb
|
599
602
|
- vendor/eac_cli/lib/eac_cli/default_runner.rb
|
600
603
|
- vendor/eac_cli/lib/eac_cli/definition.rb
|
604
|
+
- vendor/eac_cli/lib/eac_cli/definition/alternative.rb
|
601
605
|
- vendor/eac_cli/lib/eac_cli/definition/argument_option.rb
|
602
606
|
- vendor/eac_cli/lib/eac_cli/definition/base_option.rb
|
603
607
|
- vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb
|
608
|
+
- vendor/eac_cli/lib/eac_cli/definition/help_formatter.rb
|
604
609
|
- vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb
|
605
610
|
- vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb
|
611
|
+
- vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb
|
606
612
|
- vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb
|
607
613
|
- vendor/eac_cli/lib/eac_cli/parser.rb
|
614
|
+
- vendor/eac_cli/lib/eac_cli/parser/alternative.rb
|
615
|
+
- vendor/eac_cli/lib/eac_cli/parser/alternative/argv.rb
|
616
|
+
- vendor/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb
|
617
|
+
- vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb
|
618
|
+
- vendor/eac_cli/lib/eac_cli/parser/alternative/positionals.rb
|
608
619
|
- vendor/eac_cli/lib/eac_cli/parser/collector.rb
|
609
620
|
- vendor/eac_cli/lib/eac_cli/parser/error.rb
|
610
|
-
- vendor/eac_cli/lib/eac_cli/parser/options_collection.rb
|
611
|
-
- vendor/eac_cli/lib/eac_cli/parser/parse_result.rb
|
612
|
-
- vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb
|
613
621
|
- vendor/eac_cli/lib/eac_cli/patches.rb
|
614
622
|
- vendor/eac_cli/lib/eac_cli/patches/object.rb
|
615
623
|
- vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb
|
@@ -618,8 +626,14 @@ files:
|
|
618
626
|
- vendor/eac_cli/lib/eac_cli/runner_with.rb
|
619
627
|
- vendor/eac_cli/lib/eac_cli/runner_with/help.rb
|
620
628
|
- vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb
|
629
|
+
- vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb
|
621
630
|
- vendor/eac_cli/lib/eac_cli/version.rb
|
631
|
+
- vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb
|
632
|
+
- vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
|
633
|
+
- vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb
|
622
634
|
- vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb
|
635
|
+
- vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb
|
636
|
+
- vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb
|
623
637
|
- vendor/eac_cli/spec/rubocop_spec.rb
|
624
638
|
- vendor/eac_cli/spec/spec_helper.rb
|
625
639
|
- vendor/eac_docker/Gemfile
|
@@ -884,6 +898,7 @@ files:
|
|
884
898
|
- vendor/eac_ruby_utils/README.rdoc
|
885
899
|
- vendor/eac_ruby_utils/eac_ruby_utils.gemspec
|
886
900
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils.rb
|
901
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb
|
887
902
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/arguments_consumer.rb
|
888
903
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/blank_not_blank.rb
|
889
904
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/boolean.rb
|
@@ -895,7 +910,10 @@ files:
|
|
895
910
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/file.rb
|
896
911
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/console.rb
|
897
912
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb
|
913
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/entry_reader.rb
|
914
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/password_entry_reader.rb
|
898
915
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb
|
916
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/store_passwords_entry_reader.rb
|
899
917
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
|
900
918
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb
|
901
919
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_doc.rb
|
@@ -912,6 +930,8 @@ files:
|
|
912
930
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs.rb
|
913
931
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/base_env.rb
|
914
932
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb
|
933
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb
|
934
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb
|
915
935
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
|
916
936
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb
|
917
937
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/file.rb
|
@@ -959,10 +979,14 @@ files:
|
|
959
979
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/common_constructor.rb
|
960
980
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerable.rb
|
961
981
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerable/boolean_combinations.rb
|
982
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator.rb
|
983
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/current.rb
|
984
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/stopped.rb
|
962
985
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/hash.rb
|
963
986
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/hash/options_consumer.rb
|
964
987
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/hash/sym_keys_hash.rb
|
965
988
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module.rb
|
989
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/abstract_methods.rb
|
966
990
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/common_concern.rb
|
967
991
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/console_speaker.rb
|
968
992
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/immutable.rb
|
@@ -972,6 +996,7 @@ files:
|
|
972
996
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/simple_cache.rb
|
973
997
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object.rb
|
974
998
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/asserts.rb
|
999
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb
|
975
1000
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_present.rb
|
976
1001
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_respond.rb
|
977
1002
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb
|
@@ -1011,6 +1036,7 @@ files:
|
|
1011
1036
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/hash.rb
|
1012
1037
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb
|
1013
1038
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb
|
1039
|
+
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/abstract_methods_spec.rb
|
1014
1040
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/arguments_consumer_spec.rb
|
1015
1041
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/blank_not_blank_spec.rb
|
1016
1042
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb
|
@@ -1030,6 +1056,8 @@ files:
|
|
1030
1056
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb
|
1031
1057
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/options_consumer_spec.rb
|
1032
1058
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerable/boolean_combinations_spec.rb
|
1059
|
+
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/current_spec.rb
|
1060
|
+
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/stopped_spec.rb
|
1033
1061
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/hash/options_consumer_spec.rb
|
1034
1062
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/hash/sym_keys_hash_spec.rb
|
1035
1063
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/console_speaker_spec.rb
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module EacCli
|
6
|
-
class Parser
|
7
|
-
class ParseResult
|
8
|
-
common_constructor :definition, :argv
|
9
|
-
|
10
|
-
def result
|
11
|
-
::EacCli::Parser::Collector.to_data(definition) do |collector|
|
12
|
-
::EacCli::Parser::PositionalCollection.new(
|
13
|
-
definition,
|
14
|
-
::EacCli::Parser::OptionsCollection.new(definition, argv, collector).arguments,
|
15
|
-
collector
|
16
|
-
)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_cli/parser/error'
|
5
|
-
|
6
|
-
module EacCli
|
7
|
-
class Parser
|
8
|
-
class PositionalCollection
|
9
|
-
common_constructor(:definition, :argv, :collector) { collect }
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def collected
|
14
|
-
@collected ||= ::Set.new
|
15
|
-
end
|
16
|
-
|
17
|
-
def collect
|
18
|
-
argv.each { |argv_value| colect_argv_value(argv_value) }
|
19
|
-
return unless pending_required_positional?
|
20
|
-
|
21
|
-
raise ::EacCli::Parser::Error.new(
|
22
|
-
definition, argv, 'No value for required positional ' \
|
23
|
-
"\"#{current_positional.identifier}\""
|
24
|
-
)
|
25
|
-
end
|
26
|
-
|
27
|
-
def colect_argv_value(argv_value)
|
28
|
-
collector.collect(current_positional, argv_value)
|
29
|
-
collected << current_positional
|
30
|
-
positional_enumerator.next unless current_positional.repeat?
|
31
|
-
end
|
32
|
-
|
33
|
-
def pending_required_positional?
|
34
|
-
!(current_positional.blank? || current_positional.optional? ||
|
35
|
-
collected.include?(current_positional))
|
36
|
-
end
|
37
|
-
|
38
|
-
def positional_enumerator
|
39
|
-
@positional_enumerator ||= definition.positional.each
|
40
|
-
end
|
41
|
-
|
42
|
-
def current_positional
|
43
|
-
positional_enumerator.peek
|
44
|
-
rescue ::StopIteration
|
45
|
-
nil
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|