avm-tools 0.94.2 → 0.98.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/app_src.rb +60 -0
  3. data/lib/avm/core_ext.rb +4 -0
  4. data/lib/avm/docker/runner.rb +22 -30
  5. data/lib/avm/eac_asciidoctor_base0/deploy.rb +5 -5
  6. data/lib/avm/eac_rails_base1/runner/bundle.rb +0 -1
  7. data/lib/avm/eac_rails_base1/runner/code_runner.rb +0 -1
  8. data/lib/avm/eac_rails_base1/runner/rails_server.rb +0 -1
  9. data/lib/avm/eac_webapp_base0/instance.rb +5 -2
  10. data/lib/avm/eac_webapp_base0/instance/subcommand_parent.rb +24 -0
  11. data/lib/avm/eac_webapp_base0/runner/data.rb +1 -0
  12. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +1 -1
  13. data/lib/avm/eac_webapp_base0/runner/data/load.rb +1 -1
  14. data/lib/avm/git/issue/complete/_test.rb +2 -2
  15. data/lib/avm/instances/base.rb +6 -12
  16. data/lib/avm/instances/base/entry_keys.rb +17 -0
  17. data/lib/{eac_launcher → avm/launcher}/instances/error.rb +0 -0
  18. data/lib/avm/launcher/instances/runner_helper.rb +41 -0
  19. data/lib/avm/patches/class.rb +4 -0
  20. data/lib/avm/patches/eac_ruby_gems_utils.rb +4 -0
  21. data/lib/avm/patches/eac_ruby_gems_utils/gem.rb +2 -2
  22. data/lib/avm/patches/object.rb +4 -0
  23. data/lib/avm/patches/object/fs_cache.rb +16 -0
  24. data/lib/avm/ruby/bundler.rb +11 -0
  25. data/lib/avm/ruby/bundler/incompatible_parser.rb +25 -0
  26. data/lib/avm/ruby/bundler/incompatible_parser/depends_on.rb +25 -0
  27. data/lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb +39 -0
  28. data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +19 -0
  29. data/lib/avm/ruby/bundler/incompatible_parser/line_buffer.rb +73 -0
  30. data/lib/avm/ruby/bundler/incompatible_parser/line_factory.rb +31 -0
  31. data/lib/avm/ruby/bundler/incompatible_parser/line_parser_base.rb +19 -0
  32. data/lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb +26 -0
  33. data/lib/avm/ruby/gems/generator.rb +1 -5
  34. data/lib/avm/ruby/rubocop/_configured.rb +2 -2
  35. data/lib/avm/tools/runner/{local_project.rb → app_src.rb} +3 -3
  36. data/lib/avm/tools/runner/app_src/eac_asciidoctor_base0.rb +14 -0
  37. data/lib/avm/tools/runner/{local_project → app_src}/eac_asciidoctor_base0/build.rb +19 -7
  38. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0.rb +1 -2
  39. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_chapters.rb +1 -2
  40. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_single.rb +1 -2
  41. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/info.rb +1 -2
  42. data/lib/avm/tools/runner/app_src/info.rb +22 -0
  43. data/lib/avm/tools/runner/{local_project → app_src}/ruby.rb +1 -1
  44. data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler.rb +1 -1
  45. data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler/gemfile_lock.rb +1 -1
  46. data/lib/avm/tools/runner/app_src/ruby/bundler/incompatible.rb +84 -0
  47. data/lib/avm/tools/runner/{local_project → app_src}/test.rb +6 -9
  48. data/lib/avm/tools/runner/app_src/update.rb +22 -0
  49. data/lib/avm/tools/runner/{local_project → app_src}/version_bump.rb +1 -1
  50. data/lib/avm/tools/runner/eac_asciidoctor_base0.rb +0 -1
  51. data/lib/avm/tools/runner/eac_rails_base0.rb +0 -1
  52. data/lib/avm/tools/runner/eac_redmine_base0.rb +0 -1
  53. data/lib/avm/tools/runner/eac_wordpress_base0.rb +0 -1
  54. data/lib/avm/tools/runner/eac_writings_base0.rb +0 -1
  55. data/lib/avm/tools/runner/git.rb +0 -1
  56. data/lib/avm/tools/runner/git/commit.rb +0 -1
  57. data/lib/avm/tools/runner/git/dirty_files.rb +17 -22
  58. data/lib/avm/tools/runner/git/issue.rb +21 -36
  59. data/lib/avm/tools/runner/git/organize.rb +6 -9
  60. data/lib/avm/tools/runner/git/revisions_test.rb +14 -25
  61. data/lib/avm/tools/runner/git/subrepo.rb +3 -6
  62. data/lib/avm/tools/runner/git/subrepo/check.rb +10 -13
  63. data/lib/avm/tools/runner/git/subrepo/clone.rb +2 -3
  64. data/lib/avm/tools/runner/git/subrepo/fix.rb +2 -3
  65. data/lib/avm/tools/runner/launcher.rb +3 -6
  66. data/lib/avm/tools/runner/launcher/instances.rb +10 -21
  67. data/lib/avm/tools/runner/launcher/projects.rb +10 -18
  68. data/lib/avm/tools/runner/launcher/publish.rb +18 -26
  69. data/lib/avm/tools/runner/ruby/rubocop.rb +9 -25
  70. data/lib/avm/tools/runner/self.rb +7 -15
  71. data/lib/avm/tools/runner/self/docker.rb +1 -1
  72. data/lib/avm/tools/version.rb +1 -1
  73. data/lib/eac_launcher/instances.rb +1 -1
  74. data/template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb +1 -5
  75. data/template/avm/ruby/gems/generator/static/spec/spec_helper.rb +2 -0
  76. data/vendor/avm-apps/avm-apps.gemspec +1 -1
  77. data/vendor/avm-apps/lib/avm/apps/sources/configuration.rb +57 -0
  78. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_locale.rb +18 -0
  79. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_rubocop.rb +26 -0
  80. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_tests.rb +29 -0
  81. data/vendor/avm-apps/lib/avm/apps/version.rb +1 -1
  82. data/vendor/avm-apps/spec/rubocop_spec.rb +1 -5
  83. data/vendor/avm-apps/spec/spec_helper.rb +3 -0
  84. data/vendor/avm-eac_asciidoctor_base0/Gemfile +5 -0
  85. data/vendor/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +20 -0
  86. data/{lib/avm/local_projects.rb → vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0.rb} +1 -1
  87. data/{lib/avm/eac_asciidoctor_base0/project.rb → vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources.rb} +2 -4
  88. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +19 -0
  89. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build.rb +49 -0
  90. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build/file.rb +30 -0
  91. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner.rb +30 -0
  92. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner/build.rb +54 -0
  93. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +7 -0
  94. data/vendor/avm-eac_asciidoctor_base0/spec/rubocop_spec.rb +3 -0
  95. data/vendor/avm-eac_asciidoctor_base0/spec/spec_helper.rb +102 -0
  96. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  97. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +5 -1
  98. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +3 -1
  99. data/vendor/eac_cli/lib/eac_cli/runner/context.rb +2 -1
  100. data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +8 -1
  101. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  102. data/vendor/eac_cli/spec/rubocop_spec.rb +1 -5
  103. data/vendor/eac_cli/spec/spec_helper.rb +3 -0
  104. data/vendor/eac_docker/eac_docker.gemspec +1 -1
  105. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  106. data/vendor/eac_docker/spec/rubocop_spec.rb +1 -5
  107. data/vendor/eac_docker/spec/spec_helper.rb +3 -0
  108. data/vendor/eac_git/eac_git.gemspec +2 -1
  109. data/vendor/eac_git/lib/eac_git/local.rb +4 -0
  110. data/vendor/eac_git/lib/eac_git/local/commit.rb +53 -0
  111. data/vendor/eac_git/lib/eac_git/local/commit/changed_file.rb +46 -0
  112. data/vendor/eac_git/lib/eac_git/local/commit/diff_tree_line.rb +32 -0
  113. data/vendor/eac_git/lib/eac_git/rspec.rb +6 -1
  114. data/{lib/avm/git/spec_helper.rb → vendor/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb} +16 -13
  115. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  116. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec.rb +13 -0
  117. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.source.out +1 -0
  118. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
  119. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.source.out +1 -0
  120. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
  121. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.source.out +1 -0
  122. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
  123. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.source.out +2 -0
  124. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
  125. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
  126. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
  127. data/vendor/eac_git/spec/lib/eac_git/local/commit_spec.rb +58 -0
  128. data/vendor/eac_git/spec/rubocop_spec.rb +1 -5
  129. data/vendor/eac_git/spec/spec_helper.rb +3 -0
  130. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
  131. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +36 -0
  132. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +58 -0
  133. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  134. data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb +81 -0
  135. data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -5
  136. data/vendor/eac_ruby_base0/spec/spec_helper.rb +3 -0
  137. data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +4 -3
  138. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +7 -10
  139. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +9 -2
  140. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  141. data/vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +1 -5
  142. data/vendor/eac_ruby_gems_utils/spec/spec_helper.rb +3 -0
  143. data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +2 -1
  144. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb +6 -0
  145. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/logs.rb +63 -0
  146. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +9 -1
  147. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +3 -2
  148. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +4 -2
  149. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb +10 -0
  150. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +4 -2
  151. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +34 -0
  152. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +10 -29
  153. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +69 -0
  154. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +18 -5
  155. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  156. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +8 -0
  157. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +9 -0
  158. data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -5
  159. data/vendor/eac_ruby_utils/spec/spec_helper.rb +3 -0
  160. metadata +120 -39
  161. data/lib/avm/eac_asciidoctor_base0/build.rb +0 -47
  162. data/lib/avm/eac_asciidoctor_base0/build/file.rb +0 -28
  163. data/lib/avm/instances/configuration.rb +0 -55
  164. data/lib/avm/instances/configuration/_locale.rb +0 -16
  165. data/lib/avm/instances/configuration/_rubocop.rb +0 -24
  166. data/lib/avm/instances/configuration/_tests.rb +0 -27
  167. data/lib/avm/local_projects/instance.rb +0 -62
  168. data/lib/avm/tools/runner/local_project/eac_asciidoctor_base0.rb +0 -32
  169. data/lib/avm/tools/runner/local_project/info.rb +0 -25
  170. data/lib/avm/tools/runner/local_project/update.rb +0 -25
  171. data/lib/eac_launcher/instances/runner_helper.rb +0 -42
  172. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +0 -30
  173. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +0 -53
