avm-tools 0.74.0 → 0.76.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/eac_rails_base0/instance.rb +2 -5
  3. data/lib/avm/{rails/runners.rb → eac_rails_base1.rb} +2 -4
  4. data/lib/avm/{rails → eac_rails_base1}/instance.rb +8 -3
  5. data/lib/avm/eac_rails_base1/runner.rb +12 -0
  6. data/lib/avm/eac_rails_base1/runner/bundle.rb +28 -0
  7. data/lib/avm/eac_rails_base1/runner/code_runner.rb +28 -0
  8. data/lib/avm/eac_rails_base1/runner_with/bundle.rb +57 -0
  9. data/lib/avm/eac_redmine_base0/instance.rb +2 -4
  10. data/lib/avm/{stereotypes/eac_ubuntu_base0.rb → eac_ubuntu_base0.rb} +1 -3
  11. data/lib/avm/eac_webapp_base0/deploy.rb +17 -40
  12. data/lib/avm/eac_webapp_base0/deploy/build.rb +48 -0
  13. data/lib/avm/eac_webapp_base0/deploy/git_info.rb +13 -0
  14. data/lib/avm/eac_webapp_base0/deploy/version.rb +4 -0
  15. data/lib/avm/eac_webapp_base0/deploy/write_on_target.rb +18 -0
  16. data/lib/avm/eac_webapp_base0/instance.rb +2 -2
  17. data/lib/avm/eac_webapp_base0/runner.rb +12 -0
  18. data/lib/avm/eac_webapp_base0/runner/apache_host.rb +2 -3
  19. data/lib/avm/eac_webapp_base0/runner/data.rb +1 -1
  20. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +1 -1
  21. data/lib/avm/eac_webapp_base0/runner/data/load.rb +1 -1
  22. data/lib/avm/eac_webapp_base0/runner/deploy.rb +4 -16
  23. data/lib/avm/eac_wordpress_base0.rb +9 -0
  24. data/lib/avm/eac_wordpress_base0/apache_host.rb +25 -0
  25. data/lib/avm/eac_wordpress_base0/deploy.rb +10 -0
  26. data/lib/avm/eac_wordpress_base0/instance.rb +24 -0
  27. data/lib/avm/eac_writings_base0/apache_host.rb +17 -0
  28. data/lib/avm/eac_writings_base0/deploy.rb +36 -0
  29. data/lib/avm/eac_writings_base0/instance.rb +11 -0
  30. data/lib/avm/files/appendable.rb +55 -0
  31. data/lib/avm/files/appendable/file_content.rb +24 -0
  32. data/lib/avm/files/appendable/plain_directory.rb +25 -0
  33. data/lib/avm/files/appendable/resource_base.rb +13 -0
  34. data/lib/avm/files/appendable/tar_output_command.rb +26 -0
  35. data/lib/avm/files/appendable/templatized_directory.rb +28 -0
  36. data/lib/avm/files/appender.rb +11 -0
  37. data/lib/avm/files/deploy.rb +72 -0
  38. data/lib/avm/files/formatter.rb +8 -4
  39. data/lib/avm/git/auto_commit_path.rb +2 -4
  40. data/lib/avm/git/auto_commit_path/ruby.rb +20 -0
  41. data/lib/avm/git/commit/deploy.rb +8 -61
  42. data/lib/avm/instances/runner.rb +40 -0
  43. data/lib/avm/{stereotypes/postgresql.rb → postgresql.rb} +1 -3
  44. data/lib/avm/postgresql/instance.rb +63 -0
  45. data/lib/avm/postgresql/instance/data_unit.rb +39 -0
  46. data/lib/avm/postgresql/instance_with.rb +18 -0
  47. data/lib/avm/tools/runner.rb +3 -3
  48. data/lib/avm/tools/runner/eac_rails_base0.rb +5 -18
  49. data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +1 -1
  50. data/lib/avm/tools/runner/eac_rails_base0/rails_server.rb +7 -12
  51. data/lib/avm/tools/runner/eac_rails_base0/runner.rb +3 -3
  52. data/lib/avm/tools/runner/eac_redmine_base0.rb +5 -23
  53. data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +1 -1
  54. data/lib/avm/tools/runner/eac_redmine_base0/docker.rb +1 -1
  55. data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +9 -18
  56. data/lib/avm/tools/runner/eac_wordpress_base0.rb +5 -24
  57. data/lib/avm/tools/runner/{eac_rails_base0/data.rb → eac_writings_base0.rb} +4 -4
  58. data/lib/avm/tools/runner/files/format.rb +3 -2
  59. data/lib/avm/tools/runner/git/auto_commit.rb +11 -0
  60. data/lib/avm/tools/runner/git/deploy.rb +1 -1
  61. data/lib/avm/tools/version.rb +1 -1
  62. data/template/avm/{stereotypes/eac_ubuntu_base0 → eac_ubuntu_base0}/docker_image/Dockerfile +0 -0
  63. data/template/avm/{stereotypes/eac_wordpress_base0 → eac_wordpress_base0}/deploy/wp-config.php.template +0 -0
  64. data/template/avm/eac_writings_base0/deploy/index.html.template +9 -0
  65. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  66. data/vendor/eac_cli/lib/eac_cli/definition.rb +35 -3
  67. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +17 -1
  68. data/vendor/eac_cli/lib/eac_cli/definition/help_formatter.rb +76 -0
  69. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +21 -4
  70. data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +1 -0
  71. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +4 -0
  72. data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +27 -64
  73. data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +17 -0
  74. data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +47 -19
  75. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
  76. data/vendor/eac_cli/lib/eac_cli/runner.rb +4 -0
  77. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +96 -0
  78. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  79. data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +25 -0
  80. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +48 -40
  81. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +57 -0
  82. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +4 -39
  83. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +41 -0
  84. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator.rb +4 -0
  85. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/current.rb +9 -0
  86. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/stopped.rb +14 -0
  87. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb +17 -0
  88. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  89. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/current_spec.rb +26 -0
  90. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/stopped_spec.rb +32 -0
  91. metadata +48 -33
  92. data/lib/avm/git/commit/deploy/appended.rb +0 -37
  93. data/lib/avm/git/commit/deploy/appended/base.rb +0 -17
  94. data/lib/avm/git/commit/deploy/appended/directory.rb +0 -32
  95. data/lib/avm/git/commit/deploy/appended/file_content.rb +0 -28
  96. data/lib/avm/rails/runners/bundle.rb +0 -35
  97. data/lib/avm/rails/runners/runner.rb +0 -48
  98. data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +0 -27
  99. data/lib/avm/stereotypes/eac_wordpress_base0/deploy.rb +0 -12
  100. data/lib/avm/stereotypes/eac_wordpress_base0/instance.rb +0 -26
  101. data/lib/avm/stereotypes/postgresql/instance.rb +0 -65
  102. data/lib/avm/stereotypes/postgresql/instance/data_unit.rb +0 -41
  103. data/lib/avm/stereotypes/postgresql/instance_with.rb +0 -20
  104. data/lib/avm/stereotypes/rails.rb +0 -11
  105. data/lib/avm/tools/runner/eac_rails_base0/apache_host.rb +0 -16
  106. data/lib/avm/tools/runner/eac_rails_base0/bundle.rb +0 -14
  107. data/lib/avm/tools/runner/eac_rails_base0/deploy.rb +0 -15
  108. data/lib/avm/tools/runner/eac_redmine_base0/bundle.rb +0 -14
  109. data/lib/avm/tools/runner/eac_redmine_base0/data.rb +0 -27
  110. data/lib/avm/tools/runner/eac_redmine_base0/data/dump.rb +0 -16
  111. data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +0 -15
  112. data/lib/avm/tools/runner/eac_redmine_base0/runner.rb +0 -14
  113. data/lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb +0 -17
  114. data/lib/avm/tools/runner/eac_wordpress_base0/data.rb +0 -15
  115. data/lib/avm/tools/runner/eac_wordpress_base0/deploy.rb +0 -15
