avm-tools 0.67.0 → 0.69.3

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/apache_host.rb +17 -0
  3. data/lib/avm/eac_rails_base0/deploy.rb +50 -0
  4. data/lib/avm/eac_rails_base0/instance.rb +14 -0
  5. data/lib/avm/eac_redmine_base0/deploy.rb +2 -2
  6. data/lib/avm/eac_redmine_base0/instance.rb +2 -2
  7. data/lib/avm/eac_webapp_base0/apache_host.rb +103 -0
  8. data/lib/avm/eac_webapp_base0/deploy.rb +102 -0
  9. data/lib/avm/eac_webapp_base0/deploy/appended_directories.rb +25 -0
  10. data/lib/avm/eac_webapp_base0/deploy/file_unit.rb +41 -0
  11. data/lib/avm/eac_webapp_base0/deploy/git_info.rb +49 -0
  12. data/lib/avm/eac_webapp_base0/deploy/version.rb +20 -0
  13. data/lib/avm/eac_webapp_base0/instance.rb +50 -0
  14. data/lib/avm/eac_webapp_base0/runner/apache_host.rb +39 -0
  15. data/lib/avm/eac_webapp_base0/runner/data.rb +25 -0
  16. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +69 -0
  17. data/lib/avm/eac_webapp_base0/runner/data/load.rb +66 -0
  18. data/lib/avm/eac_webapp_base0/runner/deploy.rb +59 -0
  19. data/lib/avm/git/issue/complete/_git_subrepos.rb +1 -0
  20. data/lib/avm/local_projects/instance.rb +1 -1
  21. data/lib/avm/projects/stereotypes/git_subrepo/warp.rb +2 -2
  22. data/lib/avm/projects/stereotypes/rails_application.rb +2 -0
  23. data/lib/avm/projects/stereotypes/rails_application/local_project_mixin.rb +18 -0
  24. data/lib/avm/projects/stereotypes/rails_application/update.rb +14 -0
  25. data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +2 -2
  26. data/lib/avm/stereotypes/eac_wordpress_base0/deploy.rb +2 -2
  27. data/lib/avm/stereotypes/eac_wordpress_base0/instance.rb +2 -2
  28. data/lib/avm/tools/runner/eac_rails_base0.rb +2 -2
  29. data/lib/avm/tools/runner/eac_rails_base0/apache_host.rb +3 -26
  30. data/lib/avm/tools/runner/eac_rails_base0/data.rb +2 -2
  31. data/lib/avm/tools/runner/eac_rails_base0/deploy.rb +3 -3
  32. data/lib/avm/tools/runner/eac_redmine_base0/data.rb +1 -1
  33. data/lib/avm/tools/runner/eac_redmine_base0/data/dump.rb +2 -2
  34. data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +2 -2
  35. data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +1 -0
  36. data/lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb +3 -25
  37. data/lib/avm/tools/runner/eac_wordpress_base0/data.rb +2 -2
  38. data/lib/avm/tools/runner/eac_wordpress_base0/deploy.rb +2 -2
  39. data/lib/avm/tools/version.rb +1 -1
  40. data/lib/eac_launcher/git/sub_warp_base.rb +1 -1
  41. data/lib/eac_launcher/publish/base.rb +1 -1
  42. data/template/avm/{stereotypes/eac_rails_base0 → eac_rails_base0}/deploy/config/database.yml.template +0 -0
  43. data/template/avm/{stereotypes/eac_webapp_base0 → eac_webapp_base0}/apache_host/no_ssl.conf +0 -0
  44. data/template/avm/self/docker_image/Dockerfile +1 -1
  45. data/vendor/eac_cli/Gemfile +5 -0
  46. data/vendor/eac_cli/eac_cli.gemspec +18 -0
  47. data/vendor/eac_cli/lib/eac_cli.rb +7 -0
  48. data/vendor/eac_cli/lib/eac_cli/core_ext.rb +4 -0
  49. data/vendor/eac_cli/lib/eac_cli/default_runner.rb +14 -0
  50. data/vendor/eac_cli/lib/eac_cli/definition.rb +72 -0
  51. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +13 -0
  52. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +26 -0
  53. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +13 -0
  54. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +27 -0
  55. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +77 -0
  56. data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +45 -0
  57. data/vendor/eac_cli/lib/eac_cli/parser.rb +14 -0
  58. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +56 -0
  59. data/vendor/eac_cli/lib/eac_cli/parser/error.rb +15 -0
  60. data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +105 -0
  61. data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +21 -0
  62. data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +49 -0
  63. data/vendor/eac_cli/lib/eac_cli/patches.rb +4 -0
  64. data/vendor/eac_cli/lib/eac_cli/patches/object.rb +5 -0
  65. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +24 -0
  66. data/vendor/eac_cli/lib/eac_cli/runner.rb +87 -0
  67. data/vendor/eac_cli/lib/eac_cli/runner/context.rb +18 -0
  68. data/vendor/eac_cli/lib/eac_cli/runner_with.rb +9 -0
  69. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +19 -0
  70. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +26 -0
  71. data/vendor/eac_cli/lib/eac_cli/version.rb +5 -0
  72. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +70 -0
  73. data/vendor/eac_cli/spec/rubocop_spec.rb +7 -0
  74. data/vendor/eac_cli/spec/spec_helper.rb +100 -0
  75. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  76. data/vendor/eac_git/vendor/git-subrepo/lib/git-subrepo +9 -7
  77. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +3 -3
  78. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +5 -1
  79. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  80. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +10 -0
  81. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +6 -5
  82. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +5 -34
  83. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +42 -0
  84. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb +25 -0
  85. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  86. data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +14 -0
  87. data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +7 -0
  88. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +4 -4
  89. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb +6 -0
  90. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +1 -1
  91. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +8 -2
  92. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +18 -0
  93. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +3 -2
  94. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string.rb +4 -0
  95. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +9 -0
  96. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +6 -2
  97. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +53 -0
  98. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  99. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/inflector_spec.rb +15 -0
  100. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +46 -0
  101. metadata +61 -18
  102. data/lib/avm/stereotypes/eac_rails_base0/apache_host.rb +0 -19
  103. data/lib/avm/stereotypes/eac_rails_base0/deploy.rb +0 -52
  104. data/lib/avm/stereotypes/eac_rails_base0/instance.rb +0 -16
  105. data/lib/avm/stereotypes/eac_webapp_base0/apache_host.rb +0 -97
  106. data/lib/avm/stereotypes/eac_webapp_base0/deploy.rb +0 -104
  107. data/lib/avm/stereotypes/eac_webapp_base0/deploy/appended_directories.rb +0 -27
  108. data/lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb +0 -43
  109. data/lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb +0 -51
  110. data/lib/avm/stereotypes/eac_webapp_base0/deploy/version.rb +0 -22
  111. data/lib/avm/stereotypes/eac_webapp_base0/instance.rb +0 -52
  112. data/lib/avm/stereotypes/eac_webapp_base0/runner/data.rb +0 -27
  113. data/lib/avm/stereotypes/eac_webapp_base0/runner/data/dump.rb +0 -71
  114. data/lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb +0 -68
  115. data/lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb +0 -61
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/instances/entry_keys'
4
- require 'avm/stereotypes/eac_webapp_base0/instance'
4
+ require 'avm/eac_webapp_base0/instance'
5
5
 
