avm-tools 0.95.0 → 0.96.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 (39) 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/instances/base.rb +6 -12
  5. data/lib/avm/instances/base/entry_keys.rb +17 -0
  6. data/lib/{eac_launcher → avm/launcher}/instances/error.rb +0 -0
  7. data/lib/avm/launcher/instances/runner_helper.rb +42 -0
  8. data/lib/avm/patches/class.rb +4 -0
  9. data/lib/avm/patches/eac_ruby_gems_utils.rb +4 -0
  10. data/lib/avm/patches/object.rb +4 -0
  11. data/lib/avm/patches/object/fs_cache.rb +16 -0
  12. data/lib/avm/tools/runner/{local_project.rb → app_src.rb} +3 -3
  13. data/lib/avm/tools/runner/{local_project → app_src}/eac_asciidoctor_base0.rb +1 -1
  14. data/lib/avm/tools/runner/{local_project → app_src}/eac_asciidoctor_base0/build.rb +2 -3
  15. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0.rb +1 -1
  16. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_chapters.rb +1 -1
  17. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_single.rb +1 -1
  18. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/info.rb +1 -1
  19. data/lib/avm/tools/runner/{local_project → app_src}/info.rb +1 -1
  20. data/lib/avm/tools/runner/{local_project → app_src}/ruby.rb +1 -1
  21. data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler.rb +1 -1
  22. data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler/gemfile_lock.rb +1 -1
  23. data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler/incompatible.rb +1 -1
  24. data/lib/avm/tools/runner/{local_project → app_src}/test.rb +1 -1
  25. data/lib/avm/tools/runner/{local_project → app_src}/update.rb +1 -1
  26. data/lib/avm/tools/runner/{local_project → app_src}/version_bump.rb +1 -1
  27. data/lib/avm/tools/runner/launcher.rb +3 -6
  28. data/lib/avm/tools/runner/launcher/instances.rb +10 -21
  29. data/lib/avm/tools/runner/launcher/projects.rb +10 -18
  30. data/lib/avm/tools/runner/launcher/publish.rb +18 -26
  31. data/lib/avm/tools/runner/ruby/rubocop.rb +9 -25
  32. data/lib/avm/tools/runner/self.rb +7 -15
  33. data/lib/avm/tools/runner/self/docker.rb +1 -1
  34. data/lib/avm/tools/version.rb +1 -1
  35. data/lib/eac_launcher/instances.rb +1 -1
  36. metadata +26 -21
  37. data/lib/avm/local_projects.rb +0 -9
  38. data/lib/avm/local_projects/instance.rb +0 -62
  39. data/lib/eac_launcher/instances/runner_helper.rb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43ee05798fe159fe0fffa66e10aa7260aa8e29a7fe7f37786b29a89b051f600b
4
- data.tar.gz: 86dbc1695a7dfe69cf4c33d2d5aae928a7cc05448305e41f4a23205636ea39ff
3
+ metadata.gz: 6ef7523f40504ec0ae7da047ae97a104ee39e70cfc7ce6a799391615e8a62acf
4
+ data.tar.gz: cc8d89ba7e4f9025fd0553f4f4d448d7b11c3a65d07ec5f46646619f7b517baa
5
5
  SHA512:
6
- metadata.gz: 52f50815a47e9373174a9f6b39e64d0f16cc5a6cf2a39f5bd540f1f90f3bbad6e3361607cdd7a37d225f746bb7f36717e99b344fbd35882f64013c33d56b5e51
7
- data.tar.gz: dc15c004e0c6c67ebcaaa7b230c0210c5fbde1ca567a1b405fbea7148732b998f3919c74815be22ded25cd21cffbf4a3e0b6d82406a78e507dc89d6ff4fd41e8
6
+ metadata.gz: 06e6b348ab5fdd9c2df75c7959dc1b9ef6202e44fde8af352603c3f8883de2c5ec5abd46f0fb0f6771e7a78befdf97fd109f17c6622dffb942ae758ac54a3998
7
+ data.tar.gz: 32835edd010fc51fdd12ca6a0c85c4950c946463ec067de823f96d4bb24dc70bfae8e94fe4d1c3cfa66a882b2e8566b0ea3c79bd46ffd9c0a51edd699207deb9
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/configuration'
4
+ require 'eac_launcher/paths/real'
5
+ require 'eac_ruby_utils/core_ext'
6
+ require 'avm/projects/stereotypes'
7
+ require 'i18n'
8
+
9
+ module Avm
10
+ class AppSrc
11
+ enable_simple_cache
12
+ common_constructor :path do
13
+ self.path = path.to_pathname
14
+ source_stereotypes_mixins
15
+ end
16
+
17
+ delegate :to_s, to: :path
18
+
19
+ def locale
20
+ configuration.if_present(&:locale) || ::I18n.default_locale
21
+ end
22
+
23
+ # Backward compatibility with [EacLauncher::Paths::Logical].
24
+ # @return [EacLauncher::Paths::Real].
25
+ def real
26
+ ::EacLauncher::Paths::Real.new(path.to_path)
27
+ end
28
+
29
+ def run_job(job, job_args = [])
30
+ stereotypes.each { |stereotype| run_stereotype_job(stereotype, job, job_args) }
31
+ end
32
+
33
+ private
34
+
35
+ # @return [Avm::Instances::Configuration]
36
+ def configuration_uncached
37
+ ::Avm::Instances::Configuration.find_in_path(path)
38
+ end
39
+
40
+ def run_stereotype_job(stereotype, job, job_args)
41
+ job_class_method = "#{job}_class"
42
+ if stereotype.send(job_class_method).present?
43
+ puts stereotype.label + ": #{job} class found. Running..."
44
+ stereotype.send(job_class_method).new(self, *job_args).run
45
+ else
46
+ puts stereotype.label + ": #{job} class not found"
47
+ end
48
+ end
49
+
50
+ def stereotypes_uncached
51
+ ::Avm::Projects::Stereotypes.list.select { |s| s.match?(self) }
52
+ end
53
+
54
+ def source_stereotypes_mixins
55
+ stereotypes.each do |s|
56
+ s.local_project_mixin_module.if_present { |v| singleton_class.include(v) }
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/patches'
4
+ require 'eac_ruby_base0/core_ext'
@@ -3,16 +3,13 @@
3
3
  require 'eac_ruby_utils/require_sub'
4
4
  require 'eac_ruby_utils/simple_cache'
5
5
  require 'avm/instances/entries'
6
- require 'avm/instances/entry_keys'
7
- ::EacRubyUtils.require_sub(__FILE__)
8
6
 
9
7
  module Avm
10
8
  module Instances
11
9
  class Base
12
- include ::EacRubyUtils::Listable
13
- include ::EacRubyUtils::SimpleCache
14
- include ::Avm::Instances::Base::AutoValues
15
- include ::Avm::Instances::Base::Dockerizable
10
+ enable_listable
11
+ enable_simple_cache
12
+ require_sub __FILE__, include_modules: true
16
13
  include ::Avm::Instances::Entries
17
14
 
18
15
  lists.add_string :access, :local, :ssh
@@ -36,11 +33,8 @@ module Avm
36
33
  end
37
34
  end
38
35
 
39
- attr_reader :application, :suffix
40
-
41
- def initialize(application, suffix)
42
- @application = application
43
- @suffix = suffix.to_s
36
+ common_constructor :application, :suffix do
37
+ self.suffix = suffix.to_s
44
38
  end
45
39
 
46
40
  def id
@@ -63,7 +57,7 @@ module Avm
63
57
  private
64
58
 
65
59
  def source_instance_uncached
66
- ::Avm::Instances::Base.by_id(read_entry(::Avm::Instances::EntryKeys::SOURCE_INSTANCE_ID))
60
+ ::Avm::Instances::Base.by_id(source_instance_id)
67
61
  end
68
62
  end