@@ -5,22 +5,39 @@ require 'eac_ruby_utils/core_ext'
5
5
  module EacCli
6
6
  class Definition
7
7
  class PositionalArgument
8
- common_constructor :name, :options, default: [{}]
8
+ DEFAULT_REQUIRED = true
9
+
10
+ enable_listable
11
+ lists.add_symbol :option, :optional, :repeat, :required, :subcommand
12
+ common_constructor :name, :options, default: [{}] do
13
+ options.assert_valid_keys(self.class.lists.option.values)
14
+ end
9
15
 
10
16
  def identifier
11
17
  name.to_s.variableize.to_sym
12
18
  end
13
19
 
14
20
  def optional?
15
- options[:optional]
21
+ !required?
16
22
  end
17
23
 
18
24
  def repeat?
19
- options[:repeat]
25
+ options[OPTION_REPEAT]
26
+ end
27
+
28
+ def required?
29
+ return true if options.key?(OPTION_REQUIRED) && options.fetch(OPTION_REQUIRED)
30
+ return false if options.key?(OPTION_OPTIONAL) && options.fetch(OPTION_OPTIONAL)
31
+
32
+ DEFAULT_REQUIRED
20
33
  end
21
34
 
22
35
  def subcommand?
23
- options[:subcommand]
36
+ options[OPTION_SUBCOMMAND]
37
+ end
38
+
39
+ def to_s
40
+ "#{self.class.name.demodulize}[#{identifier}]"
24
41
  end