6
6
  module Avm
7
7
  module Stereotypes
8
8
  module EacWordpressBase0
9
- class Instance < ::Avm::Stereotypes::EacWebappBase0::Instance
9
+ class Instance < ::Avm::EacWebappBase0::Instance
10
10
  FILES_UNITS = { uploads: 'wp-content/uploads', themes: 'wp-content/themes' }.freeze
11
11
 
12
12
  def database_unit
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'eac_ruby_utils/console/docopt_runner'
4
4
  require 'eac_ruby_utils/simple_cache'
5
- require 'avm/stereotypes/eac_rails_base0/instance'
5
+ require 'avm/eac_rails_base0/instance'
6
6
  require 'eac_ruby_utils/require_sub'
7
7
  ::EacRubyUtils.require_sub(__FILE__)
8
8
 
@@ -26,7 +26,7 @@ module Avm
26
26
  private
27
27
 
28
28
  def instance_uncached
29
- ::Avm::Stereotypes::EacRailsBase0::Instance.by_id(options['<instance_id>'])
29
+ ::Avm::EacRailsBase0::Instance.by_id(options['<instance_id>'])
30
30
  end
31
31
  end
32
32
  end
@@ -1,37 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/eac_webapp_base0/runner/apache_host'
3
4
  require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/console/speaker'