@@ -2,16 +2,13 @@
2
2
 
3
3
  require 'avm/git/organize/repository'
4
4
  require 'eac_cli/default_runner'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
9
  class Git
11
- class Organize < ::EacRubyUtils::Console::DocoptRunner
12
- include ::EacCli::DefaultRunner
13
-
14
- runner_definition do
10
+ class Organize
11
+ runner_with :help do
15
12
  desc 'Organize branches.'
16
13
  bool_opt '-a', '--all', 'Run all organizations.'
17
14
  bool_opt '-n', '--no', 'Do not run operations.'
@@ -37,7 +34,7 @@ module Avm
37
34
  end
38
35
 
39
36
  def collect?(type)
40
- options.fetch("--#{type}") || options.fetch('--all')
37
+ parsed.fetch(type) || parsed.all?
41
38
  end
42
39
 
43
40
  def collect_references
@@ -58,14 +55,14 @@ module Avm
58
55
  end
59
56
 
60
57
  def run_operations?
61
- return true if options.fetch('--yes')
62
- return false if options.fetch('--no')
58
+ return true if parsed.yes?
59
+ return false if parsed.no?
63
60
 
64
61
  request_input('Confirm operations?', bool: true)
65
62
  end
66
63
 
67
64
  def repository_uncached
68
- ::Avm::Git::Organize::Repository.new(context(:git).eac_git)
65
+ ::Avm::Git::Organize::Repository.new(runner_context.call(:git).eac_git)
69
66
  end