25
42
  end
26
43
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_cli/docopt/doc_builder'
4
+ require 'eac_cli/runner'
4
5
  require 'eac_ruby_utils/console/docopt_runner'
5
6
 
6
7
  module EacCli
@@ -31,6 +31,10 @@ module EacCli
31
31
  end
32
32
  end
33
33
 
34
+ def supplied?(option)
35
+ data[option].present?
36
+ end
37
+
34
38
  private
35
39
 
36
40
  def data
@@ -6,28 +6,46 @@ require 'optparse'
6
6
  module EacCli
7
7
  class Parser
8
8
  class OptionsCollection
9
- SEP = ' '
10
- IDENT = SEP * 2
11
- OPTION_DESC_SEP = IDENT * 2
12
-
13
9
  enable_simple_cache
14
10
  common_constructor(:definition, :argv, :collector) { collect }
15
11
  attr_reader :arguments
16
12
 
13
+ def options_first?
14
+ definition.options_first? || definition.subcommands?
15
+ end
16
+
17
17
  private
18
18
 
19
+ def check_required_options
20
+ definition.options.each do |option|
21
+ next unless option.required?
22
+ next if collector.supplied?(option)
23
+
24
+ raise ::EacCli::Parser::Error.new(
25
+ definition, argv, "Option \"#{option}\" is required and a value was not supplied"
26
+ )
27
+ end
28
+ end
29
+
19
30
  def collect
20
31
  build_banner
21
32
  build_options
22
- @arguments = option_parser.parse(argv)
33
+ parse_argv
34
+ check_required_options
23
35
  end
24
36
 
25
37
  def option_parser_uncached
26
38
  ::OptionParser.new
27
39
  end
28
40
 
41
+ def parse_argv
42
+ @arguments = options_first? ? option_parser.order(argv) : option_parser.parse(argv)
43
+ rescue ::OptionParser::InvalidOption => e
44
+ raise ::EacCli::Parser::Error.new(definition, argv, e.message)
45
+ end
46
+
29
47
  def build_banner
30
- option_parser.banner = "#{definition.description}\n\n#{section('usage')}"
48
+ option_parser.banner = definition.help_formatter.to_banner
31
49
  end
32
50
 
33
51
  def build_options
@@ -38,68 +56,13 @@ module EacCli
38
56
 
39
57
  def build_option(option)
40
58
  option_parser.on(
41
- *[option_short(option), option_long(option), option.description].reject(&:blank?)
59
+ *[::EacCli::Definition::HelpFormatter.option_short(option),
60
+ ::EacCli::Definition::HelpFormatter.option_long(option),
61
+ option.description].reject(&:blank?)
42
62
  ) do |value|
43
63
  collector.collect(option, value)
44
64
  end
45
65
  end
46
-
47
- def positional_argument(positional)
48
- if positional.subcommand?
49
- ::EacRubyUtils::Console::DocoptRunner::SUBCOMMANDS_MACRO
50
- else
51
- r = "<#{positional.name}>"
52
- r += '...' if positional.repeat?
53
- r = "[#{r}]" if positional.optional?
54
- r
55
- end
56
- end
57
-
58
- def option_argument(option)
59
- option_long(option)
60
- end
61
-
62
- def option_long(option)
63
- b = option.long
64
- b += '=VALUE' if option.argument?
65
- b
66
- end
67
-
68
- def option_short(option)
69
- b = option.short
70
- b += 'VALUE' if option.argument?
71
- b
72
- end
73
-
74
- def section(header, include_header = true)
75
- b = include_header ? "#{header.humanize}:\n" : ''
76
- b += send("self_#{header}") + "\n"
77
- # TO-DO: implement alternatives
78
- b
79
- end
80
-
81
- def self_options
82
- definition.options.map { |option| IDENT + option_definition(option) }.join("\n")
83
- end
84
-
85
- def self_usage
86
- IDENT + self_usage_arguments.join(SEP)
87
- end
88
-
89
- def self_usage_arguments
90
- [::EacRubyUtils::Console::DocoptRunner::PROGRAM_MACRO] +
91
- definition.options_argument.if_present([]) { |_v| ['[options]'] } +
92
- self_usage_arguments_options +
93
- self_usage_arguments_positional
94
- end
95
-
96
- def self_usage_arguments_options
97
- definition.options.select(&:show_on_usage?).map { |option| option_argument(option) }
98
- end
99
-
100
- def self_usage_arguments_positional
101
- definition.positional.map { |p| positional_argument(p) }
102
- end
103
66
  end
