avm-tools 0.76.1 → 0.77.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/tools/version.rb +1 -1
  3. data/template/avm/eac_redmine_base0/deploy/config/install.sh.template +12 -0
  4. data/vendor/eac_cli/lib/eac_cli/definition.rb +34 -39
  5. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +83 -0
  6. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +18 -40
  7. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +50 -0
  8. data/vendor/eac_cli/lib/eac_cli/parser.rb +21 -3
  9. data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +88 -0
  10. data/vendor/eac_cli/lib/eac_cli/parser/alternative/argv.rb +17 -0
  11. data/vendor/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +24 -0
  12. data/vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb +58 -0
  13. data/vendor/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +30 -0
  14. data/vendor/eac_cli/lib/eac_cli/runner.rb +2 -2
  15. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +1 -1
  16. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  17. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +14 -0
  18. data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +10 -0
  19. data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +140 -0
  20. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +14 -5
  21. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +32 -1
  22. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +1 -1
  23. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  24. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb +59 -0
  25. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +4 -69
  26. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/entry_reader.rb +81 -0
  27. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/password_entry_reader.rb +18 -0
  28. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +7 -2
  29. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/store_passwords_entry_reader.rb +27 -0
  30. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  31. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +3 -2
  32. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/abstract_methods_spec.rb +28 -0
  33. metadata +16 -5
  34. data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +0 -68
  35. data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +0 -38
  36. data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +0 -77
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd41b3c790de4a2264c78b5daa5afbd469de6ba2e74b616f096619d0a7bc5460
4
- data.tar.gz: 0a1890b253e90debb2951fe90193fef541df4c4d0701dcf82712696377b1adbe
3
+ metadata.gz: 3345f4afdd4f7bb8cb968848675bc6b1d5c91e5833b17e90c43a01eae82a95c3
4
+ data.tar.gz: 5e032e2b459e3c1fe3bf5c42e054d89491736c8e181b17a988a079068728b526
5
5
  SHA512:
6
- metadata.gz: 2ebb73966071bb959e16f10f37b784971f65b3f2cfede241fe4b02c127f24d057bbaedec098e900b8b69edf55e5951637f905a07d5a242d0b7bfd7b51907a3be
7
- data.tar.gz: 510d2e7625a10c523269684a6e269212a5d8b027d671dc38e337be9c1015d9c69d4ba8f78049ee13090a9e6c733fabfd6b5d40541b6ddbd1e86cd8b4e524ba7c
6
+ metadata.gz: eccb5df2cf88efda09388fdcbf6a363ad32d49772980b57a58865d5b322c49848cfbaacbd572d4c7c9f9fa2af486ee5efb32b6632b91ead052546e76aa3be51d
7
+ data.tar.gz: a28d9a27d6c22363d021dad5c1bee61cff8785139c9f69cf131762a6702f988d478ae15880845eb6294941b99e0e391496f4298e99864455543ebad80f8e8866
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.76.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%%'
@@ -9,36 +9,30 @@ module EacCli
9
9
  class Definition
10
10
  require_sub __FILE__
11
11
 
12
+ MAIN_ALTERNATIVE_KEY = :main
12
13
  SUBCOMMAND_NAME_ARG = 'subcommand'
13
14
  SUBCOMMAND_ARGS_ARG = 'subcommand_args'
14
15
 
15
16
  attr_accessor :description
16
- attr_accessor :options_argument
17
17
 
18
18
  def initialize
19
19
  self.description = '-- NO DESCRIPTION SET --'
20
- self.options_argument = true
20
+ alternatives_set[MAIN_ALTERNATIVE_KEY] = main_alternative
21
21
  end
22
22
 
23
23
  def alt(&block)
24
- r = ::EacCli::Definition.new
24
+ r = ::EacCli::Definition::Alternative.new
25
25
  r.instance_eval(&block)
