avm-tools 0.97.0 → 0.98.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/docker/runner.rb +22 -30
  3. data/lib/avm/eac_rails_base1/runner/bundle.rb +0 -1
  4. data/lib/avm/eac_rails_base1/runner/code_runner.rb +0 -1
  5. data/lib/avm/eac_rails_base1/runner/rails_server.rb +0 -1
  6. data/lib/avm/launcher/instances/runner_helper.rb +2 -3
  7. data/lib/avm/tools/runner/app_src/eac_asciidoctor_base0.rb +2 -20
  8. data/lib/avm/tools/runner/app_src/eac_writings_base0.rb +0 -1
  9. data/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb +0 -1
  10. data/lib/avm/tools/runner/app_src/eac_writings_base0/build_single.rb +0 -1
  11. data/lib/avm/tools/runner/app_src/eac_writings_base0/info.rb +0 -1
  12. data/lib/avm/tools/runner/app_src/info.rb +5 -8
  13. data/lib/avm/tools/runner/app_src/test.rb +5 -8
  14. data/lib/avm/tools/runner/app_src/update.rb +5 -8
  15. data/lib/avm/tools/runner/eac_asciidoctor_base0.rb +0 -1
  16. data/lib/avm/tools/runner/eac_rails_base0.rb +0 -1
  17. data/lib/avm/tools/runner/eac_redmine_base0.rb +0 -1
  18. data/lib/avm/tools/runner/eac_wordpress_base0.rb +0 -1
  19. data/lib/avm/tools/runner/eac_writings_base0.rb +0 -1
  20. data/lib/avm/tools/runner/git.rb +0 -1
  21. data/lib/avm/tools/runner/git/commit.rb +0 -1
  22. data/lib/avm/tools/runner/git/dirty_files.rb +17 -22
  23. data/lib/avm/tools/runner/git/issue.rb +21 -36
  24. data/lib/avm/tools/runner/git/organize.rb +6 -9
  25. data/lib/avm/tools/runner/git/revisions_test.rb +14 -25
  26. data/lib/avm/tools/runner/git/subrepo.rb +3 -6
  27. data/lib/avm/tools/runner/git/subrepo/check.rb +10 -13
  28. data/lib/avm/tools/runner/git/subrepo/clone.rb +2 -3
  29. data/lib/avm/tools/runner/git/subrepo/fix.rb +2 -3
  30. data/lib/avm/tools/runner/launcher/publish.rb +1 -1
  31. data/lib/avm/tools/version.rb +1 -1
  32. data/vendor/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +1 -0
  33. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +4 -0
  34. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner.rb +30 -0
  35. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner/build.rb +54 -0
  36. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
  37. metadata +32 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f1e0a305ededda2855b91810dc19b61599d5160877ec4ce3ed6f30fef7fba53
4
- data.tar.gz: 30b9f99be2526baec4a9f9c47717689a7addbfb554d81f7d8100aafbf4fb9e7b
3
+ metadata.gz: 2a8cd450cfc4285226ff31b7a2183ae8cb87c3cb3b688548251bd5b92c25f9c3
4
+ data.tar.gz: 4865bc83bfa9a0f04c76fce01c546d3c8df123f63647d4fdbcd6ebfc9389aaed
5
5
  SHA512:
6
- metadata.gz: 01aad2b75c533011cca20448bb5df00608d43124c905844d1f7c3bf9aa3a8f2c23258e3ad630df9c8fe32591f4d7e620253f9e7e2724e8ffebe89dcbc049c992
7
- data.tar.gz: e94c3356ab0c629d8ba0c02e091fdb2da88cb9c4441142be581628abe2585e02af117177c255a436e64a1d7010ed0e3ce985ac25d689e17b84ecb473cd329af6
6
+ metadata.gz: 8bfbd03718cedd613906c9c550db8d1ac5ff05a4e904bce261d13382bbb20f10d7e5ab72de57f396499f5616356a7419b2fca3a65ed7fa7a3d8f7d6e0ff48841
7
+ data.tar.gz: 97fbf67954eca6d3e64d8165c6c523a092a3b50442d506858ea412a7c1849285b7d90364679773a91927b6298d1b01fad73bbcb5edadb73bf1cf2a59608c3033
@@ -1,33 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/core_ext'
3
+ require 'avm/core_ext'
5
4
  require 'avm/docker/registry'
6
5
 
7
6
  module Avm
8
7
  module Docker
9
- class Runner < ::EacRubyUtils::Console::DocoptRunner
8
+ class Runner
10
9
  enable_console_speaker