69
63
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/entry_keys'
4
+
5
+ module Avm
6
+ module Instances
7
+ class Base
8
+ module EntryKeys
9
+ ::Avm::Instances::EntryKeys.all.each do |key|
10
+ define_method key.to_s.variableize do
11
+ read_entry(key)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/console/docopt_runner'
4
+ require 'eac_ruby_utils/console/speaker'
5
+
6
+ module Avm
7
+ module Launcher
8
+ module Instances
9
+ class RunnerHelper < ::EacRubyUtils::Console::DocoptRunner
10
+ def context
11
+ @context ||= ::EacLauncher::Context.current
12
+ end
13
+
14
+ def find_instances(instance_name)
15
+ context.instances.select { |instance| instance_match?(instance, instance_name) }
16
+ end
17
+
18
+ def instance_match?(instance, instance_name)
19
+ ::File.fnmatch?(instance_name, instance.name)
20
+ end
21
+
22
+ def instances
23
+ if parsed.all?
24
+ context.instances
25
+ elsif parsed.pending?
26
+ context.pending_instances
27
+ else
28
+ parsed.instance_path.flat_map { |p| find_instances(p) }
29
+ end
30
+ end
31
+
32
+ def instance_stereotypes(instance)
33
+ instance.stereotypes.map(&:label).join(', ')
34
+ end
35
+
36
+ def instance_label(instance)
37
+ "#{instance.name} [#{instance_stereotypes(instance)}]"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/self'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ class Object
7
+ class << self
8
+ def avm_fs_cache
9
+ ::Avm::Self.application.fs_cache.child(name.variableize)
10
+ end
11
+ end
12
+
13
+ def avm_fs_cache
14
+ self.class.avm_fs_cache.child(avm_fs_cache_object_id)
15
+ end
16
+ end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/local_projects/instance'
3
+ require 'avm/app_src'
4
4
  require 'eac_cli/core_ext'
5
5
 
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner
9
- class LocalProject
9
+ class AppSrc
10
10
  require_sub __FILE__
11
11
  runner_with :help, :subcommands do
12
12
  desc 'Utilities for local projects.'
@@ -22,7 +22,7 @@ module Avm
22
22
  private
23
23
 
24
24
  def instance_uncached
25
- ::Avm::LocalProjects::Instance.new(instance_path)
25
+ ::Avm::AppSrc.new(instance_path)
26
26
  end
27
27
 
28
28
  def instance_path_uncached
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/console/docopt_runner'
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner
9
- class LocalProject
9
+ class AppSrc
10
10
  class EacAsciidoctorBase0
11
11
  require_sub __FILE__
12
12
 
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/core_ext'
3
4
  require 'avm/eac_asciidoctor_base0/build'
4
5
  require 'avm/eac_asciidoctor_base0/project'
5
- require 'eac_cli/core_ext'
6
- require 'eac_ruby_utils/console/docopt_runner'
7
6
 
8
7
  module Avm
9
8
  module Tools
10
9
  class Runner
11
- class LocalProject
10
+ class AppSrc
12
11
  class EacAsciidoctorBase0
13
12
  class Build
14
13
  runner_with :help do
@@ -7,7 +7,7 @@ require 'eac_ruby_utils/console/docopt_runner'
7
7
  module Avm
8
8
  module Tools
9
9
  class Runner
10
- class LocalProject
10
+ class AppSrc
11
11
  class EacWritingsBase0
12
12
  require_sub __FILE__
13
13
  enable_simple_cache
@@ -7,7 +7,7 @@ require 'eac_ruby_utils/console/docopt_runner'
7
7
  module Avm
8
8
  module Tools
9
9
  class Runner
10
- class LocalProject
10
+ class AppSrc
11
11
  class EacWritingsBase0
12
12
  class BuildChapters
13
13
  runner_with :help do
@@ -7,7 +7,7 @@ require 'eac_ruby_utils/console/docopt_runner'
7
7
  module Avm
8
8
  module Tools
9
9
  class Runner
10
- class LocalProject
10
+ class AppSrc
11
11
  class EacWritingsBase0
12
12
  class BuildSingle
13
13
  runner_with :help do
@@ -7,7 +7,7 @@ require 'eac_ruby_utils/console/docopt_runner'
7
7
  module Avm
8
8
  module Tools
9
9
  class Runner
10
- class LocalProject
10
+ class AppSrc
11
11
  class EacWritingsBase0
12
12
  class Info
13
13
  runner_with :help do
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/core_ext'
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner
9
- class LocalProject
9
+ class AppSrc
10
10
  class Info < ::EacRubyUtils::Console::DocoptRunner
11
11
  include ::EacCli::DefaultRunner
