avm-tools 0.74.1 → 0.77.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/eac_rails_base1/runner/bundle.rb +2 -2
  3. data/lib/avm/eac_rails_base1/runner/code_runner.rb +3 -3
  4. data/lib/avm/eac_webapp_base0/deploy.rb +17 -40
  5. data/lib/avm/eac_webapp_base0/deploy/build.rb +48 -0
  6. data/lib/avm/eac_webapp_base0/deploy/git_info.rb +13 -0
  7. data/lib/avm/eac_webapp_base0/deploy/version.rb +4 -0
  8. data/lib/avm/eac_webapp_base0/deploy/write_on_target.rb +18 -0
  9. data/lib/avm/eac_webapp_base0/runner/deploy.rb +1 -0
  10. data/lib/avm/eac_writings_base0/apache_host.rb +17 -0
  11. data/lib/avm/eac_writings_base0/deploy.rb +36 -0
  12. data/lib/avm/eac_writings_base0/instance.rb +11 -0
  13. data/lib/avm/files/appendable.rb +55 -0
  14. data/lib/avm/files/appendable/file_content.rb +24 -0
  15. data/lib/avm/files/appendable/plain_directory.rb +25 -0
  16. data/lib/avm/files/appendable/resource_base.rb +13 -0
  17. data/lib/avm/files/appendable/tar_output_command.rb +26 -0
  18. data/lib/avm/files/appendable/templatized_directory.rb +28 -0
  19. data/lib/avm/files/appender.rb +11 -0
  20. data/lib/avm/files/deploy.rb +72 -0
  21. data/lib/avm/files/formatter.rb +8 -4
  22. data/lib/avm/git/auto_commit_path.rb +2 -4
  23. data/lib/avm/git/auto_commit_path/ruby.rb +20 -0
  24. data/lib/avm/git/commit/deploy.rb +8 -61
  25. data/lib/avm/tools/runner/eac_rails_base0/rails_server.rb +1 -0
  26. data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +7 -16
  27. data/lib/avm/tools/runner/eac_writings_base0.rb +15 -0
  28. data/lib/avm/tools/runner/files/format.rb +3 -2
  29. data/lib/avm/tools/runner/git/auto_commit.rb +11 -0
  30. data/lib/avm/tools/runner/git/deploy.rb +1 -1
  31. data/lib/avm/tools/version.rb +1 -1
  32. data/template/avm/eac_redmine_base0/deploy/config/install.sh.template +12 -0
  33. data/template/avm/{stereotypes/eac_ubuntu_base0 → eac_ubuntu_base0}/docker_image/Dockerfile +0 -0
  34. data/template/avm/{stereotypes/eac_wordpress_base0 → eac_wordpress_base0}/deploy/wp-config.php.template +0 -0
  35. data/template/avm/eac_writings_base0/deploy/index.html.template +9 -0
  36. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  37. data/vendor/eac_cli/lib/eac_cli/definition.rb +49 -22
  38. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +83 -0
  39. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +17 -1
  40. data/vendor/eac_cli/lib/eac_cli/{parser/options_collection.rb → definition/help_formatter.rb} +20 -49
  41. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +21 -4
  42. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +18 -40
  43. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +50 -0
  44. data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +1 -0
  45. data/vendor/eac_cli/lib/eac_cli/parser.rb +21 -3
  46. data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +88 -0
  47. data/vendor/eac_cli/lib/eac_cli/parser/alternative/argv.rb +17 -0
  48. data/vendor/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +24 -0
  49. data/vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb +58 -0
  50. data/vendor/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +30 -0
  51. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +4 -0
  52. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
  53. data/vendor/eac_cli/lib/eac_cli/runner.rb +6 -2
  54. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +1 -1
  55. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +96 -0
  56. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  57. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +14 -0
  58. data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +35 -0
  59. data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +140 -0
  60. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +57 -40
  61. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +57 -0
  62. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +32 -1
  63. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +1 -1
  64. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  65. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb +59 -0
  66. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +7 -107
  67. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/entry_reader.rb +81 -0
  68. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/password_entry_reader.rb +18 -0
  69. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +46 -0
  70. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/store_passwords_entry_reader.rb +27 -0
  71. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator.rb +4 -0
  72. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/current.rb +9 -0
  73. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/stopped.rb +14 -0
  74. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb +17 -0
  75. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  76. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +3 -2
  77. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/abstract_methods_spec.rb +28 -0
  78. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/current_spec.rb +26 -0
  79. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/stopped_spec.rb +32 -0
  80. metadata +45 -12
  81. data/lib/avm/git/commit/deploy/appended.rb +0 -37
  82. data/lib/avm/git/commit/deploy/appended/base.rb +0 -17
  83. data/lib/avm/git/commit/deploy/appended/directory.rb +0 -32
  84. data/lib/avm/git/commit/deploy/appended/file_content.rb +0 -28
  85. data/lib/avm/tools/runner/eac_rails_base0/bundle.rb +0 -14
  86. data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +0 -21
  87. data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +0 -49
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.74.1'
5
+ VERSION = '0.77.0'
6
6
  end