11
10
  enable_simple_cache
12
11
 
13
- DOC = <<~DOCOPT
14
- Manipulate Docker images.
15
-
16
- Usage:
17
- __PROGRAM__ [options] [-B <build-arg>...] [-E <run-arg>...]
18
- __PROGRAM__ -h | --help
19
-
20
- Options:
21
- -h --help Show this help.
22
- -n --registry-name=<registry-name> Docker registry's name.
23
- -p --push Push the image to Docker registry.
24
- -r --run Run or start a container with builded image.
25
- -B --build-arg=<build-arg> Argument for "docker build".
26
- -E --entrypoint-arg=<run-arg> Argument for entrypoint on "docker run"
27
- -c --clear Remove container if exist before run.
28
- -S --no-snapshot Does not add "-snapshot" to image tag.
29
- -V --no-version Does not add version to image tag.
30
- DOCOPT
12
+ runner_with :help do
13
+ desc 'Manipulate Docker images.'
14
+ arg_opt '-n', '--registry-name', 'Docker registry\'s name.'
15
+ bool_opt '-p', '--push', 'Push the image to Docker registry.'
16
+ bool_opt '-r', '--run', 'Run or start a container with builded image.'
17
+ arg_opt '-B', '--build-arg', 'Argument for "docker build".', repeat: true
18
+ arg_opt '-E', '--entrypoint-arg', 'Argument for entrypoint on "docker run"', repeat: true
19
+ bool_opt '-c', '--clear', 'Remove container if exist before run.'
20
+ bool_opt '-S', '--no-snapshot', 'Does not add "-snapshot" to image tag.'
21
+ bool_opt '-V', '--no-version', 'Does not add version to image tag.'
22
+ end
31
23
 
32
24
  def run
33
25
  setup
@@ -61,42 +53,42 @@ module Avm
61
53
  end
62
54
 
63
55
  def build_args
64
- options.fetch('--build-arg')
56
+ parsed.build_arg
65
57
  end
66
58
 
67
59
  def entrypoint_args
68
- options.fetch('--entrypoint-arg')
60
+ parsed.entrypoint_arg
69
61
  end
70
62
 
71
63
  def push
72
- instance.docker_image.push if options.fetch('--push')
64
+ instance.docker_image.push if parsed.push?
73
65
  end
74
66
 
75
67
  def container_run
76
- return unless options.fetch('--run')
68
+ return unless parsed.run?
77
69
 
78
70
  instance.docker_container.run(
79
71
  entrypoint_args: entrypoint_args,
80
- clear: options.fetch('--clear')
72
+ clear: parsed.clear?
81
73
  )
82
74
  end
83
75
 
84
76
  def registry_uncached
85
- options.fetch('--registry-name').if_present(::Avm::Docker::Registry.default) do |v|
77
+ parsed.registry_name.if_present(::Avm::Docker::Registry.default) do |v|
86
78
  ::Avm::Docker::Registry.new(v)
87
79
  end
88
80
  end
89
81
 
90
82
  def snapshot?
91
- !options.fetch('--no-snapshot')
83
+ !parsed.no_snapshot?
92
84
  end
93
85
 
94
86
  def version?
95
- !options.fetch('--no-version')
87
+ !parsed.no_version?
96
88
  end
97
89
 
98
90
  def instance
99
- context(:instance)
91
+ runner_context.call(:instance)
100
92
  end
101
93
  end
102
94
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_rails_base1/runner_with/bundle'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
  require 'shellwords'
7
6
 
8
7
  module Avm
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_rails_base1/runner_with/bundle'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module EacRailsBase1
@@ -3,7 +3,6 @@
3
3
  require 'avm/eac_rails_base1/runner_with/bundle'
4
4
  require 'avm/instances/entry_keys'
5
5
  require 'eac_cli/core_ext'
6
- require 'eac_ruby_utils/console/docopt_runner'
7
6
  require 'shellwords'
8
7
 
9
8
  module Avm
@@ -1,12 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/console/speaker'
3
+ require 'avm/core_ext'
5
4
 
6
5
  module Avm
7
6
  module Launcher
8
7
  module Instances
9
- class RunnerHelper < ::EacRubyUtils::Console::DocoptRunner
8
+ class RunnerHelper
10
9
  def context
11
10
  @context ||= ::EacLauncher::Context.current
12
11
  end
@@ -1,30 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/core_ext'
4
- require 'eac_ruby_utils/console/docopt_runner'
3
+ require 'avm/eac_asciidoctor_base0/sources/runner'
5
4
 