12
12
 
@@ -6,7 +6,7 @@ require 'eac_cli/core_ext'
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner
9
- class LocalProject
9
+ class AppSrc
10
10
  class Ruby
11
11
  require_sub __FILE__
12
12
  runner_with :help, :subcommands do
@@ -5,7 +5,7 @@ require 'eac_ruby_base0/core_ext'
5
5
  module Avm
6
6
  module Tools
7
7
  class Runner
8
- class LocalProject
8
+ class AppSrc
9
9
  class Ruby
10
10
  class Bundler
11
11
  require_sub __FILE__
@@ -5,7 +5,7 @@ require 'eac_ruby_base0/core_ext'
5
5
  module Avm
6
6
  module Tools
7
7
  class Runner
8
- class LocalProject
8
+ class AppSrc
9
9
  class Ruby
10
10
  class Bundler
11
11
  class GemfileLock
@@ -7,7 +7,7 @@ require 'eac_ruby_base0/core_ext'
7
7
  module Avm
8
8
  module Tools
9
9
  class Runner
10
- class LocalProject
10
+ class AppSrc
11
11
  class Ruby
12
12
  class Bundler
13
13
  class Incompatible
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/core_ext'
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner
9
- class LocalProject
9
+ class AppSrc
10
10
  class Test < ::EacRubyUtils::Console::DocoptRunner
11
11
  include ::EacCli::DefaultRunner
12
12
 
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/core_ext'
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner
9
- class LocalProject
9
+ class AppSrc
10
10
  class Update < ::EacRubyUtils::Console::DocoptRunner
11
11
  include ::EacCli::DefaultRunner
12
12
 
@@ -6,7 +6,7 @@ require 'eac_cli/core_ext'
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner
9
- class LocalProject
9
+ class AppSrc
10
10
  class VersionBump
11
11
  runner_with :help do
12
12
  desc 'Bump version of a local project.'
@@ -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.run?
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
@@ -1,25 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/require_sub'
3
+ require 'avm/core_ext'
5
4
  require 'avm/self'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
- class Self < ::EacRubyUtils::Console::DocoptRunner
11
- ::EacRubyUtils.require_sub(__FILE__)
12
-
13
- DOC = <<~DOCOPT
14
- Utilities for self avm-tools.
15
-
16
- Usage:
17
- __PROGRAM__ [options] __SUBCOMMANDS__
18
- __PROGRAM__ -h | --help
19
-
20
- Options:
21
- -h --help Show this screen.
22
- DOCOPT
9
+ class Self
10
+ require_sub __FILE__
11
+ runner_with :help, :subcommands do
12
+ desc 'Utilities for self avm-tools.'
13
+ subcommands
14
+ end
23
15
 
24
16
  def instance
25
17
  ::Avm::Self.instance
@@ -5,7 +5,7 @@ require 'avm/docker/runner'
5
5
  module Avm
6
6
  module Tools
7
7
  class Runner
8
- class Self < ::EacRubyUtils::Console::DocoptRunner
8
+ class Self
9
9
  class Docker < ::Avm::Docker::Runner
10
10
  end
11
11
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.95.0'
5
+ VERSION = '0.96.0'
6
6
  end
7
7
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  require 'avm/launcher/errors/base'
4
4
  require 'avm/launcher/instances/base'
5
- require 'eac_launcher/instances/runner_helper'
5
+ require 'avm/launcher/instances/runner_helper'
6
6
  require 'eac_launcher/instances/settings'
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.95.0
4
+ version: 0.96.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-06 00:00:00.000000000 Z
11
+ date: 2021-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -288,8 +288,10 @@ files:
288
288
  - Gemfile
289
289
  - exe/avm
290
290
  - lib/avm.rb
291
+ - lib/avm/app_src.rb
291
292
  - lib/avm/cached_download.rb
292
293
  - lib/avm/configs.rb
294
+ - lib/avm/core_ext.rb
293
295
  - lib/avm/data.rb
294
296
  - lib/avm/data/instance.rb
295
297
  - lib/avm/data/instance/files_unit.rb
@@ -452,6 +454,7 @@ files:
452
454
  - lib/avm/instances/base/auto_values/system.rb