70
67
 
71
68
  def start_banner
@@ -1,32 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/console/docopt_runner'
3
+ require 'avm/core_ext'
5
4
  require 'avm/git/revision_test'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
9
  class Git
11
- class RevisionsTest < ::EacRubyUtils::Console::DocoptRunner
12
- enable_simple_cache
13
- enable_console_speaker
14
-
15
- DOC = <<~DOCOPT
16
- Test multiple revisions until a error is found.
17
-
18
- Usage:
19
- __PROGRAM__ [options]
20
- __PROGRAM__ -h | --help
21
-
22
- Options:
23
- -h --help Mostra esta ajuda.
24
- -c --command=<test-command> Command to test instance.
25
- -n --no-cache Does not use cache.
26
- DOCOPT
10
+ class RevisionsTest
11
+ runner_with :help do
12
+ desc 'Test multiple revisions until a error is found.'
13
+ arg_opt '-c', '--command', 'Command to test instance.'
14
+ bool_opt '-n', '--no-cache', 'Does not use cache.'
15
+ end
27
16
 
28
17
  def run
29
- fatal_error('Repository is dirty') if context(:git).dirty?
18
+ fatal_error('Repository is dirty') if runner_context.call(:git).dirty?
30
19
 
31
20
  return_to_branch_on_end do
32
21
  infov 'Revisions found', revisions.count