5
- require 'avm/stereotypes/eac_rails_base0/apache_host'
5
+ require 'avm/eac_rails_base0/apache_host'
6
6
 
7
7
  module Avm
8
8
  module Tools
9
9
  class Runner < ::EacRubyUtils::Console::DocoptRunner
10
10
  class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
11
- class ApacheHost < ::EacRubyUtils::Console::DocoptRunner
12
- include ::EacRubyUtils::Console::Speaker
13
-
14
- DOC = <<~DOCOPT
15
- Deploy for EacRailsBase0 instance.
16
-
17
- Usage:
18
- __PROGRAM__ [options]
19
- __PROGRAM__ -h | --help
20
-
21
- Options:
22
- -h --help Show this screen.
23
- DOCOPT
24
-
25
- def run
26
- result = ::Avm::Stereotypes::EacRailsBase0::ApacheHost.new(
27
- context(:instance)
28
- ).run
29
- if result.error?
30
- fatal_error result.to_s
31
- else
32
- infov 'Result', result.label
33
- end
34
- end
11
+ class ApacheHost < ::Avm::EacWebappBase0::Runner::ApacheHost
35
12
  end
36
13
  end
37
14
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/stereotypes/eac_webapp_base0/runner/data'
3
+ require 'avm/eac_webapp_base0/runner/data'
4
4
  require 'eac_ruby_utils/console/docopt_runner'
5
5
 
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner < ::EacRubyUtils::Console::DocoptRunner
9
9
  class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
10
- class Data < ::Avm::Stereotypes::EacWebappBase0::Runner::Data
10
+ class Data < ::Avm::EacWebappBase0::Runner::Data
11
11
  end
12
12
  end
13
13
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/stereotypes/eac_rails_base0/deploy'
4
- require 'avm/stereotypes/eac_webapp_base0/runner/deploy'
3
+ require 'avm/eac_rails_base0/deploy'
4
+ require 'avm/eac_webapp_base0/runner/deploy'
5
5
 
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner < ::EacRubyUtils::Console::DocoptRunner
9
9
  class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
10
- class Deploy < ::Avm::Stereotypes::EacWebappBase0::Runner::Deploy
10
+ class Deploy < ::Avm::EacWebappBase0::Runner::Deploy
11
11
  end
12
12
  end
13
13
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/stereotypes/eac_webapp_base0/runner/data'
3
+ require 'avm/eac_webapp_base0/runner/data'
4
4
  require 'eac_ruby_utils/console/docopt_runner'
5
5
 
6
6
  module Avm
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/stereotypes/eac_webapp_base0/runner/data/dump'
3
+ require 'avm/eac_webapp_base0/runner/data/dump'
4
4
 
5
5
  module Avm
6
6
  module Tools
7
7
  class Runner < ::EacRubyUtils::Console::DocoptRunner
8
8
  class EacRedmineBase0 < ::EacRubyUtils::Console::DocoptRunner
9
9
  class Data < ::EacRubyUtils::Console::DocoptRunner