6
5
  module Avm
7
6
  module Tools
8
7
  class Runner
9
8
  class AppSrc
10
- class EacAsciidoctorBase0
11
- require_sub __FILE__
12
-
13
- runner_with :help, :subcommands do
14
- desc 'EacAsciidoctorBase0 utitilies for local projects.'
15
- subcommands
16
- end
17
-
18
- def project_banner
19
- infov 'Project', project.name
20
- infov 'Path', project.root
21
- end
22
-
23
- private
24
-
25
- def project_uncached
26
- ::Avm::EacWritingsBase0::Project.new(runner_context.call(:instance_path))
27
- end
9
+ class EacAsciidoctorBase0 < ::Avm::EacAsciidoctorBase0::Sources::Runner
28
10
  end
29
11
  end
30
12
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_writings_base0/project'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_writings_base0/project_build'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_writings_base0/project_build'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_writings_base0/project_build'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
@@ -1,22 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_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
8
  class AppSrc
10
- class Info < ::EacRubyUtils::Console::DocoptRunner
11
- include ::EacCli::DefaultRunner
12
-
13
- runner_definition do
9
+ class Info
10
+ runner_with :help do
14
11
  desc 'Show information about local project instance.'
15
12
  end
16
13
 
17
14
  def run
18
- infov 'Path', context(:instance).path
19
- infov 'Stereotypes', context(:instance).stereotypes.map(&:label).join(', ')
15
+ infov 'Path', runner_context.call(:instance).path
16
+ infov 'Stereotypes', runner_context.call(:instance).stereotypes.map(&:label).join(', ')
20
17
  end
21
18
  end
22
19
  end
@@ -1,21 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_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
8
  class AppSrc
10
- class Test < ::EacRubyUtils::Console::DocoptRunner
11
- include ::EacCli::DefaultRunner
12
-
13
- runner_definition do
9
+ class Test
10
+ runner_with :help do
14
11
  desc 'Test local project.'
15
12
  end
16
13
 
17
14
  def run
18
- context(:instance_banner)
15
+ runner_context.call(:instance_banner)
19
16
  infov 'Test command', test_command
20
17
  if test_command.present?
21
18
  test_command.system!
@@ -25,7 +22,7 @@ module Avm
25
22
  end
26
23
 
27
24
  def test_command
28
- context(:instance).configuration.if_present(&:any_test_command)
25
+ runner_context.call(:instance).configuration.if_present(&:any_test_command)
29
26
  end
30
27
  end
31
28
  end
@@ -1,22 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_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
8
  class AppSrc
10
- class Update < ::EacRubyUtils::Console::DocoptRunner
11
- include ::EacCli::DefaultRunner
12
-
13
- runner_definition do
9
+ class Update
10
+ runner_with :help do
14
11
  desc 'Update local project.'
15
12
  end
16
13
 
17
14
  def run
18
- infov 'Path', context(:instance).path
19
- context(:instance).run_job(:update)
15
+ infov 'Path', runner_context.call(:instance).path
16
+ runner_context.call(:instance).run_job(:update)
20
17
  end
21
18
  end
22
19
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_webapp_base0/runner'
4
4
  require 'avm/eac_asciidoctor_base0'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_rails_base0'
4
4
  require 'avm/eac_rails_base1/runner'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
  require 'eac_ruby_utils/core_ext'
7
6
 
8
7
  module Avm
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_rails_base1/runner'
4
4
  require 'avm/eac_redmine_base0'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
  require 'eac_ruby_utils/core_ext'
7
6
 
8
7
  module Avm
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_webapp_base0/runner'
4
4
  require 'avm/eac_wordpress_base0'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
  require 'eac_ruby_utils/core_ext'
7
6
 
8
7
  module Avm
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_webapp_base0/runner'
4
4
  require 'avm/eac_writings_base0'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
3
  require 'eac_ruby_utils/require_sub'
5
4
  require 'eac_launcher/git/base'
6
5
  ::EacRubyUtils.require_sub(__FILE__)
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
3
  require 'eac_ruby_utils/console/speaker'
5
4
  require 'eac_ruby_utils/simple_cache'
6
5
  require 'eac_launcher/git/base'
@@ -1,46 +1,41 @@
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
 
6
5
  module Avm
7
6
  module Tools
8
7
  class Runner
9
8
  class Git