104
67
  end
105
68
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_cli/parser/error'
3
4
  require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module EacCli
@@ -8,6 +9,20 @@ module EacCli
8
9
  common_constructor :definition, :argv
9
10
 
10
11
  def result
12
+ result_or_error = parse(definition)
13
+ return result_or_error unless result_or_error.is_a?(::Exception)
14
+
15
+ definition.alternatives.each do |alternative|
16
+ alt_result_or_error = parse(alternative)
17
+ return alt_result_or_error unless alt_result_or_error.is_a?(::Exception)
18
+ end
19
+
20
+ raise result_or_error
21
+ end
22
+
23
+ private
24
+
25
+ def parse(definition)
11
26
  ::EacCli::Parser::Collector.to_data(definition) do |collector|
12
27
  ::EacCli::Parser::PositionalCollection.new(
13
28
  definition,
@@ -15,6 +30,8 @@ module EacCli
15
30
  collector
16
31
  )
17
32
  end
33
+ rescue ::EacCli::Parser::Error => e
34
+ e
18
35
  end
19
36
  end
20
37
  end
@@ -10,39 +10,67 @@ module EacCli
10
10
 
11
11
  private
12
12
 
13
+ def argv_enum
14
+ @argv_enum ||= argv.each
15
+ end
16
+
17
+ def argv_pending?
18
+ argv_enum.ongoing?
19
+ end
20
+
21
+ def argv_pending_check
22
+ return unless argv_pending?
23
+ return unless positional_enum.stopped?
24
+
25
+ raise ::EacCli::Parser::Error.new(
26
+ definition, argv, "No positional left for argv \"#{argv_enum.current}\""
27
+ )
28
+ end
29
+
13
30
  def collected
14
31
  @collected ||= ::Set.new
15
32
  end
16
33
 
17
34
  def collect
18
- argv.each { |argv_value| colect_argv_value(argv_value) }
19
- return unless pending_required_positional?
35
+ loop do
36
+ break unless enums('pending?').any?
20
37
 
21
- raise ::EacCli::Parser::Error.new(
22
- definition, argv, 'No value for required positional ' \
23
- "\"#{current_positional.identifier}\""
24
- )
38
+ enums('pending_check')
39
+ collect_argv_value
40
+ end
41
+ end
42
+
43
+ def collect_argv_value
44
+ collector.collect(*enums('enum', &:peek))
45
+ collected << positional_enum.peek
46
+ positional_enum.next unless positional_enum.peek.repeat?
47
+ argv_enum.next
25
48
  end
26
49
 
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?
50
+ def enums(method_suffix, &block)
51
+ %w[positional argv].map do |method_prefix|
52
+ v = send("#{method_prefix}_#{method_suffix}")
53
+ block ? block.call(v) : v
54
+ end
31
55
  end
32
56
 
33
- def pending_required_positional?
34
- !(current_positional.blank? || current_positional.optional? ||
35
- collected.include?(current_positional))
57
+ def positional_enum
58
+ @positional_enum ||= definition.positional.each
36
59
  end
37
60
 
38
- def positional_enumerator
39
- @positional_enumerator ||= definition.positional.each
61
+ def positional_pending?
62
+ !(positional_enum.stopped? || positional_enum.current.optional? ||
63
+ collected.include?(positional_enum.current))
40
64
  end
41
65
 
42
- def current_positional
43
- positional_enumerator.peek
44
- rescue ::StopIteration
45
- nil
66
+ def positional_pending_check
67
+ return unless positional_pending?
68
+ return unless argv_enum.stopped?
69
+
70
+ raise ::EacCli::Parser::Error.new(
71
+ definition, argv, 'No value for required positional ' \
72
+ "\"#{positional_enum.current.identifier}\""
73
+ )
46
74
  end
47
75
  end
48
76
  end
@@ -5,13 +5,14 @@ require 'eac_cli/runner'
5
5
  require 'eac_cli/runner_with'
6
6
 
7
7
  class Object
8
- def runner_with(*runners)
8
+ def runner_with(*runners, &block)
9
9
  include ::EacCli::Runner
10
10
  enable_simple_cache
11
11
  enable_console_speaker
12
12
  runners.each do |runner|
13
13
  include runner_with_to_module(runner)