10
- class Dump < ::Avm::Stereotypes::EacWebappBase0::Runner::Data::Dump
10
+ class Dump < ::Avm::EacWebappBase0::Runner::Data::Dump
11
11
  end
12
12
  end
13
13
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_redmine_base0/deploy'
4
- require 'avm/stereotypes/eac_webapp_base0/runner/deploy'
4
+ require 'avm/eac_webapp_base0/runner/deploy'
5
5
 
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner < ::EacRubyUtils::Console::DocoptRunner
9
9
  class EacRedmineBase0 < ::EacRubyUtils::Console::DocoptRunner
10
- class Deploy < ::Avm::Stereotypes::EacWebappBase0::Runner::Deploy
10
+ class Deploy < ::Avm::EacWebappBase0::Runner::Deploy
11
11
  end
12
12
  end
13
13
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/rails/runners/runner'
3
4
  require 'eac_cli/default_runner'
4
5
 
5
6
  module Avm
@@ -1,37 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/eac_webapp_base0/runner/apache_host'
4
+ require 'eac_cli/default_runner'
3
5
  require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/console/speaker'
5
6
  require 'avm/stereotypes/eac_wordpress_base0/apache_host'
6
7
 
7
8
  module Avm
8
9
  module Tools
9
10
  class Runner < ::EacRubyUtils::Console::DocoptRunner
10
11
  class EacWordpressBase0 < ::EacRubyUtils::Console::DocoptRunner
11
- class ApacheHost < ::EacRubyUtils::Console::DocoptRunner
12
- include ::EacRubyUtils::Console::Speaker
13
-
14
- DOC = <<~DOCOPT
15
- Configure Apache virtual host for EacWordpressBase0 instance.
16
-
17
- Usage:
18
- __PROGRAM__ [options]
19
- __PROGRAM__ -h | --help
20
-
21
- Options:
22
- -h --help Show this screen.
23
- DOCOPT
24
-
25
- def run
26
- result = ::Avm::Stereotypes::EacWordpressBase0::ApacheHost.new(
27
- context(:instance)
28
- ).run
29
- if result.error?
30
- fatal_error result.to_s
31
- else
32
- infov 'Result', result.label
33
- end
34
- end
12
+ class ApacheHost < ::Avm::EacWebappBase0::Runner::ApacheHost
35
13
  end
36
14
  end
37
15
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/stereotypes/eac_webapp_base0/runner/data'
3
+ require 'avm/eac_webapp_base0/runner/data'
4
4
  require 'eac_ruby_utils/console/docopt_runner'
5
5
 
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner < ::EacRubyUtils::Console::DocoptRunner
9
9
  class EacWordpressBase0 < ::EacRubyUtils::Console::DocoptRunner
10
- class Data < ::Avm::Stereotypes::EacWebappBase0::Runner::Data
10
+ class Data < ::Avm::EacWebappBase0::Runner::Data
11
11
  end
12
12
  end
13
13
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/stereotypes/eac_webapp_base0/runner/deploy'
3
+ require 'avm/eac_webapp_base0/runner/deploy'
4
4
  require 'avm/stereotypes/eac_wordpress_base0/deploy'
5
5
 
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner < ::EacRubyUtils::Console::DocoptRunner
9
9
  class EacWordpressBase0 < ::EacRubyUtils::Console::DocoptRunner
10
- class Deploy < ::Avm::Stereotypes::EacWebappBase0::Runner::Deploy
10
+ class Deploy < ::Avm::EacWebappBase0::Runner::Deploy
11
11
  end
12
12
  end
13
13
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.67.0'
5
+ VERSION = '0.69.3'
6
6
  end
7
7
  end
@@ -12,7 +12,7 @@ module EacLauncher
12
12
  r = find_parent_instance(instance.parent)
13
13
  return r if r
14
14
 
15
- ::EacLauncher::Instances::Errors::Base.new('Git parent not found')
15
+ ::Avm::Launcher::Errors::Base.new('Git parent not found')
16
16
  end