10
- class DirtyFiles < ::EacRubyUtils::Console::DocoptRunner
11
- enable_console_speaker
12
-
9
+ class DirtyFiles
10
+ DEFAULT_FORMAT = '%p'
13
11
  FIELDS = {
14
12
  i: :index, w: :worktree, p: :path, a: :absolute_path
15
13
  }.map { |k, v| ["%#{k}", v] }.to_h
16
14
 
17
- FIELDS_DOC = FIELDS.map { |k, v| " #{k} => #{v}" }.join("\n")
18
-
19
- DOC = <<~DOCOPT
20
- Lists dirty files in Git repository.
21
-
22
- Usage:
23
- __PROGRAM__ [options]
24
- __PROGRAM__ -h | --help
25
-
26
- Options:
27
- -h --help Mostra esta ajuda.
28
- -f --format=<format> Format of each line (See "Format fields") [default: %p].
15
+ runner_with :help do
16
+ desc 'Lists dirty files in Git repository.'
17
+ arg_opt '-f', '--format',
18
+ "Format of each line (See \"Format fields\") [default: #{DEFAULT_FORMAT}]."
19
+ end
29
20
 
30
- Format fields:
31
- #{FIELDS_DOC}
32
- DOCOPT
21
+ def help_extra_text
22
+ "Format fields:\n" + FIELDS.map { |k, v| " #{k} => #{v}" }.join("\n")
23
+ end
33
24
 
34
25
  def run
35
- context(:git).dirty_files.each do |file|
26
+ runner_context.call(:git).dirty_files.each do |file|
36
27
  out("#{format_file(file)}\n")
37
28
  end
38
29
  end
39
30
 
40
31
  private
41
32
 
33
+ def format
34
+ parsed.format || DEFAULT_FORMAT
35
+ end
36
+
42
37
  def format_file(file)
43
- FIELDS.inject(options.fetch('--format')) { |a, e| a.gsub(e.first, file.send(e.last)) }
38
+ FIELDS.inject(format) { |a, e| a.gsub(e.first, file.send(e.last)) }
44
39
  end
45
40
  end
46
41
  end
@@ -1,45 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/console/speaker'
3
+ require 'avm/core_ext'
5
4
  require 'avm/git/issue/complete'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
9
  class Git
11
- class Issue < ::EacRubyUtils::Console::DocoptRunner
12
- enable_simple_cache
13
- include ::EacRubyUtils::Console::Speaker
14
-
15
- DOC = <<~DOCOPT
16
- Closes a issue in a Git repository.
17
-
18
- Usage:
19
- __PROGRAM__ [options] [complete]
20
- __PROGRAM__ -h | --help
21
-
22
- Options:
23
- -h --help Show this screen.
24
- -f --uncomplete-unfail Do not exit with error if issue is not completed
25
- or is invalid.
26
- -s --skip-validations=<validations> Does not validate conditions on <validations>
27
- (Comma separated value).
28
- -y --yes Does not ask for user confirmation.
29
-
30
- Validations:
31
- %%VALIDATIONS%%
32
- DOCOPT
33
-
34
- UNCOMPLETE_MESSAGE =
10
+ class Issue
11
+ runner_with :help do
12
+ desc 'Closes a issue in a Git repository.'
13
+ bool_opt '-f', '--uncomplete-unfail', 'Do not exit with error if issue is not' \
14
+ ' completed or is invalid.'
15
+ arg_opt '-s', '--skip-validations', 'Does not validate conditions on <validations>' \
16
+ ' (Comma separated value).'
17
+ bool_opt '-y', '--yes', 'Does not ask for user confirmation.'
18
+ bool_opt '--complete', 'Run complete task.'
19
+ end
35
20
 
36
- def run
37
- banner
38
- return unless validate
21
+ def run
22
+ banner
23
+ return unless validate
39
24
 
40
- run_complete if options.fetch('complete')
41
- success('Done!')
42
- end
25
+ run_complete if parsed.complete?
26
+ success('Done!')
27
+ end
43
28
 
44
29
  def banner
45
30
  complete.start_banner
@@ -68,15 +53,15 @@ module Avm
68
53
  end
69
54
 
70
55
  def confirm?
71
- options.fetch('--yes') || request_input('Confirm issue completion?', bool: true)
56
+ parsed.yes? || request_input('Confirm issue completion?', bool: true)
72
57
  end
73
58
 
74
59
  def skip_validations
75
- options.fetch('--skip-validations').to_s.split(',').map(&:strip).reject(&:blank?)
60
+ parsed.skip_validations.to_s.split(',').map(&:strip).reject(&:blank?)
76
61
  end
77
62
 
78
63
  def git_complete_issue_options