453
455
  - lib/avm/instances/base/auto_values/web.rb
454
456
  - lib/avm/instances/base/dockerizable.rb
457
+ - lib/avm/instances/base/entry_keys.rb
455
458
  - lib/avm/instances/configuration.rb
456
459
  - lib/avm/instances/configuration/_locale.rb
457
460
  - lib/avm/instances/configuration/_rubocop.rb
@@ -467,13 +470,17 @@ files:
467
470
  - lib/avm/launcher/errors/non_project.rb
468
471
  - lib/avm/launcher/instances/base.rb
469
472
  - lib/avm/launcher/instances/base/cache.rb
473
+ - lib/avm/launcher/instances/error.rb
474
+ - lib/avm/launcher/instances/runner_helper.rb
470
475
  - lib/avm/launcher/instances/settings.rb
471
- - lib/avm/local_projects.rb
472
- - lib/avm/local_projects/instance.rb
473
476
  - lib/avm/patches.rb
477
+ - lib/avm/patches/class.rb
474
478
  - lib/avm/patches/class/i18n.rb
479
+ - lib/avm/patches/eac_ruby_gems_utils.rb
475
480
  - lib/avm/patches/eac_ruby_gems_utils/gem.rb
476
481
  - lib/avm/patches/i18n.rb
482
+ - lib/avm/patches/object.rb
483
+ - lib/avm/patches/object/fs_cache.rb
477
484
  - lib/avm/patches/object/i18n.rb
478
485
  - lib/avm/patches/object/template.rb
479
486
  - lib/avm/path_string.rb
@@ -532,6 +539,21 @@ files:
532
539
  - lib/avm/sync.rb
533
540
  - lib/avm/tools.rb
534
541
  - lib/avm/tools/runner.rb
542
+ - lib/avm/tools/runner/app_src.rb
543
+ - lib/avm/tools/runner/app_src/eac_asciidoctor_base0.rb
544
+ - lib/avm/tools/runner/app_src/eac_asciidoctor_base0/build.rb
545
+ - lib/avm/tools/runner/app_src/eac_writings_base0.rb
546
+ - lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
547
+ - lib/avm/tools/runner/app_src/eac_writings_base0/build_single.rb
548
+ - lib/avm/tools/runner/app_src/eac_writings_base0/info.rb
549
+ - lib/avm/tools/runner/app_src/info.rb
550
+ - lib/avm/tools/runner/app_src/ruby.rb
551
+ - lib/avm/tools/runner/app_src/ruby/bundler.rb
552
+ - lib/avm/tools/runner/app_src/ruby/bundler/gemfile_lock.rb
553
+ - lib/avm/tools/runner/app_src/ruby/bundler/incompatible.rb
554
+ - lib/avm/tools/runner/app_src/test.rb
555
+ - lib/avm/tools/runner/app_src/update.rb
556
+ - lib/avm/tools/runner/app_src/version_bump.rb
535
557
  - lib/avm/tools/runner/eac_asciidoctor_base0.rb
536
558
  - lib/avm/tools/runner/eac_rails_base0.rb
537
559
  - lib/avm/tools/runner/eac_redmine_base0.rb
@@ -562,21 +584,6 @@ files:
562
584
  - lib/avm/tools/runner/launcher/instances.rb
563
585
  - lib/avm/tools/runner/launcher/projects.rb
564
586
  - lib/avm/tools/runner/launcher/publish.rb
565
- - lib/avm/tools/runner/local_project.rb
566
- - lib/avm/tools/runner/local_project/eac_asciidoctor_base0.rb
567
- - lib/avm/tools/runner/local_project/eac_asciidoctor_base0/build.rb
568
- - lib/avm/tools/runner/local_project/eac_writings_base0.rb
569
- - lib/avm/tools/runner/local_project/eac_writings_base0/build_chapters.rb
570
- - lib/avm/tools/runner/local_project/eac_writings_base0/build_single.rb
571
- - lib/avm/tools/runner/local_project/eac_writings_base0/info.rb
572
- - lib/avm/tools/runner/local_project/info.rb
573
- - lib/avm/tools/runner/local_project/ruby.rb
574
- - lib/avm/tools/runner/local_project/ruby/bundler.rb
575
- - lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb
576
- - lib/avm/tools/runner/local_project/ruby/bundler/incompatible.rb
577
- - lib/avm/tools/runner/local_project/test.rb
578
- - lib/avm/tools/runner/local_project/update.rb
579
- - lib/avm/tools/runner/local_project/version_bump.rb
580
587
  - lib/avm/tools/runner/ruby.rb