@@ -41,11 +30,11 @@ module Avm
41
30
  private
42
31
 
43
32
  def return_to_branch_on_end
44
- current_branch = context(:git).current_branch
33
+ current_branch = runner_context.call(:git).current_branch
45
34
  yield
46
35
  ensure
47
36
  infom "Returning to original branch \"#{current_branch}\""
48
- context(:git).execute!('checkout', current_branch)
37
+ runner_context.call(:git).execute!('checkout', current_branch)
49
38
  end
50
39
 
51
40
  def revision_with_error_uncached
@@ -61,14 +50,14 @@ module Avm
61
50
  end
62
51
 
63
52
  def revisions_uncached
64
- context(:git).execute!('log', '--pretty=format:%H', 'origin/master..HEAD')
65
- .each_line.map(&:strip).reverse.map do |sha1|
66
- ::Avm::Git::RevisionTest.new(context(:git), sha1, test_revision_options)
53
+ runner_context.call(:git).execute!('log', '--pretty=format:%H', 'origin/master..HEAD')
54
+ .each_line.map(&:strip).reverse.map do |sha1|
55
+ ::Avm::Git::RevisionTest.new(runner_context.call(:git), sha1, test_revision_options)
67
56
  end
68
57
  end
69
58
 
70
59
  def test_revision_options
71
- { test_command: options.fetch('--command'), no_cache: options.fetch('--no-cache') }
60
+ { test_command: parsed.command, no_cache: parsed.no_cache? }
72
61
  end
73
62
  end
74
63
  end
@@ -1,17 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/default_runner'
4
- require 'eac_ruby_utils/console/docopt_runner'
3
+ require 'avm/core_ext'
5
4
 
6
5
  module Avm
7
6
  module Tools
8
7
  class Runner
9
8
  class Git
10
- class Subrepo < ::EacRubyUtils::Console::DocoptRunner
9
+ class Subrepo
11
10
  require_sub __FILE__
12
- include ::EacCli::DefaultRunner
13
-
14
- runner_definition do
11
+ runner_with :help, :subcommands do
15
12
  desc 'Git-subrepo (https://github.com/ingydotnet/git-subrepo) utilities.'
16
13
  subcommands
17
14
  end
@@ -1,18 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/default_runner'
3
+ require 'avm/core_ext'
4
4
  require 'eac_git/local'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
9
  class Git
11
- class Subrepo < ::EacRubyUtils::Console::DocoptRunner
12
- class Check < ::EacRubyUtils::Console::DocoptRunner
13
- include ::EacCli::DefaultRunner
14
-
15
- runner_definition do
10
+ class Subrepo
11
+ class Check
12
+ runner_with :help do
16
13
  desc 'Check status of subrepos.'
17
14
  bool_opt '-a', '--all', 'Select all subrepos.'
18
15
  bool_opt '-f', '--fix-parent', 'Fix parent SHA1.'
@@ -23,7 +20,7 @@ module Avm
23
20
 
24
21
  def run
25
22
  subrepo_checks.show_result
26
- return if options.fetch('--no-error')
23
+ return if parsed.no_error?
27
24
  return unless subrepo_checks.result.error?
28
25
 
29
26
  fatal_error 'Failed'
@@ -33,15 +30,15 @@ module Avm
33
30
 
34
31
  def subrepo_checks_uncached
35
32
  r = ::Avm::Git::SubrepoChecks.new(local_repos)
36
- r.check_remote = options.fetch('--remote')
37
- r.fix_parent = options.fetch('--fix-parent')
38
- r.add_all_subrepos if options.fetch('--all')
39
- r.add_subrepos(*options.fetch('<subrepos>'))
33
+ r.check_remote = parsed.remote?
34
+ r.fix_parent = parsed.fix_parent?
35
+ r.add_all_subrepos if parsed.all?
36
+ r.add_subrepos(*parsed.subrepos)
40
37
  r
41
38
  end
42
39
 
43
40
  def local_repos_uncached
44
- ::EacGit::Local.new(context(:git))
41
+ ::EacGit::Local.new(runner_context.call(:git))
45
42
  end
46
43
  end
47
44
  end
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/core_ext'
3
+ require 'avm/core_ext'
4
4
  require 'eac_git/local'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
9
  class Git
11
- class Subrepo < ::EacRubyUtils::Console::DocoptRunner
10
+ class Subrepo
12
11
  class Clone
13
12
  runner_with :help do
14
13
  desc 'Clone git-subrepo repositories.'
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/core_ext'
3
+ require 'avm/core_ext'
4
4
  require 'eac_git/local'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