79
- { dir: context(:repository_path), skip_validations: skip_validations }
64
+ { dir: runner_context.call(:repository_path), skip_validations: skip_validations }
80
65
  end
81
66
 
82
67
  def doc_validations_list
@@ -84,7 +69,7 @@ module Avm
84
69
  end
85
70
 
86
71
  def uncomplete_unfail?
87
- options.fetch('--uncomplete-unfail')
72
+ parsed.uncomplete_unfail?
88
73
  end
89
74
 
90
75
  def uncomplete_message(message)
@@ -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.'
@@ -20,7 +20,7 @@ module Avm
20
20
  end
21
21
 
22
22
  def run
23
- ::EacLauncher::Context.current.recache = parsed.run?
23
+ ::EacLauncher::Context.current.recache = parsed.recache?
24
24
  build_publish_options
25
25
  instances.each do |i|
26
26
  next unless i.options.publishable?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.97.0'
5
+ VERSION = '0.98.0'
6
6
  end
7
7
  end
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
15
  s.add_dependency 'eac_ruby_utils', '~> 0.63'
16
+ s.add_dependency 'os'
16
17
  s.add_dependency 'rouge', '~> 3.26'
17
18
 
18
19
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
@@ -9,6 +9,10 @@ module Avm
9
9
  common_constructor :root do
10
10
  self.root = root.to_pathname
11
11
  end
12
+
13
+ def name
14
+ root.basename.to_s
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_asciidoctor_base0/sources/base'
4
+ require 'eac_ruby_base0/core_ext'
5
+
6
+ module Avm
7
+ module EacAsciidoctorBase0
8
+ module Sources
9
+ class Runner
10
+ require_sub __FILE__
11
+
12
+ runner_with :help, :subcommands do
13
+ desc 'EacAsciidoctorBase0 utitilies for local projects.'
14
+ subcommands
15
+ end
16
+
17
+ def project_banner
18
+ infov 'Project', project.name
19
+ infov 'Path', project.root
20
+ end
21
+
22
+ private
23
+
24
+ def project_uncached
25
+ ::Avm::EacAsciidoctorBase0::Sources::Base.new(runner_context.call(:instance_path))
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_asciidoctor_base0/sources/build'
4
+ require 'eac_ruby_base0/core_ext'
5
+ require 'os'
6
+
7
+ module Avm
8
+ module EacAsciidoctorBase0
9
+ module Sources
10
+ class Runner
11
+ class Build
12
+ runner_with :help do
13
+ desc 'Build the project'
14
+ arg_opt '-d', '--target-dir', 'Directory to build'
15
+ bool_opt '--open', 'Show the result.'
16
+ end
17
+
18
+ def run
19
+ start_banner
20
+ build.run
21
+ open
22
+ end
23
+
24
+ private
25
+
26
+ def build_uncached
27
+ ::Avm::EacAsciidoctorBase0::Sources::Build.new(runner_context.call(:project),
28
+ target_directory: parsed.target_dir)
29
+ end
30
+
31
+ def default_target_directory
32
+ runner_context.call(:project).root.join('build')
33
+ end
34
+
35
+ def open
36
+ return unless parsed.open?
37
+
38
+ infom "Opening \"#{open_path}\"..."
39
+ ::EacRubyUtils::Envs.local.command(OS.open_file_command, open_path).system!
40
+ end
41
+
42
+ def open_path
43
+ build.source_files.first.target_path
44
+ end
45
+
46
+ def start_banner
47
+ runner_context.call(:project_banner)
48
+ infov 'Target directory', build.target_directory
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacAsciidoctorBase0
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.97.0
4
+ version: 0.98.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-14 00:00:00.000000000 Z
11
+ date: 2021-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -44,6 +44,34 @@ dependencies:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: 2.0.12
47
+ - !ruby/object:Gem::Dependency
48
+ name: avm-apps
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.2'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.2'
61
+ - !ruby/object:Gem::Dependency
62
+ name: avm-eac_asciidoctor_base0
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
47
75
  - !ruby/object:Gem::Dependency
48
76
  name: clipboard
49
77
  requirement: !ruby/object:Gem::Requirement
@@ -677,6 +705,8 @@ files:
677
705
  - vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb
678
706
  - vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build.rb
679
707
  - vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build/file.rb
708
+ - vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner.rb
709
+ - vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner/build.rb
680
710
  - vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb
681
711
  - vendor/avm-eac_asciidoctor_base0/spec/rubocop_spec.rb
682
712
  - vendor/avm-eac_asciidoctor_base0/spec/spec_helper.rb