7
7
  end
@@ -12,3 +12,15 @@ fi
12
12
  export address_host='%%WEB.AUTHORITY%%'
13
13
  export address_path='%%WEB.PATH%%'
14
14
  export git_repositories_hierarchical_organisation=false
15
+
16
+ # Mail settings
17
+ export smtp_server='%%MAILER.SMTP.ADDRESS%%'
18
+ export smtp_port='%%MAILER.SMTP.PORT%%'
19
+ export smtp_domain='%%MAILER.SMTP.DOMAIN%%'
20
+ export smtp_tls='%%MAILER_SMTP_TLS%%'
21
+ export smtp_enable_starttls_auto='%%MAILER_SMTP_STARTTLS_AUTO%%'
22
+ export smtp_openssl_verify_mode='%%MAILER_SMTP_OPENSSL_VERIFY_MODE%%'
23
+ export smtp_authentication='%%MAILER.SMTP.AUTHENTICATION%%'
24
+ export smtp_username='%%MAILER.SMTP.USERNAME%%'
25
+ export smtp_password='%%MAILER.SMTP.PASSWORD%%'
26
+ export mail_from='%%MAILER.FROM%%'
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <head>
3
+ <title>%%title%%</title>
4
+ </head>
5
+ <body>
6
+ <h1>%%title%%</h1>
7
+ <a href="%%pdf_path%%">PDF</a>
8
+ </body>
9
+ </html>
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*', 'Gemfile']
14
14
 
15
- s.add_dependency 'eac_ruby_utils', '~> 0.45'
15
+ s.add_dependency 'eac_ruby_utils', '~> 0.50'
16
16
 
17
17
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
18
18
  end
@@ -8,57 +8,66 @@ require 'eac_ruby_utils/core_ext'
8
8
  module EacCli
9
9
  class Definition
10
10
  require_sub __FILE__
11
+
12
+ MAIN_ALTERNATIVE_KEY = :main
13
+ SUBCOMMAND_NAME_ARG = 'subcommand'
14
+ SUBCOMMAND_ARGS_ARG = 'subcommand_args'
15
+
11
16
  attr_accessor :description
12
- attr_accessor :options_argument
13
17
 
14
18
  def initialize
15
19
  self.description = '-- NO DESCRIPTION SET --'
16
- self.options_argument = true
20
+ alternatives_set[MAIN_ALTERNATIVE_KEY] = main_alternative
17
21
  end
18
22
 
19
23
  def alt(&block)
20
- r = ::EacCli::Definition.new
24
+ r = ::EacCli::Definition::Alternative.new
21
25
  r.instance_eval(&block)
22
- alternatives << r
26
+ alternatives_set[new_alternative_key] = r
23
27
  r
24
28
  end
25
29
 
26
30
  def alternatives
27
- @alternatives ||= []
28
- end
29
-
30
- def arg_opt(short, long, description, option_options = {})
31
- options << ::EacCli::Definition::ArgumentOption.new(
32
- short, long, description, option_options
33
- )
31
+ alternatives_set.values
34
32
  end
35
33
 