581
588
  - lib/avm/tools/runner/ruby/gems.rb
582
589
  - lib/avm/tools/runner/ruby/gems/generate.rb
@@ -603,8 +610,6 @@ files:
603
610
  - lib/eac_launcher/git/sub_warp_base.rb
604
611
  - lib/eac_launcher/git/warp_base.rb
605
612
  - lib/eac_launcher/instances.rb
606
- - lib/eac_launcher/instances/error.rb
607
- - lib/eac_launcher/instances/runner_helper.rb
608
613
  - lib/eac_launcher/paths.rb
609
614
  - lib/eac_launcher/paths/logical.rb
610
615
  - lib/eac_launcher/paths/real.rb
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module LocalProjects
7
- require_sub __FILE__
8
- end
9
- end
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/instances/configuration'
4
- require 'eac_launcher/paths/real'
5
- require 'eac_ruby_utils/core_ext'
6
- require 'avm/projects/stereotypes'
7
- require 'i18n'
8
-
9
- module Avm
10
- module LocalProjects
11
- class Instance
12
- enable_simple_cache
13
- common_constructor :path do
14
- self.path = path.to_pathname
15
- source_stereotypes_mixins
16
- end
17
-
18
- delegate :to_s, to: :path
19
-
20
- def locale
21
- configuration.if_present(&:locale) || ::I18n.default_locale
22
- end
23
-
24
- # Backward compatibility with [EacLauncher::Paths::Logical].
25
- # @return [EacLauncher::Paths::Real].
26
- def real
27
- ::EacLauncher::Paths::Real.new(path.to_path)
28
- end
29
-
30
- def run_job(job, job_args = [])
31
- stereotypes.each { |stereotype| run_stereotype_job(stereotype, job, job_args) }
32
- end
33
-
34
- private
35
-
36
- # @return [Avm::Instances::Configuration]
37
- def configuration_uncached
38
- ::Avm::Instances::Configuration.find_in_path(path)
39
- end
40
-
41
- def run_stereotype_job(stereotype, job, job_args)
42
- job_class_method = "#{job}_class"
43
- if stereotype.send(job_class_method).present?
44
- puts stereotype.label + ": #{job} class found. Running..."
45
- stereotype.send(job_class_method).new(self, *job_args).run
46
- else
47
- puts stereotype.label + ": #{job} class not found"
48
- end
49
- end
50
-
51
- def stereotypes_uncached
52
- ::Avm::Projects::Stereotypes.list.select { |s| s.match?(self) }
53
- end
54
-
55
- def source_stereotypes_mixins
56
- stereotypes.each do |s|
57
- s.local_project_mixin_module.if_present { |v| singleton_class.include(v) }
58
- end
59
- end
60
- end
61
- end
62
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/console/speaker'
5
-
6
- module EacLauncher
7
- module Instances
8
- class RunnerHelper < ::EacRubyUtils::Console::DocoptRunner
9
- include ::EacRubyUtils::Console::Speaker
10
-
11
- def context
12
- @context ||= ::EacLauncher::Context.current
13
- end
14
-
15
- def find_instances(instance_name)
16
- context.instances.select { |instance| instance_match?(instance, instance_name) }
17
- end
18
-
19
- def instance_match?(instance, instance_name)
20
- ::File.fnmatch?(instance_name, instance.name)
21
- end
22
-
23
- def instances
24
- if options['--all']
25
- context.instances
26
- elsif options['--pending']
27
- context.pending_instances
28
- else
29
- options['<instance_path>'].flat_map { |p| find_instances(p) }
30
- end
31
- end
32
-
33
- def instance_stereotypes(instance)
34
- instance.stereotypes.map(&:label).join(', ')
35
- end
36
-
37
- def instance_label(instance)
38
- "#{instance.name} [#{instance_stereotypes(instance)}]"
39
- end
40
- end
41
- end
42
- end