9
  class Git
11
- class Subrepo < ::EacRubyUtils::Console::DocoptRunner
10
+ class Subrepo
12
11
  class Fix
13
12
  runner_with :help do
14
13
  desc 'Fix git-subrepos\' parent property.'
@@ -1,16 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/default_runner'
4
- require 'eac_ruby_utils/core_ext'
3
+ require 'avm/core_ext'
5
4
 
6
5
  module Avm
7
6
  module Tools
8
7
  class Runner
9
- class Launcher < ::EacRubyUtils::Console::DocoptRunner
8
+ class Launcher
10
9
  require_sub __FILE__
11
- include ::EacCli::DefaultRunner
12
-
13
- runner_definition do
10
+ runner_with :help, :subcommands do
14
11
  desc 'Utilities to deploy applications and libraries.'
15
12
  subcommands
16
13
  end
@@ -1,28 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_launcher/instances/runner_helper'
3
+ require 'avm/launcher/instances/runner_helper'
4
4
 
5
5
  module Avm
6
6
  module Tools
7
7
  class Runner
8
- class Launcher < ::EacRubyUtils::Console::DocoptRunner
9
- class Instances < ::EacLauncher::Instances::RunnerHelper
10
- DOC = <<~DOCOPT
11
- Mostra informações sobre instâncias.
12
-
13
- Usage:
14
- __PROGRAM__ [options] [<instance_path>...]
15
- __PROGRAM__ -h | --help
16
-
17
- Options:
18
- -h --help Show this screen.
19
- --all Get all instances.
20
- --recache Rewrite instances cache.
21
-
22
- DOCOPT
8
+ class Launcher
9
+ class Instances < ::Avm::Launcher::Instances::RunnerHelper
10
+ runner_with :help do
11
+ desc 'Mostra informações sobre instâncias.'
12
+ bool_opt '--recache', 'Rewrite instances cache.'
13
+ bool_opt '--all', 'Get all instances.'
14
+ pos_arg :instance_path, repeat: true, optional: true
15
+ end
23
16
 
24
17
  def run
25
- ::EacLauncher::Context.current.recache = options['--recache']
18
+ ::EacLauncher::Context.current.recache = parsed.recache?
26
19
  instances.each { |i| show_instance(i) }
27
20
  end
28
21
 
@@ -34,10 +27,6 @@ module Avm
34
27
  infov(' * Git current revision', instance.options.git_current_revision)
35
28
  infov(' * Git publish remote', instance.options.git_publish_remote)
36
29
  end
37
-
38
- def instance_path
39
- options['<instance_path>']
40
- end
41
30
  end
42
31
  end
43
32
  end
@@ -1,29 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_launcher/context'
4
- require 'eac_launcher/instances/runner_helper'
4
+ require 'avm/launcher/instances/runner_helper'
5
5
 
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner
9
- class Launcher < ::EacRubyUtils::Console::DocoptRunner
10
- class Projects < ::EacLauncher::Instances::RunnerHelper
11
- DOC = <<~DOCOPT
12
- Shows available projects.
13
-
14
- Usage:
15
- __PROGRAM__ [options]
16
- __PROGRAM__ -h | --help
17
-
18
- Options:
19
- -h --help Show this screen.
20
- -i --instances Show instances.
21
- --recache Rewrite instances cache.
22
-
23
- DOCOPT
9
+ class Launcher
10
+ class Projects < ::Avm::Launcher::Instances::RunnerHelper
11
+ runner_with :help do
12
+ desc 'Shows available projects.'
13
+ bool_opt '--recache', 'Rewrite instances cache.'
14
+ bool_opt '-i', '--instances', 'Show instances.'
15
+ end
24
16
 
25
17
  def run
26
- ::EacLauncher::Context.current.recache = options['--recache']
18
+ ::EacLauncher::Context.current.recache = parsed.recache?
27
19
  ::EacLauncher::Context.current.projects.each do |p|
28
20
  show_project(p)
29
21
  end
@@ -33,7 +25,7 @@ module Avm
33
25
 
34
26
  def show_project(project)
35
27
  puts project_label(project)
36
- return unless options['--instances']
28
+ return unless parsed.instances?
37
29
 
38
30
  project.instances.each do |i|
39
31
  puts " * #{instance_label(i)}"
@@ -1,33 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_launcher/instances/runner_helper'
3
+ require 'avm/launcher/instances/runner_helper'
4
4
 
5
5
  module Avm