36
- def bool_opt(short, long, description, option_options = {})
37
- options << ::EacCli::Definition::BooleanOption.new(short, long, description, option_options)
34
+ def alternative(key)
35
+ alternatives_set.fetch(key)
38
36
  end
39
37
 
40
38
  def desc(description)
41
39
  self.description = description
42
40
  end
43
41
 
42
+ def help_formatter
43
+ @help_formatter ||= ::EacCli::Definition::HelpFormatter.new(self)
44
+ end
45
+
46
+ def main_alternative
47
+ @main_alternative ||= begin
48
+ r = ::EacCli::Definition::Alternative.new
49
+ r.options_argument(true)
50
+ r
51
+ end
52
+ end
53
+
44
54
  def options_arg(options_argument)
45
55
  self.options_argument = options_argument
46
56
  end
47
57
 
48
- def options
49
- @options ||= []
58
+ def options_argument
59
+ main_alternative.options_argument?
50
60
  end
51
61
 
52
- def pos_arg(name, arg_options = {})
53
- positional << ::EacCli::Definition::PositionalArgument.new(name, arg_options)
62
+ def options_argument=(enable)
63
+ main_alternative.options_argument(enable)
54
64
  end
55
65
 
56
- def positional
57
- @positional ||= []
58
- end
66
+ delegate :arg_opt, :bool_opt, :options, :pos_arg,
67
+ :positional, :subcommands, to: :main_alternative
59
68
 
60
- def subcommands
61
- positional << ::EacCli::Definition::PositionalArgument.new('subcommand', subcommand: true)
69
+ def subcommands?
70
+ alternatives.any?(&:subcommands?)
62
71
  end
63
72
 
64
73
  def options_first(enable = true)
@@ -68,5 +77,23 @@ module EacCli
68
77
  def options_first?
69
78
  @options_first ? true : false
70
79
  end
80
+
81
+ private
82
+
83
+ def alternatives_set
84
+ @alternatives_set ||= ::ActiveSupport::HashWithIndifferentAccess.new
85
+ end
86
+
87
+ def new_alternative_key
88
+ @last_key ||= 0
89
+ loop do
90
+ @last_key += 1
91
+ break @last_key unless alternatives_set.key?(@last_key)
92
+ end
93
+ end
94
+
95
+ def pos_set
96
+ @pos_set ||= []
97
+ end
71
98
  end
72
99
  end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/definition/argument_option'
4
+ require 'eac_cli/definition/boolean_option'
5
+ require 'eac_cli/definition/positional_argument'
6
+
7
+ module EacCli
8
+ class Definition
9
+ class Alternative
10
+ SUBCOMMAND_NAME_ARG = :subcommand
11
+ SUBCOMMAND_ARGS_ARG = :subcommand_args
12
+
13
+ def arg_opt(short, long, description, option_options = {})
14
+ options_set << ::EacCli::Definition::ArgumentOption.new(
15
+ short, long, description, option_options
16
+ )
17
+ end
18
+
19
+ def bool_opt(short, long, description, option_options = {})
20
+ options_set << ::EacCli::Definition::BooleanOption.new(short, long, description,
21
+ option_options)
22
+ end
23
+
24
+ def options
25
+ options_set.to_a
26
+ end
27
+
28
+ def options_argument?
29
+ @options_argument ? true : false
30
+ end
31
+
32
+ def options_argument(enable)
33
+ @options_argument = enable
34
+
35
+ self
36
+ end
37
+
38
+ def pos_arg(name, arg_options = {})
39
+ new_pos_arg = ::EacCli::Definition::PositionalArgument.new(name, arg_options)
40
+ check_positional_blocked(new_pos_arg)
41
+ pos_set << new_pos_arg
42
+ end
43
+
44
+ def positional
45
+ pos_set.to_a
46
+ end
47
+
48
+ def positional_arguments_blocked?(new_pos_arg)
49
+ last = pos_set.last
50
+ return false unless last
51
+ return true if subcommands?
52
+ return true if last.repeat?
53
+ return true if last.optional? && new_pos_arg.if_present(&:required?)
54
+
55
+ false
56
+ end
57
+
58
+ def subcommands
59
+ pos_arg(SUBCOMMAND_NAME_ARG, subcommand: true)
60
+ pos_set << ::EacCli::Definition::PositionalArgument.new(SUBCOMMAND_ARGS_ARG,
61
+ optional: true, repeat: true)
62
+ end
63
+
64
+ def subcommands?
65
+ pos_set.any?(&:subcommand?)
66
+ end
67
+
68
+ private
69
+
70
+ def check_positional_blocked(new_pos_arg)
71
+ raise 'Positional arguments are blocked' if positional_arguments_blocked?(new_pos_arg)
72
+ end
73
+
74
+ def pos_set
75
+ @pos_set ||= []
76
+ end
77
+
78
+ def options_set
79
+ @options_set ||= []
80
+ end
81
+ end
82
+ end
83
+ end
@@ -5,19 +5,35 @@ require 'eac_ruby_utils/core_ext'
5
5
  module EacCli