14
14
  end
15
+ runner_definition(&block) if block
15
16
  end
16
17
 
17
18
  private
@@ -18,6 +18,10 @@ module EacCli
18
18
  end
19
19
  end
20
20
 
21
+ def runner?(object)
22
+ object.is_a?(::Class) && object.included_modules.include?(::EacCli::Runner)
23
+ end
24
+
21
25
  private
22
26
 
23
27
  def alias_class_method(klass, from, to)
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/runner'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module EacCli
7
+ module RunnerWith
8
+ module Subcommands
9
+ common_concern do
10
+ include ::EacCli::Runner
11
+ end
12
+
13
+ EXTRA_AVAILABLE_SUBCOMMANDS_METHOD_NAME = :extra_available_subcommands
14
+
15
+ def available_subcommands
16
+ @available_subcommands ||= available_subcommands_auto.merge(available_subcommands_extra)
17
+ end
18
+
19
+ def available_subcommands_auto
20
+ self.class.constants
21
+ .map { |name| [name.to_s.underscore.gsub('_', '-'), self.class.const_get(name)] }
22
+ .select { |c| ::EacCli::Runner.runner?(c[1]) }
23
+ .to_h.with_indifferent_access
24
+ end
25
+
26
+ def available_subcommands_extra
27
+ if respond_to?(EXTRA_AVAILABLE_SUBCOMMANDS_METHOD_NAME, true)
28
+ send(EXTRA_AVAILABLE_SUBCOMMANDS_METHOD_NAME)
29
+ else
30
+ {}
31
+ end
32
+ end
33
+
34
+ def method_missing(method_name, *arguments, &block)
35
+ return run_with_subcommand(*arguments, &block) if
36
+ run_with_subcommand_alias_run?(method_name)
37
+
38
+ super
39
+ end
40
+
41
+ def respond_to_missing?(method_name, include_private = false)
42
+ run_with_subcommand_alias_run?(method_name) || super
43
+ end
44
+
45
+ def run_with_subcommand
46
+ if subcommand_name
47
+ subcommand_runner.run
48
+ else
49
+ run_without_subcommand
50
+ end
51
+ end
52
+
53
+ def run_with_subcommand_alias_run?(method_name)
54
+ subcommands? && method_name.to_sym == :run
55
+ end
56
+
57
+ def run_without_subcommand
58
+ "Method #{__method__} should be overrided in #{self.class.name}"
59
+ end
60
+
61
+ def subcommands?
62
+ self.class.runner_definition.subcommands?
63
+ end
64
+
65
+ def subcommand_args
66
+ parsed.fetch(::EacCli::Definition::SUBCOMMAND_ARGS_ARG)
67
+ end
68
+
69
+ def subcommand_class
70
+ available_subcommands[subcommand_name].if_present { |v| return v }
71
+
72
+ raise(::EacCli::Parser::Error.new(
73
+ self.class.runner_definition, runner_context.argv,
74
+ "Subcommand \"#{subcommand_name}\" not found " \
75
+ "(Available: #{available_subcommands.keys}"
76
+ ))
77
+ end
78
+
79
+ def subcommand_name
80
+ parsed.fetch(::EacCli::Definition::SUBCOMMAND_NAME_ARG)
81
+ end
82
+
83
+ def subcommand_program
84
+ subcommand_name
85
+ end
86
+
87
+ def subcommand_runner
88
+ @subcommand_runner ||= subcommand_class.create(
89
+ argv: subcommand_args,
90
+ program_name: subcommand_program,
91
+ parent: self
92
+ )
93
+ end
94
+ end
95
+ end
96
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.9.0'
4
+ VERSION = '0.11.1'
5
5
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/docopt/runner_extension'
4
+
5
+ RSpec.describe ::EacCli::Docopt::RunnerExtension do
6
+ let(:stub_runner) do
7
+ r = Class.new(::EacRubyUtils::Console::DocoptRunner) do
8
+ def run; end
9
+ end
10
+ r.include ::EacCli::Runner
11
+ r.runner_definition do
12
+ desc 'A stub runner.'
13
+ arg_opt '-o', '--opt1', 'A argument option'
14
+ pos_arg 'pos1'
15
+ end
16
+ r
17
+ end
18
+
19
+ let(:instance) { stub_runner.new(argv: %w[-o aaa bbb]) }
20
+
21
+ before { instance.run }
22
+
23
+ it { expect(instance.options.fetch('--opt1')).to eq('aaa') }
24
+ it { expect(instance.options.fetch('<pos1>')).to eq('bbb') }
25
+ end