6
6
  module Tools
7
7
  class Runner
8
- class Launcher < ::EacRubyUtils::Console::DocoptRunner
9
- class Publish < ::EacLauncher::Instances::RunnerHelper
10
- DOC = <<~DOCOPT
11
- Publica projetos ou instâncias.
12
-
13
- Usage:
14
- __PROGRAM__ [options] [<instance_path>...]
15
- __PROGRAM__ -h | --help
16
-
17
- Options:
18
- -h --help Show this screen.
19
- --new Publish projects not published before.
20
- -s --stereotype=<st> Publish only for stereotype <stereotype>.
21
- --all Publish all instances.
22
- -d --dry-run "Dry run" publishing.
23
- --pending Publish only pending.
24
- --recache Rewrite instances cache.
25
- --run Confirm publishing.
26
-
27
- DOCOPT
8
+ class Launcher
9
+ class Publish < ::Avm::Launcher::Instances::RunnerHelper
10
+ runner_with :help do
11
+ desc 'Publica projetos ou instâncias.'
12
+ bool_opt '--all', 'Get all instances.'
13
+ bool_opt '-d', '--dry-run', '"Dry run" publishing.'
14
+ bool_opt '--new', 'Publish projects not published before.'
15
+ bool_opt '--pending', 'Publish only pending.'
16
+ bool_opt '--recache', 'Rewrite instances cache.'
17
+ bool_opt '--run', 'Confirm publishing.'
18
+ arg_opt '-s', '--stereotype', 'Publish only for stereotype <stereotype>.'
19
+ pos_arg :instance_path, repeat: true, optional: true
20
+ end
28
21
 
29
22
  def run
30
- ::EacLauncher::Context.current.recache = options['--recache']
23
+ ::EacLauncher::Context.current.recache = parsed.recache?
31
24
  build_publish_options
32
25
  instances.each do |i|
33
26
  next unless i.options.publishable?
@@ -39,7 +32,7 @@ module Avm
39
32
  private
40
33
 
41
34
  def dry_run?
42
- options.fetch('--dry-run')
35
+ parsed.dry_run?
43
36
  end
44
37
 
45
38
  def instance_method
@@ -51,12 +44,11 @@ module Avm
51
44
  end
52
45
 
53
46
  def publish_options
54
- { new: options.fetch('--new'), stereotype: options.fetch('--stereotype'),
55
- confirm: run? }
47
+ { new: parsed.new?, stereotype: parsed.stereotype?, confirm: run? }
56
48
  end
57
49
 
58
50
  def run?
59
- options.fetch('--run') && !dry_run?
51
+ parsed.run? && !dry_run?
60
52
  end
61
53
  end
62
54
  end
@@ -1,43 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/core_ext'
3
4
  require 'avm/ruby/rubocop'
4
- require 'eac_ruby_utils/console/docopt_runner'
5
- require 'eac_ruby_utils/core_ext'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
9
  class Ruby
11
- class Rubocop < ::EacRubyUtils::Console::DocoptRunner
12
- include ::EacRubyUtils::Console::Speaker
13
- include ::EacRubyUtils::SimpleCache
14
-
15
- DOC = <<~DOCOPT
16
- Runs Rubocop (https://rubygems.org/gems/rubocop).
17
-
18
- Usage:
19
- __PROGRAM__ [options] [<rubocop-args>...]
20
- __PROGRAM__ -h | --help
21
-
22
- Options:
23
- -h --help Show this screen.
24
- -C=<path> Caminho para executar o Rubocop [default: .].
25
- DOCOPT
10
+ class Rubocop
11
+ runner_with :help do
12
+ desc 'Runs Rubocop (https://rubygems.org/gems/rubocop).'
13
+ arg_opt '-C', 'Caminho para executar o Rubocop [default: .].'
14
+ pos_arg :rubocop_args, repeat: true, optional: true
15
+ end
26
16
 
27
17
  def run
28
- ::Avm::Ruby::Rubocop.new(path, rubocop_args).run
18
+ ::Avm::Ruby::Rubocop.new(path, parsed.rubocop_args).run
29
19
  end
30
20
 
31
21
  private
32
22
 
33
23
  def path
34
- ::Pathname.new(options.fetch('-C')).expand_path
35
- end
36
-
37
- def rubocop_args
38
- r = options.fetch('<rubocop-args>')
39
- r.shift if r.first == '--'
40
- r
24
+ ::Pathname.new(parsed.c || '.').expand_path
41
25
  end
42
26
  end
43
27
  end