26
- alternatives << r
26
+ alternatives_set[new_alternative_key] = r
27
27
  r
28
28
  end
29
29
 
30
30
  def alternatives
31
- @alternatives ||= []
31
+ alternatives_set.values
32
32
  end
33
33
 
34
- def arg_opt(short, long, description, option_options = {})
35
- options << ::EacCli::Definition::ArgumentOption.new(
36
- short, long, description, option_options
37
- )
38
- end
39
-
40
- def bool_opt(short, long, description, option_options = {})
41
- options << ::EacCli::Definition::BooleanOption.new(short, long, description, option_options)
34
+ def alternative(key)
35
+ alternatives_set.fetch(key)
42
36
  end
43
37
 
44
38
  def desc(description)
@@ -49,42 +43,31 @@ module EacCli
49
43
  @help_formatter ||= ::EacCli::Definition::HelpFormatter.new(self)
50
44
  end
51
45
 
52
- def options_arg(options_argument)
53
- self.options_argument = options_argument
54
- end
55
-
56
- def options
57
- @options ||= []
46
+ def main_alternative
47
+ @main_alternative ||= begin
48
+ r = ::EacCli::Definition::Alternative.new
49
+ r.options_argument(true)
50
+ r
51
+ end
58
52
  end
59
53
 
60
- def pos_arg(name, arg_options = {})
61
- new_pos_arg = ::EacCli::Definition::PositionalArgument.new(name, arg_options)
62
- raise 'Positional arguments are blocked' if positional_arguments_blocked?(new_pos_arg)
63
-
64
- pos_set << new_pos_arg
54
+ def options_arg(options_argument)
55
+ self.options_argument = options_argument
65
56
  end
66
57
 
67
- def positional
68
- pos_set.to_a
58
+ def options_argument
59
+ main_alternative.options_argument?
69
60
  end
70
61
 
71
- def positional_arguments_blocked?(new_pos_arg)
72
- last = pos_set.last
73
- return false unless last
74
- return true if last.repeat?
75
- return true if last.optional? && new_pos_arg.required?
76
-
77
- false
62
+ def options_argument=(enable)
63
+ main_alternative.options_argument(enable)
78
64
  end
79
65
 
80
- def subcommands
81
- pos_arg(SUBCOMMAND_NAME_ARG, subcommand: true)
82
- pos_set << ::EacCli::Definition::PositionalArgument.new(SUBCOMMAND_ARGS_ARG,
83
- optional: true, repeat: true)
84
- end
66
+ delegate :arg_opt, :bool_opt, :options, :pos_arg,
67
+ :positional, :subcommands, to: :main_alternative
85
68
 
86
69
  def subcommands?
87
- pos_set.any?(&:subcommand?)
70
+ alternatives.any?(&:subcommands?)
88
71
  end
89
72
 
90
73
  def options_first(enable = true)
@@ -97,6 +80,18 @@ module EacCli
97
80
 
98
81
  private
99
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
+
100
95
  def pos_set
101
96
  @pos_set ||= []
102
97
  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
@@ -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
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/console/docopt_runner'
5
+
6
+ module EacCli
7
+ module Docopt
8
+ class DocBuilder
9
+ class Alternative
10
+ common_constructor :alternative
11
+
12
+ def to_s
13
+ (
14
+ [::EacRubyUtils::Console::DocoptRunner::PROGRAM_MACRO] +
15
+ alternative.options_argument?.if_present([]) { |_v| ['[options]'] } +
16
+ options +
17
+ positionals
18
+ ).join(::EacCli::Docopt::DocBuilder::SEP)
19
+ end
20
+
21
+ def options
22
+ alternative.options.select(&:show_on_usage?).map do |option|
23
+ ::EacCli::Docopt::DocBuilder.option_long(option)
24
+ end
25
+ end
26
+
27
+ def option_argument(option)
28
+ b = option.long
29
+ b += '=<value>' if option.argument?
30
+ b
31
+ end
32
+
33
+ def positionals
34
+ alternative.positional.map { |p| positional(p) }
35
+ end
36
+
37
+ def positional(positional)
38
+ if positional.subcommand?
39
+ ::EacRubyUtils::Console::DocoptRunner::SUBCOMMANDS_MACRO
40
+ else
41
+ r = "<#{positional.name}>"
42
+ r += '...' if positional.repeat?
43
+ r = "[#{r}]" if positional.optional?
44
+ r
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -5,10 +5,28 @@ require 'eac_ruby_utils/core_ext'
5
5
  module EacCli