17
17
 
18
18
  def find_parent_instance(current)
@@ -35,7 +35,7 @@ module EacLauncher
35
35
 
36
36
  def check_with_rescue
37
37
  internal_check
38
- rescue ::EacLauncher::Instances::Errors::Base => e
38
+ rescue ::Avm::Launcher::Errors::Base => e
39
39
  ::EacLauncher::Publish::CheckResult.blocked("Error: #{e}")
40
40
  rescue ::EacLauncher::Git::Error => e
41
41
  ::EacLauncher::Publish::CheckResult.blocked("Git error: #{e}")
@@ -1,4 +1,4 @@
1
- FROM ruby:2.4
1
+ FROM ruby:2.5
2
2
  RUN gem install avm-tools
3
3
 
4
4
  RUN apt-get update && apt-get -y --no-install-recommends install \
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'eac_cli/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'eac_cli'
9
+ s.version = ::EacCli::VERSION
10
+ s.authors = ['Esquilo Azul Company']
11
+ s.summary = 'Utilities to build CLI applications with Ruby.'
12
+
13
+ s.files = Dir['{lib}/**/*', 'Gemfile']
14
+
15
+ s.add_dependency 'eac_ruby_utils', '~> 0.45'
16
+
17
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
18
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacCli
6
+ require_sub __FILE__
7
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_cli/patches'
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/runner_with/help'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module EacCli
7
+ module DefaultRunner
8
+ common_concern do
9
+ include ::EacCli::RunnerWith::Help
10
+ enable_console_speaker
11
+ enable_simple_cache
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,72 @@
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
+ require 'eac_ruby_utils/core_ext'
7
+
8
+ module EacCli
9
+ class Definition
10
+ require_sub __FILE__
11
+ attr_accessor :description
12
+ attr_accessor :options_argument
13
+
14
+ def initialize
15
+ self.description = '-- NO DESCRIPTION SET --'
16
+ self.options_argument = true
17
+ end
18
+
19
+ def alt(&block)
20
+ r = ::EacCli::Definition.new
21
+ r.instance_eval(&block)
22
+ alternatives << r
23
+ r
24
+ end
25
+
26
+ 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
+ )
34
+ end
35
+
36
+ def bool_opt(short, long, description, option_options = {})
37
+ options << ::EacCli::Definition::BooleanOption.new(short, long, description, option_options)
38
+ end
39
+
40
+ def desc(description)
41
+ self.description = description
42
+ end
43
+
44
+ def options_arg(options_argument)
45
+ self.options_argument = options_argument
46
+ end
47
+
48
+ def options
49
+ @options ||= []
50
+ end
51
+
52
+ def pos_arg(name, arg_options = {})
53
+ positional << ::EacCli::Definition::PositionalArgument.new(name, arg_options)
54
+ end
55
+
56
+ def positional
57
+ @positional ||= []
58
+ end
59
+
60
+ def subcommands
61
+ positional << ::EacCli::Definition::PositionalArgument.new('subcommand', subcommand: true)
62
+ end
63
+
64
+ def options_first(enable = true)
65
+ @options_first = enable
66
+ end
67
+
68
+ def options_first?
69
+ @options_first ? true : false
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/definition/base_option'
4
+
5
+ module EacCli
6
+ class Definition
7
+ class ArgumentOption < ::EacCli::Definition::BaseOption
8
+ def argument?
9
+ true
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacCli
6
+ class Definition
7
+ class BaseOption
8
+ attr_reader :short, :long, :description, :options
9
+
10
+ def initialize(short, long, description, options = {})
11
+ @short = short
12
+ @long = long
13
+ @description = description
14
+ @options = options.with_indifferent_access
15
+ end
16
+
17
+ def identifier
18
+ long.to_s.variableize.to_sym
19
+ end
20
+
21
+ def show_on_usage?
22
+ options[:usage]
23
+ end
24
+ end
25
+ end
26
+ end