6
6
  class Definition
7
7
  class BaseOption
8
+ DEFAULT_REQUIRED = false
9
+
10
+ enable_listable
11
+ lists.add_symbol :option, :optional, :usage, :required
8
12
  attr_reader :short, :long, :description, :options
9
13
 
10
14
  def initialize(short, long, description, options = {})
11
15
  @short = short
12
16
  @long = long
13
17
  @description = description
14
- @options = options.with_indifferent_access
18
+ @options = options.symbolize_keys
19
+ @options.assert_valid_keys(::EacCli::Definition::BaseOption.lists.option.values)
15
20
  end
16
21
 
17
22
  def identifier
18
23
  long.to_s.variableize.to_sym
19
24
  end
20
25
 
26
+ def required?
27
+ return true if options.key?(:required) && options.fetch(:required)
28
+ return false if options.key?(:optional) && options.fetch(:optional)
29
+
30
+ DEFAULT_REQUIRED
31
+ end
32
+
33
+ def to_s
34
+ "#{self.class.name.demodulize}[#{identifier}]"
35
+ end
36
+
21
37
  def show_on_usage?
22
38
  options[:usage]
23
39
  end
@@ -1,49 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
- require 'optparse'
5
4
 
6
5
  module EacCli
7
- class Parser
8
- class OptionsCollection
6
+ class Definition
7
+ class HelpFormatter
9
8
  SEP = ' '
10
9
  IDENT = SEP * 2
11
10
  OPTION_DESC_SEP = IDENT * 2
12
11
 
13
- enable_simple_cache
14
- common_constructor(:definition, :argv, :collector) { collect }
15
- attr_reader :arguments
16
-
17
- private
18
-
19
- def collect
20
- build_banner
21
- build_options
22
- @arguments = option_parser.parse(argv)
23
- end
24
-
25
- def option_parser_uncached
26
- ::OptionParser.new
27
- end
28
-
29
- def build_banner
30
- option_parser.banner = "#{definition.description}\n\n#{section('usage')}"
31
- end
32
-
33
- def build_options
34
- definition.options.each do |option|
35
- build_option(option)
12
+ class << self
13
+ def option_long(option)
14
+ b = option.long
15
+ b += '=VALUE' if option.argument?
16
+ b
36
17
  end
37
- end
38
18
 
39
- def build_option(option)
40
- option_parser.on(
41
- *[option_short(option), option_long(option), option.description].reject(&:blank?)
42
- ) do |value|
43
- collector.collect(option, value)
19
+ def option_short(option)
20
+ b = option.short
21
+ b += 'VALUE' if option.argument?
22
+ b
44
23
  end
45
24
  end
46
25
 
26
+ common_constructor :definition
27
+
47
28
  def positional_argument(positional)
48
29
  if positional.subcommand?
49
30
  ::EacRubyUtils::Console::DocoptRunner::SUBCOMMANDS_MACRO
@@ -55,22 +36,6 @@ module EacCli
55
36
  end
56
37
  end
57
38
 
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
39
  def section(header, include_header = true)
75
40
  b = include_header ? "#{header.humanize}:\n" : ''
76
41
  b += send("self_#{header}") + "\n"