6
6
  class Parser
7
7
  require_sub __FILE__
8
- common_constructor :definition
8
+ enable_simple_cache
9
+ common_constructor :definition, :argv
9
10
 
10
- def parse(argv)
11
- ::EacCli::Parser::ParseResult.new(definition, argv).result
11
+ private
12
+
13
+ def parsed_uncached
14
+ raise 'Definition has no alternatives' if alternatives.empty?
15
+
16
+ alternatives.each do |alt_parser|
17
+ return alt_parser.parsed unless alt_parser.error?
18
+ end
19
+
20
+ raise first_error
21
+ end
22
+
23
+ def alternatives_uncached
24
+ definition.alternatives
25
+ .map { |alternative| ::EacCli::Parser::Alternative.new(alternative, argv) }
26
+ end
27
+
28
+ def first_error_uncached
29
+ alternatives.lazy.select(&:error?).map(&:error).first
12
30
  end
13
31
  end
14
32
  end
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/parser/collector'
4
+ require 'eac_cli/parser/error'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module EacCli
8
+ class Parser
9
+ class Alternative
10
+ require_sub __FILE__, include_modules: true
11
+ enable_listable
12
+ lists.add_symbol :phase, :any, :option_argument, :positional
13
+ attr_reader :error
14
+
15
+ common_constructor :alternative, :argv do
16
+ alternative.assert_argument(::EacCli::Definition::Alternative, :alternative)
17
+ self.phase = PHASE_ANY
18
+ collect
19
+ end
20
+
21
+ def error?
22
+ error.present?
23
+ end
24
+
25
+ def parsed
26
+ @parsed ||= collector.to_data.freeze
27
+ end
28
+
29
+ private
30
+
31
+ attr_accessor :phase
32
+
33
+ def any_collect_argv_value
34
+ if argv_current_option?
35
+ option_collect_argv_value
36
+ else
37
+ positional_collect_argv_value
38
+ end
39
+ end
40
+
41
+ def collector
42
+ @collector ||= ::EacCli::Parser::Collector.new(alternative)
43
+ end
44
+
45
+ def collect
46
+ loop do
47
+ break unless argv_pending?
48
+
49
+ collect_argv_value
50
+ end
51
+ validate
52
+ rescue ::EacCli::Parser::Error => e
53
+ @error = e
54
+ end
55
+
56
+ def collect_argv_value
57
+ send("#{phase}_collect_argv_value")
58
+ argv_enum.next
59
+ end
60
+
61
+ def collect_option_argv_value
62
+ alternative.options.each do |option|
63
+ end
64
+
65
+ raise ::EacCli::Parser::Error.new(
66
+ alternative, argv, "Invalid option: #{argv_enum.current}"
67
+ )
68
+ end
69
+
70
+ def raise_error(message)
71
+ raise ::EacCli::Parser::Error.new(alternative, argv, message)
72
+ end
73
+
74
+ def validate
75
+ (alternative.options + alternative.positional).each do |option|
76
+ validate_option(option)
77
+ end
78
+ end
79
+
80
+ def validate_option(option)
81
+ return unless option.required?
82
+ return if collector.supplied?(option)
83
+
84
+ raise_error("Required option/positional #{option} not supplied")
85
+ end
86
+ end
87
+ end
88
+ end