@@ -94,12 +59,18 @@ module EacCli
94
59
  end
95
60
 
96
61
  def self_usage_arguments_options
97
- definition.options.select(&:show_on_usage?).map { |option| option_argument(option) }
62
+ definition.options.select(&:show_on_usage?).map do |option|
63
+ self.class.option_long(option)
64
+ end
98
65
  end
99
66
 
100
67
  def self_usage_arguments_positional
101
68
  definition.positional.map { |p| positional_argument(p) }
102
69
  end
70
+
71
+ def to_banner
72
+ "#{definition.description}\n\n#{section('usage')}"
73
+ end
103
74
  end
104
75
  end
105
76
  end
@@ -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
@@ -6,71 +6,49 @@ require 'eac_ruby_utils/console/docopt_runner'
6
6
  module EacCli
7
7
  module Docopt
8
8
  class DocBuilder
9
+ require_sub __FILE__
9
10
  common_constructor :definition
10
11
 
11
12
  SEP = ' '
12
13
  IDENT = SEP * 2
13
14
  OPTION_DESC_SEP = IDENT * 2
14
15
 
15
- def positional_argument(positional)
16
- if positional.subcommand?
17
- ::EacRubyUtils::Console::DocoptRunner::SUBCOMMANDS_MACRO
18
- else
19
- r = "<#{positional.name}>"
20
- r += '...' if positional.repeat?
21
- r = "[#{r}]" if positional.optional?
22
- r
16
+ class << self
17
+ def option_long(option)
18
+ b = option.long
19
+ b += '=<value>' if option.argument?
20
+ b
23
21
  end
24
22
  end
25
23
 
26
- def option_argument(option)
27
- option_long(option)
28
- end
29
-
30
24
  def option_definition(option)
31
- option.short + SEP + option_long(option) + OPTION_DESC_SEP + option.description
32
- end
33
-
34
- def option_long(option)
35
- b = option.long
36
- b += '=<value>' if option.argument?
37
- b
25
+ option.short + SEP + self.class.option_long(option) + OPTION_DESC_SEP + option.description
38
26
  end
39
27
 
40
28
  def section(header, include_header = true)
41
29
  b = include_header ? "#{header.humanize}:\n" : ''
42
30
  b += send("self_#{header}") + "\n"
43
31
  definition.alternatives.each do |alternative|
44
- b += self.class.new(alternative).section(header, false)
32
+ b += IDENT + ::EacCli::Docopt::DocBuilder::Alternative.new(alternative).to_s + "\n"
45
33
  end
46
34
  b
47
35
  end
48
36
 
49
- def self_options
50
- definition.options.map { |option| IDENT + option_definition(option) }.join("\n")
51
- end
52
-
53
- def self_usage
54
- IDENT + self_usage_arguments.join(SEP)
55
- end
56
-
57
- def self_usage_arguments
58
- [::EacRubyUtils::Console::DocoptRunner::PROGRAM_MACRO] +
59
- definition.options_argument.if_present([]) { |_v| ['[options]'] } +
60
- self_usage_arguments_options +
61
- self_usage_arguments_positional
62
- end
63
-
64
- def self_usage_arguments_options
65
- definition.options.select(&:show_on_usage?).map { |option| option_argument(option) }
37
+ def options_section
38
+ "Options:\n" +
39
+ definition.alternatives.flat_map(&:options)
40
+ .map { |option| IDENT + option_definition(option) + "\n" }.join
66
41
  end
67
42
 
68
- def self_usage_arguments_positional
69
- definition.positional.map { |p| positional_argument(p) }
43
+ def usage_section
44
+ "Usage:\n" +
45
+ definition.alternatives.map do |alternative|
46
+ IDENT + ::EacCli::Docopt::DocBuilder::Alternative.new(alternative).to_s + "\n"
47
+ end.join
70
48
  end
71
49
 
72
50
  def to_s
73
- "#{definition.description}\n\n#{section('usage')}\n#{section('options')}\n"
51
+ "#{definition.description}\n\n#{usage_section}\n#{options_section}\n"
74
52
  end
75
53
  end
76
54
  end