eac_tools 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +6 -6
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/lib/avm/application_stereotypes/base/by_gem.rb +17 -0
  5. data/sub/avm/lib/avm/application_stereotypes/base/detection.rb +34 -0
  6. data/sub/avm/lib/avm/application_stereotypes/base.rb +21 -0
  7. data/sub/avm/lib/avm/application_stereotypes.rb +9 -0
  8. data/sub/avm/lib/avm/{instances/application.rb → applications/base.rb} +5 -6
  9. data/sub/avm/lib/avm/applications.rb +9 -0
  10. data/sub/avm/lib/avm/instances/base.rb +7 -2
  11. data/sub/avm/lib/avm/instances.rb +1 -1
  12. data/sub/avm/lib/avm/registry/application_stereotypes/build_available.rb +46 -0
  13. data/sub/avm/lib/avm/registry/application_stereotypes/stereotype_builder.rb +30 -0
  14. data/sub/avm/lib/avm/registry/application_stereotypes.rb +36 -0
  15. data/sub/avm/lib/avm/registry/{base.rb → from_gems.rb} +13 -4
  16. data/sub/avm/lib/avm/registry/instances.rb +16 -0
  17. data/sub/avm/lib/avm/registry/runners.rb +10 -0
  18. data/sub/avm/lib/avm/registry/scms.rb +10 -0
  19. data/sub/avm/lib/avm/registry/sources.rb +10 -0
  20. data/sub/avm/lib/avm/registry/with_path/cache.rb +2 -2
  21. data/sub/avm/lib/avm/registry/with_path.rb +8 -2
  22. data/sub/avm/lib/avm/registry.rb +3 -7
  23. data/sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +1 -1
  24. data/sub/avm/lib/avm/sources/base/instance.rb +2 -2
  25. data/sub/avm/lib/avm/sources/base.rb +4 -0
  26. data/sub/avm/lib/avm/version.rb +1 -1
  27. data/sub/avm/lib/avm/with_application_stereotype.rb +23 -0
  28. data/sub/avm/lib/avm/with_dynamic_runners.rb +42 -0
  29. data/sub/{avm-tools/spec/lib/avm/instances/application_spec.rb → avm/spec/lib/avm/applications/base_spec.rb} +3 -3
  30. data/sub/{avm-tools/spec/lib/avm/instances/application_spec_fixture.yml → avm/spec/lib/avm/applications/base_spec_fixture.yml} +0 -0
  31. data/sub/{avm-tools → avm}/spec/lib/avm/instances/base_spec.rb +0 -0
  32. data/sub/{avm-tools → avm}/spec/lib/avm/instances/base_spec_configs_storage.yml +0 -0
  33. data/sub/avm-tools/avm-tools.gemspec +1 -1
  34. data/sub/avm-tools/lib/avm/tools/runner/application_stereotypes/list.rb +31 -0
  35. data/sub/avm-tools/lib/avm/tools/runner/application_stereotypes.rb +16 -0
  36. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  37. metadata +26 -12
  38. data/sub/avm/lib/avm/sources/base/runners.rb +0 -47
  39. data/sub/avm-tools/Gemfile.lock +0 -291
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee0e7b0ec8c211e2d60baa268eec54c8f94ed0402f8a248d354f6d5ced0e0b3b
4
- data.tar.gz: 68ca11e086283e81939d5c8552e6c4c7ea03897790038e789d6d5f2dbf91eb16
3
+ metadata.gz: 3fa70fea2f112e1a4e35f04e36403b48e783741ef6422889bf1ff331ebeb9cea
4
+ data.tar.gz: cb5448c31e2221ae342b292d95c8110d0ec7d31a7cd71c864db87e8e26923059
5
5
  SHA512:
6
- metadata.gz: bbbcbdb525534c94dea882fc4aa20533c1836e56fefa47f816c97da91f8d31ec03b95ffe7d4b6da049fab7f42d64f64ff652162533ab53056ce06ef4df285556
7
- data.tar.gz: 8a14803261fca0b5780abb81a23ee5ac63b72e442b0ebfdc087984277a21e3ec08f17d6cd39ce460e5d0c6768105ec829590afa531e95945e7777d983efbe825
6
+ metadata.gz: 35ff38d368bbbb072bbada779c08d9979cda147c3c15ffee5d4c9525942673ef9d94185c306bf23134bc85a69ea7b591c5fb099dc8ec584a41476c71c71f49d2
7
+ data.tar.gz: 7e91d791b04fee2aca1f883a4a72b7862c40cb24a574bebf8c61c5cfa54b12476bb312eb5494cc9e48a9379229ae6c140f06009ab332c55868810a2361dd2201
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.8.0)
4
+ eac_tools (0.9.0)
5
5
  avm-eac_generic_base0 (~> 0.3)
6
6
  avm-eac_rails_base0 (~> 0.5)
7
7
  avm-eac_rails_base1 (~> 0.4, >= 0.4.1)
8
8
  avm-eac_redmine_base0 (~> 0.9)
9
9
  avm-eac_redmine_plugin_base0 (~> 0.3)
10
10
  avm-eac_ruby_base1 (~> 0.11)
11
- avm-tools (~> 0.122)
11
+ avm-tools (~> 0.123)
12
12
  eac_ruby_utils (~> 0.95, >= 0.95.2)
13
13
 
14
14
  PATH
@@ -62,9 +62,9 @@ PATH
62
62
  PATH
63
63
  remote: sub/avm-tools
64
64
  specs:
65
- avm-tools (0.122.0)
65
+ avm-tools (0.123.0)
66
66
  aranha-parsers (~> 0.4)
67
- avm (~> 0.22)
67
+ avm (~> 0.27)
68
68
  avm-eac_asciidoctor_base0 (~> 0.3, >= 0.3.4)
69
69
  avm-eac_rails_base0 (~> 0.3)
70
70
  avm-eac_redmine_base0 (~> 0.5, >= 0.5.2)
@@ -81,7 +81,7 @@ PATH
81
81
  PATH
82
82
  remote: sub/avm
83
83
  specs:
84
- avm (0.26.0)
84
+ avm (0.27.0)
85
85
  eac_cli (~> 0.27, >= 0.27.6)
86
86
  eac_config (~> 0.9)
87
87
  eac_docker (~> 0.3)
@@ -321,4 +321,4 @@ DEPENDENCIES
321
321
  eac_tools!
322
322
 
323
323
  BUNDLED WITH
324
- 2.3.17
324
+ 2.3.18
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.8.0'
4
+ VERSION = '0.9.0'
5
5
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module ApplicationStereotypes
5
+ class Base
6
+ module ByGem
7
+ common_concern
8
+
9
+ module ClassMethods
10
+ def by_gem(gem_name)
11
+ new(gem_name.gsub('-', '/').camelize)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module ApplicationStereotypes
5
+ class Base
6
+ module Detection
7
+ common_concern
8
+
9
+ module ClassMethods
10
+ # @return [Class<Avm::Sources::Base>, nil]
11
+ def detect(object)
12
+ return singleton_instance if
13
+ %w[name instance_class source_class].any? { |t| send("detect_by_#{t}?", object) }
14
+ end
15
+
16
+ # @return [Boolean]
17
+ def detect_by_instance_class?(object)
18
+ object.is_a?(::Class) && singleton_instance.instance_class == object
19
+ end
20
+
21
+ # @return [Boolean]
22
+ def detect_by_name?(object)
23
+ object.is_a?(::String) && singleton_instance.name == object
24
+ end
25
+
26
+ # @return [Boolean]
27
+ def detect_by_source_class?(object)
28
+ object.is_a?(::Class) && singleton_instance.source_class == object
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module ApplicationStereotypes
7
+ class Base
8
+ common_constructor :namespace_module, :instance_class, :source_class
9
+
10
+ # @return [String]
11
+ def name
12
+ namespace_module.name.demodulize
13
+ end
14
+
15
+ # @return [String]
16
+ def to_s
17
+ name
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module ApplicationStereotypes
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -1,16 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/instances/entries'
4
+ require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module Avm
6
- module Instances
7
- class Application
7
+ module Applications
8
+ class Base
8
9
  include ::Avm::Instances::Entries
9
10
 
10
- attr_reader :id
11
-
12
- def initialize(id)
13
- @id = id.to_s
11
+ common_constructor :id do
12
+ self.id = id.to_s
14
13
  end
15
14
 
16
15
  def to_s
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Applications
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/with_application_stereotype'
4
+ require 'avm/with_dynamic_runners'
3
5
  require 'eac_ruby_utils/require_sub'
4
6
  require 'eac_ruby_utils/simple_cache'
5
7
  require 'avm/instances/entries'
@@ -7,10 +9,13 @@ require 'avm/instances/entries'
7
9
  module Avm
8
10
  module Instances
9
11
  class Base
12
+ enable_abstract_methods
10
13
  enable_listable
11
14
  enable_simple_cache
12
15
  require_sub __FILE__, include_modules: true
13
16
  include ::Avm::Instances::Entries
17
+ include ::Avm::WithDynamicRunners
18
+ include ::Avm::WithApplicationStereotype
14
19
 
15
20
  lists.add_string :access, :local, :ssh
16
21
 
@@ -19,8 +24,8 @@ module Avm
19
24
  class << self
20
25
  def by_id(id)
21
26
  application_id, suffix = parse_id(id)
22
- require 'avm/instances/application'
23
- new(::Avm::Instances::Application.new(application_id), suffix)
27
+ require 'avm/applications/base'
28
+ new(::Avm::Applications::Base.new(application_id), suffix)
24
29
  end
25
30
 
26
31
  private
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Avm
4
4
  module Instances
5
- require 'avm/instances/application'
5
+ require 'avm/applications/base'
6
6
  require 'avm/instances/entries'
7
7
  end
8
8
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/application_stereotypes/stereotype_builder'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Registry
8
+ class ApplicationStereotypes
9
+ class BuildAvailable
10
+ enable_method_class
11
+
12
+ common_constructor :owner
13
+
14
+ def result
15
+ reset_buffer
16
+ read_instances_registry
17
+ read_sources_registry
18
+ buffer.values.map(&:build)
19
+ end
20
+
21
+ private
22
+
23
+ attr_accessor :buffer
24
+
25
+ def read_object(type, object)
26
+ buffer[object.stereotype_namespace_module] ||=
27
+ ::Avm::Registry::ApplicationStereotypes::StereotypeBuilder
28
+ .new(object.stereotype_namespace_module)
29
+ buffer[object.stereotype_namespace_module].add_object(type, object)
30
+ end
31
+
32
+ def read_instances_registry
33
+ ::Avm::Registry.instances.available.each { |instance| read_object(:instance, instance) }
34
+ end
35
+
36
+ def read_sources_registry
37
+ ::Avm::Registry.sources.available.each { |source| read_object(:source, source) }
38
+ end
39
+
40
+ def reset_buffer
41
+ self.buffer = {}
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/application_stereotypes/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Registry
8
+ class ApplicationStereotypes
9
+ class StereotypeBuilder
10
+ common_constructor :namespace_module
11
+
12
+ def add_object(type, object)
13
+ attr_method = "#{type}_class"
14
+ raise "#{attr_method} is already present" if send(attr_method).present?
15
+
16
+ send("#{attr_method}=", object)
17
+ end
18
+
19
+ # @return [Avm::ApplicationStereotypes::Base]
20
+ def build
21
+ ::Avm::ApplicationStereotypes::Base.new(namespace_module, instance_class, source_class)
22
+ end
23
+
24
+ private
25
+
26
+ attr_accessor :instance_class, :source_class
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Registry
7
+ class ApplicationStereotypes
8
+ require_sub __FILE__, require_dependency: true
9
+ enable_simple_cache
10
+
11
+ common_constructor :module_suffix
12
+
13
+ private
14
+
15
+ def available_uncached
16
+ build_available
17
+ end
18
+
19
+ # @return [Avm::Instances::Base, nil]
20
+ def class_detect(klass, detect_args)
21
+ r = ::Avm::Instances::Base.by_id(*detect_args)
22
+ r.application.stereotype.instance_class == klass ? r : nil
23
+ end
24
+
25
+ def detect(*registered_initialize_args)
26
+ detect_optional(*registered_initialize_args) ||
27
+ raise_not_found(*registered_initialize_args)
28
+ end
29
+
30
+ def detect_optional(*registered_initialize_args)
31
+ registered_modules.reverse.lazy
32
+ .map { |klass| class_detect(klass, registered_initialize_args) }.find(&:present?)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -5,18 +5,27 @@ require 'eac_ruby_utils/gems_registry'
5
5
 
6
6
  module Avm
7
7
  module Registry
8
- class Base
8
+ class FromGems
9
+ enable_abstract_methods
9
10
  enable_simple_cache
10
11
  common_constructor :module_suffix
11
12
 
13
+ def available
14
+ registered_modules.reject(&:abstract?)
15
+ end
16
+
17
+ def class_detect(_klass, _detect_args)
18
+ raise_abstract_method __method__
19
+ end
20
+
12
21
  def detect(*registered_initialize_args)
13
22
  detect_optional(*registered_initialize_args) ||
14
23
  raise_not_found(*registered_initialize_args)
15
24
  end
16
25
 
17
26
  def detect_optional(*registered_initialize_args)
18
- registered_modules.reverse.lazy.map { |klass| klass.new(*registered_initialize_args) }
19
- .find(&:valid?)
27
+ available.reverse.lazy
28
+ .map { |klass| class_detect(klass, registered_initialize_args) }.find(&:present?)
20
29
  end
21
30
 
22
31
  def provider_module_suffix
@@ -39,7 +48,7 @@ module Avm
39
48
 
40
49
  def raise_not_found(*args)
41
50
  raise("No registered module valid for #{args}" \
42
- " (Module suffix: #{module_suffix}, Available: #{registered_modules.join(', ')})")
51
+ " (Module suffix: #{module_suffix}, Available: #{available.join(', ')})")
43
52
  end
44
53
 
45
54
  def registered_modules_uncached
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/base'
4
+ require 'avm/registry/from_gems'
5
+
6
+ module Avm
7
+ module Registry
8
+ class Instances < ::Avm::Registry::FromGems
9
+ # @return [Avm::Instances::Base, nil]
10
+ def class_detect(klass, detect_args)
11
+ r = ::Avm::Instances::Base.by_id(*detect_args)
12
+ r.application.stereotype.instance_class == klass ? r : nil
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/from_gems'
4
+
5
+ module Avm
6
+ module Registry
7
+ class Runners < ::Avm::Registry::FromGems
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/with_path'
4
+
5
+ module Avm
6
+ module Registry
7
+ class Scms < ::Avm::Registry::WithPath
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/with_path'
4
+
5
+ module Avm
6
+ module Registry
7
+ class Sources < ::Avm::Registry::WithPath
8
+ end
9
+ end
10
+ end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/registry/base'
3
+ require 'avm/registry/from_gems'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module Registry
8
- class WithPath < ::Avm::Registry::Base
8
+ class WithPath < ::Avm::Registry::FromGems
9
9
  class Cache
10
10
  enable_simple_cache
11
11
  common_constructor :owner
@@ -1,13 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/registry/base'
3
+ require 'avm/registry/from_gems'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module Registry
8
- class WithPath < ::Avm::Registry::Base
8
+ class WithPath < ::Avm::Registry::FromGems
9
9
  require_sub __FILE__
10
10
 
11
+ # @return [Object, nil]
12
+ def class_detect(klass, detect_args)
13
+ r = klass.new(*detect_args)
14
+ r.valid? ? r : nil
15
+ end
16
+
11
17
  def detect_by_path(path)
12
18
  detect_by_path_optional(path) || raise_not_found(path)
13
19
  end
@@ -7,14 +7,14 @@ module Avm
7
7
  module Registry
8
8
  require_sub __FILE__
9
9
  enable_listable
10
- lists.add_symbol :category, :instance_stereotypes, :runners, :scms, :sources
10
+ lists.add_symbol :category, :application_stereotypes, :instances, :runners, :scms, :sources
11
11
 
12
12
  WITH_PATH = [CATEGORY_SCMS, CATEGORY_SOURCES].freeze
13
13
 
14
14
  class << self
15
15
  enable_simple_cache
16
16
 
17
- # @return [Array<Avm::Registry::Base>]
17
+ # @return [Array<Avm::Registry::FromGems>]
18
18
  def registries
19
19
  lists.category.values.map { |c| send(c) }
20
20
  end
@@ -28,11 +28,7 @@ module Avm
28
28
  end
29
29
 
30
30
  def registry_class(category)
31
- if WITH_PATH.include?(category)
32
- ::Avm::Registry::WithPath
33
- else
34
- ::Avm::Registry::Base
35
- end
31
+ ::Avm::Registry.const_get(category.to_s.camelize)
36
32
  end
37
33
  end
38
34
  end
@@ -7,7 +7,7 @@ require 'avm/registry'
7
7
  .each do |registry|
8
8
  context "when registry is #{registry}" do
9
9
  it 'is not in the avm registry' do
10
- expect(registry.registered_modules).not_to include(described_class)
10
+ expect(registry.available).not_to include(described_class)
11
11
  end
12
12
  end
13
13
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/instances/application'
3
+ require 'avm/applications/base'
4
4
  require 'avm/instances/base'
5
5
 
6
6
  module Avm
@@ -16,7 +16,7 @@ module Avm
16
16
  private
17
17
 
18
18
  def application_uncached
19
- ::Avm::Instances::Application.new(path.basename)
19
+ ::Avm::Applications::Base.new(path.basename)
20
20
  end
21
21
 
22
22
  def instance_uncached
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'avm/registry'
4
4
  require 'avm/scms/null'
5
+ require 'avm/with_application_stereotype'
6
+ require 'avm/with_dynamic_runners'
5
7
  require 'eac_git'
6
8
  require 'eac_ruby_utils/core_ext'
7
9
 
@@ -9,6 +11,8 @@ module Avm
9
11
  module Sources
10
12
  class Base
11
13
  require_sub __FILE__, include_modules: true
14
+ include ::Avm::WithApplicationStereotype
15
+ include ::Avm::WithDynamicRunners
12
16
  compare_by :path
13
17
  enable_abstract_methods
14
18
  enable_simple_cache
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.26.0'
4
+ VERSION = '0.27.0'
5
5
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/runner_with/subcommands'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module WithApplicationStereotype
8
+ common_concern do
9
+ include ClassMethods
10
+ end
11
+
12
+ module ClassMethods
13
+ # @return [Module]
14
+ def stereotype_namespace_module
15
+ module_parent.module_parent
16
+ end
17
+ end
18
+
19
+ def stereotype_namespace_module
20
+ self.class.stereotype_namespace_module
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/runner_with/subcommands'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module WithDynamicRunners
8
+ # @return [Hash<String, EacCli::Runner>]
9
+ def extra_available_subcommands
10
+ extra_available_subcommands_from_runners_module
11
+ end
12
+
13
+ # @return [Hash<String, EacCli::Runner>]
14
+ def extra_available_subcommands_from_runners_module
15
+ self.class.ancestors.reverse.inject({}) do |a, e|
16
+ a.merge(RunnersFromModule.new(e).result)
17
+ end
18
+ end
19
+
20
+ class RunnersFromModule
21
+ enable_simple_cache
22
+ common_constructor :the_module
23
+
24
+ # @return [Hash<String, EacCli::Runner>]
25
+ def result
26
+ return {} if runners_module.blank?
27
+
28
+ ::EacCli::RunnerWith::Subcommands.subcommands_from_module(runners_module)
29
+ end
30
+
31
+ def runners_module_uncached
32
+ return nil if the_module.module_parent.blank?
33
+
34
+ begin
35
+ the_module.module_parent.const_get('Runners')
36
+ rescue ::NameError
37
+ nil
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/instances/application'
3
+ require 'avm/applications/base'
4
4
 
5
- RSpec.describe ::Avm::Instances::Application do
5
+ RSpec.describe ::Avm::Applications::Base do
6
6
  let(:instance) { described_class.new('avm-tools') }
7
7
 
8
8
  ::EacRubyUtils::Rspec
9
9
  .default_setup
10
- .stub_eac_config_node(self, ::File.join(__dir__, 'application_spec_fixture.yml'))
10
+ .stub_eac_config_node(self, ::File.join(__dir__, 'base_spec_fixture.yml'))
11
11
 
12
12
  describe '#id' do
13
13
  it { expect(instance.id).to eq('avm-tools') }
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
16
 
17
17
  s.add_dependency 'aranha-parsers', '~> 0.4'
18
- s.add_dependency 'avm', '~> 0.22'
18
+ s.add_dependency 'avm', '~> 0.27'
19
19
  s.add_dependency 'avm-eac_asciidoctor_base0', '~> 0.3', '>= 0.3.4'
20
20
  s.add_dependency 'avm-eac_rails_base0', '~> 0.3'
21
21
  s.add_dependency 'avm-eac_redmine_base0', '~> 0.5', '>= 0.5.2'
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/tools/core_ext'
4
+
5
+ module Avm
6
+ module Tools
7
+ class Runner
8
+ class ApplicationStereotypes
9
+ class List
10
+ runner_with :help, :output
11
+
12
+ def run
13
+ infov 'Found', stereotypes.count
14
+ run_output
15
+ end
16
+
17
+ def output_content
18
+ stereotypes.map { |s| "#{s}\n" }.join
19
+ end
20
+
21
+ private
22
+
23
+ def stereotypes
24
+ ::Avm::Registry.application_stereotypes.available
25
+ .sort_by { |s| [s.name, s.namespace_module] }
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+
5
+ module Avm
6
+ module Tools
7
+ class Runner
8
+ class ApplicationStereotypes
9
+ require_sub __FILE__
10
+ runner_with :help, :subcommands do
11
+ subcommands
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.122.0'
5
+ VERSION = '0.123.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-21 00:00:00.000000000 Z
11
+ date: 2022-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm-eac_generic_base0
@@ -106,14 +106,14 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '0.122'
109
+ version: '0.123'
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '0.122'
116
+ version: '0.123'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: eac_ruby_utils
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -309,7 +309,6 @@ files:
309
309
  - sub/avm-eac_ruby_base1/spec/rubocop_spec.rb
310
310
  - sub/avm-eac_ruby_base1/spec/spec_helper.rb
311
311
  - sub/avm-tools/Gemfile
312
- - sub/avm-tools/Gemfile.lock
313
312
  - sub/avm-tools/README.textile
314
313
  - sub/avm-tools/avm-tools.gemspec
315
314
  - sub/avm-tools/exe/avm
@@ -419,6 +418,8 @@ files:
419
418
  - sub/avm-tools/lib/avm/tools/runner/app_src/test.rb
420
419
  - sub/avm-tools/lib/avm/tools/runner/app_src/update.rb
421
420
  - sub/avm-tools/lib/avm/tools/runner/app_src/version_bump.rb
421
+ - sub/avm-tools/lib/avm/tools/runner/application_stereotypes.rb
422
+ - sub/avm-tools/lib/avm/tools/runner/application_stereotypes/list.rb
422
423
  - sub/avm-tools/lib/avm/tools/runner/config.rb
423
424
  - sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
424
425
  - sub/avm-tools/lib/avm/tools/runner/eac_asciidoctor_base0.rb
@@ -468,10 +469,6 @@ files:
468
469
  - sub/avm-tools/spec/dummy/ruby_gem_stub/ruby_gem_stub.gemspec
469
470
  - sub/avm-tools/spec/lib/avm/eac_wordpress_base0/apache_host_spec.rb
470
471
  - sub/avm-tools/spec/lib/avm/eac_wordpress_base0/apache_host_spec_no_ssl_content.conf
471
- - sub/avm-tools/spec/lib/avm/instances/application_spec.rb
472
- - sub/avm-tools/spec/lib/avm/instances/application_spec_fixture.yml
473
- - sub/avm-tools/spec/lib/avm/instances/base_spec.rb
474
- - sub/avm-tools/spec/lib/avm/instances/base_spec_configs_storage.yml
475
472
  - sub/avm-tools/spec/lib/avm/launcher/context_spec.rb
476
473
  - sub/avm-tools/spec/lib/avm/launcher/context_spec.yml
477
474
  - sub/avm-tools/spec/lib/avm/launcher/git/base_spec.rb
@@ -996,6 +993,12 @@ files:
996
993
  - sub/avm/Gemfile
997
994
  - sub/avm/avm.gemspec
998
995
  - sub/avm/lib/avm.rb
996
+ - sub/avm/lib/avm/application_stereotypes.rb
997
+ - sub/avm/lib/avm/application_stereotypes/base.rb
998
+ - sub/avm/lib/avm/application_stereotypes/base/by_gem.rb
999
+ - sub/avm/lib/avm/application_stereotypes/base/detection.rb
1000
+ - sub/avm/lib/avm/applications.rb
1001
+ - sub/avm/lib/avm/applications/base.rb
999
1002
  - sub/avm/lib/avm/data/instance.rb
1000
1003
  - sub/avm/lib/avm/data/instance/files_unit.rb
1001
1004
  - sub/avm/lib/avm/data/instance/package.rb
@@ -1011,7 +1014,6 @@ files:
1011
1014
  - sub/avm/lib/avm/docker/runner.rb
1012
1015
  - sub/avm/lib/avm/executables.rb
1013
1016
  - sub/avm/lib/avm/instances.rb
1014
- - sub/avm/lib/avm/instances/application.rb
1015
1017
  - sub/avm/lib/avm/instances/base.rb
1016
1018
  - sub/avm/lib/avm/instances/base/auto_values.rb
1017
1019
  - sub/avm/lib/avm/instances/base/auto_values/access.rb
@@ -1040,7 +1042,14 @@ files:
1040
1042
  - sub/avm/lib/avm/launcher/publish/check_result.rb
1041
1043
  - sub/avm/lib/avm/path_string.rb
1042
1044
  - sub/avm/lib/avm/registry.rb
1043
- - sub/avm/lib/avm/registry/base.rb
1045
+ - sub/avm/lib/avm/registry/application_stereotypes.rb
1046
+ - sub/avm/lib/avm/registry/application_stereotypes/build_available.rb
1047
+ - sub/avm/lib/avm/registry/application_stereotypes/stereotype_builder.rb
1048
+ - sub/avm/lib/avm/registry/from_gems.rb
1049
+ - sub/avm/lib/avm/registry/instances.rb
1050
+ - sub/avm/lib/avm/registry/runners.rb
1051
+ - sub/avm/lib/avm/registry/scms.rb
1052
+ - sub/avm/lib/avm/registry/sources.rb
1044
1053
  - sub/avm/lib/avm/registry/with_path.rb
1045
1054
  - sub/avm/lib/avm/registry/with_path/cache.rb
1046
1055
  - sub/avm/lib/avm/result.rb
@@ -1062,7 +1071,6 @@ files:
1062
1071
  - sub/avm/lib/avm/sources/base/instance.rb
1063
1072
  - sub/avm/lib/avm/sources/base/locale.rb
1064
1073
  - sub/avm/lib/avm/sources/base/parent.rb
1065
- - sub/avm/lib/avm/sources/base/runners.rb
1066
1074
  - sub/avm/lib/avm/sources/base/subs.rb
1067
1075
  - sub/avm/lib/avm/sources/base/subs_paths.rb
1068
1076
  - sub/avm/lib/avm/sources/base/testing.rb
@@ -1076,6 +1084,12 @@ files:
1076
1084
  - sub/avm/lib/avm/sync.rb
1077
1085
  - sub/avm/lib/avm/version.rb
1078
1086
  - sub/avm/lib/avm/version_number.rb
1087
+ - sub/avm/lib/avm/with_application_stereotype.rb
1088
+ - sub/avm/lib/avm/with_dynamic_runners.rb
1089
+ - sub/avm/spec/lib/avm/applications/base_spec.rb
1090
+ - sub/avm/spec/lib/avm/applications/base_spec_fixture.yml
1091
+ - sub/avm/spec/lib/avm/instances/base_spec.rb
1092
+ - sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml
1079
1093
  - sub/avm/spec/lib/avm/scms/base_spec.rb
1080
1094
  - sub/avm/spec/lib/avm/sources/base_spec.rb
1081
1095
  - sub/avm/spec/rubocop_spec.rb
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/sources/base/subs_paths'
4
- require 'eac_cli/runner_with/subcommands'
5
- require 'eac_ruby_utils/core_ext'
6
-
7
- module Avm
8
- module Sources
9
- class Base
10
- module Runners
11
- # @return [Hash<String, EacCli::Runner>]
12
- def extra_available_subcommands
13
- extra_available_subcommands_from_runners_module
14
- end
15
-
16
- # @return [Hash<String, EacCli::Runner>]
17
- def extra_available_subcommands_from_runners_module
18
- self.class.ancestors.reverse.inject({}) do |a, e|
19
- a.merge(RunnersFromModule.new(e).result)
20
- end
21
- end
22
-
23
- class RunnersFromModule
24
- enable_simple_cache
25
- common_constructor :the_module
26
-
27
- # @return [Hash<String, EacCli::Runner>]
28
- def result
29
- return {} if runners_module.blank?
30
-
31
- ::EacCli::RunnerWith::Subcommands.subcommands_from_module(runners_module)
32
- end
33
-
34
- def runners_module_uncached
35
- return nil if the_module.module_parent.blank?
36
-
37
- begin
38
- the_module.module_parent.const_get('Runners')
39
- rescue ::NameError
40
- nil
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,291 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- avm-tools (0.122.0)
5
- aranha-parsers (~> 0.4)
6
- avm (~> 0.22)
7
- avm-eac_asciidoctor_base0 (~> 0.3, >= 0.3.4)
8
- avm-eac_rails_base0 (~> 0.3)
9
- avm-eac_redmine_base0 (~> 0.5, >= 0.5.2)
10
- avm-eac_ruby_base1 (~> 0.8)
11
- avm-eac_ubuntu_base0 (~> 0.3)
12
- avm-files (~> 0.1)
13
- avm-git (~> 0.3, >= 0.3.1)
14
- clipboard (~> 1.3, >= 1.3.3)
15
- curb (~> 0.9.10)
16
- eac_ruby_base0 (~> 0.16, >= 0.16.4)
17
- git (~> 1.7)
18
- ruby-progressbar (~> 1.10, >= 1.10.1)
19
-
20
- PATH
21
- remote: sub/avm-eac_asciidoctor_base0
22
- specs:
23
- avm-eac_asciidoctor_base0 (0.3.4)
24
- asciidoctor (~> 2.0, >= 2.0.12)
25
- avm-eac_webapp_base0 (~> 0.2)
26
- eac_ruby_utils (~> 0.63)
27
- os
28
- rouge (~> 3.26)
29
-
30
- PATH
31
- remote: sub/avm-eac_postgresql_base0
32
- specs:
33
- avm-eac_postgresql_base0 (0.2.0)
34
- avm (~> 0.12, >= 0.12.1)
35
- eac_ruby_utils (~> 0.82)
36
-
37
- PATH
38
- remote: sub/avm-eac_ubuntu_base0
39
- specs:
40
- avm-eac_ubuntu_base0 (0.3.0)
41
- avm (~> 0.7)
42
- eac_ruby_utils (~> 0.77, >= 0.77.1)
43
- eac_templates (~> 0.3)
44
-
45
- PATH
46
- remote: sub/avm-files
47
- specs:
48
- avm-files (0.3.2)
49
- avm (~> 0.6)
50
- eac_fs (~> 0.5)
51
- eac_ruby_utils (~> 0.76)
52
- eac_templates (~> 0.2)
53
-
54
- PATH
55
- remote: sub/avm-git
56
- specs:
57
- avm-git (0.4.0)
58
- avm-files (~> 0.1)
59
- eac_git (~> 0.11)
60
- eac_ruby_utils (~> 0.76)
61
-
62
- PATH
63
- remote: sub/eac_docker
64
- specs:
65
- eac_docker (0.4.1)
66
- eac_ruby_utils (~> 0.74)
67
- eac_templates (~> 0.1)
68
-
69
- PATH
70
- remote: sub/eac_git
71
- specs:
72
- eac_git (0.12.1)
73
- eac_ruby_utils (~> 0.83)
74
- parseconfig (~> 1.0, >= 1.0.8)
75
-
76
- PATH
77
- remote: sub/eac_rest
78
- specs:
79
- eac_rest (0.6.1)
80
- eac_ruby_utils (~> 0.70)
81
-
82
- PATH
83
- remote: sub/eac_templates
84
- specs:
85
- eac_templates (0.3.1)
86
- eac_config (~> 0.5)
87
- eac_ruby_utils (~> 0.64)
88
-
89
- GEM
90
- remote: https://rubygems.org/
91
- specs:
92
- activesupport (6.1.6.1)
93
- concurrent-ruby (~> 1.0, >= 1.0.2)
94
- i18n (>= 1.6, < 2)
95
- minitest (>= 5.1)
96
- tzinfo (~> 2.0)
97
- zeitwerk (~> 2.3)
98
- addressable (2.8.0)
99
- public_suffix (>= 2.0.2, < 5.0)
100
- aranha-parsers (0.14.1)
101
- activesupport (>= 4.0.0)
102
- addressable (~> 2.7)
103
- curb (~> 0.9.10)
104
- eac_ruby_utils (~> 0.92, >= 0.92.1)
105
- faraday-gzip (~> 0.1)
106
- faraday_middleware
107
- nokogiri (~> 1.12, >= 1.12.4)
108
- ofx-parser (~> 1.1.0)
109
- asciidoctor (2.0.17)
110
- ast (2.4.2)
111
- avm (0.25.0)
112
- eac_cli (~> 0.27, >= 0.27.6)
113
- eac_docker (~> 0.3)
114
- eac_git (~> 0.6)
115
- eac_ruby_utils (~> 0.95)
116
- eac_templates (~> 0.1, >= 0.1.1)
117
- filesize (~> 0.2)
118
- htmlbeautifier (~> 1.3, >= 1.3.1)
119
- minitar (~> 0.9)
120
- avm-eac_generic_base0 (0.3.0)
121
- avm (~> 0.24)
122
- eac_ruby_utils (~> 0.05, >= 0.95.2)
123
- avm-eac_rails_base0 (0.4.1)
124
- avm-eac_rails_base1 (~> 0.3)
125
- eac_ruby_utils (~> 0.80, >= 0.80.2)
126
- avm-eac_rails_base1 (0.4.1)
127
- avm-eac_ruby_base1 (~> 0.9, >= 0.9.1)
128
- avm-eac_webapp_base0 (~> 0.3)
129
- eac_ruby_utils (~> 0.95, >= 0.95.2)
130
- avm-eac_redmine_base0 (0.9.0)
131
- avm-eac_rails_base1 (~> 0.4, >= 0.4.1)
132
- avm-eac_ubuntu_base0 (~> 0.3)
133
- curb (~> 0.9.11)
134
- eac_fs (~> 0.12, >= 0.12.2)
135
- eac_rest (~> 0.6, >= 0.6.1)
136
- eac_ruby_utils (~> 0.95, >= 0.95.2)
137
- avm-eac_ruby_base1 (0.10.0)
138
- avm (~> 0.23)
139
- avm-eac_generic_base0 (~> 0.2)
140
- eac_ruby_utils (~> 0.95, >= 0.95.1)
141
- avm-eac_webapp_base0 (0.3.0)
142
- avm (~> 0.1)
143
- avm-eac_generic_base0 (~> 0.1)
144
- avm-eac_postgresql_base0 (~> 0.1)
145
- avm-eac_ubuntu_base0 (~> 0.3)
146
- eac_ruby_utils (~> 0.68)
147
- clipboard (1.3.6)
148
- colorize (0.8.1)
149
- concurrent-ruby (1.1.10)
150
- content-type (0.0.2)
151
- parslet (~> 2.0)
152
- curb (0.9.11)
153
- diff-lcs (1.5.0)
154
- eac_cli (0.27.6)
155
- colorize (~> 0.8.1)
156
- eac_config (~> 0.8)
157
- eac_ruby_utils (~> 0.95)
158
- eac_config (0.8.1)
159
- addressable
160
- eac_ruby_utils (~> 0.83)
161
- eac_fs (0.12.2)
162
- content-type
163
- eac_ruby_utils (~> 0.70)
164
- ruby-filemagic
165
- eac_ruby_base0 (0.16.5)
166
- avm-eac_ruby_base1 (~> 0.8)
167
- eac_cli (~> 0.27, >= 0.27.5)
168
- eac_fs (~> 0.10)
169
- eac_ruby_utils (~> 0.95, >= 0.95.1)
170
- eac_ruby_gem_support (0.5.1)
171
- eac_ruby_utils (~> 0.74)
172
- rspec (~> 3.9)
173
- rubocop (~> 0.80.1)
174
- rubocop-rails (~> 2.4.2)
175
- rubocop-rspec (~> 1.38.1)
176
- eac_ruby_utils (0.95.2)
177
- activesupport (>= 4, < 7)
178
- addressable (~> 2.6)
179
- bundler
180
- filesize
181
- net-ssh (~> 4.2)
182
- faraday (1.10.0)
183
- faraday-em_http (~> 1.0)
184
- faraday-em_synchrony (~> 1.0)
185
- faraday-excon (~> 1.1)
186
- faraday-httpclient (~> 1.0)
187
- faraday-multipart (~> 1.0)
188
- faraday-net_http (~> 1.0)
189
- faraday-net_http_persistent (~> 1.0)
190
- faraday-patron (~> 1.0)
191
- faraday-rack (~> 1.0)
192
- faraday-retry (~> 1.0)
193
- ruby2_keywords (>= 0.0.4)
194
- faraday-em_http (1.0.0)
195
- faraday-em_synchrony (1.0.0)
196
- faraday-excon (1.1.0)
197
- faraday-gzip (0.1.0)
198
- faraday (>= 1.0)
199
- zlib (~> 2.1)
200
- faraday-httpclient (1.0.1)
201
- faraday-multipart (1.0.4)
202
- multipart-post (~> 2)
203
- faraday-net_http (1.0.1)
204
- faraday-net_http_persistent (1.2.0)
205
- faraday-patron (1.0.0)
206
- faraday-rack (1.0.0)
207
- faraday-retry (1.0.3)
208
- faraday_middleware (1.2.0)
209
- faraday (~> 1.0)
210
- filesize (0.2.0)
211
- git (1.11.0)
212
- rchardet (~> 1.8)
213
- hpricot (0.8.6)
214
- htmlbeautifier (1.4.2)
215
- i18n (1.12.0)
216
- concurrent-ruby (~> 1.0)
217
- jaro_winkler (1.5.4)
218
- minitar (0.9)
219
- minitest (5.16.2)
220
- multipart-post (2.2.3)
221
- net-ssh (4.2.0)
222
- nokogiri (1.13.7-x86_64-linux)
223
- racc (~> 1.4)
224
- ofx-parser (1.1.0)
225
- hpricot (>= 0.6)
226
- os (1.1.4)
227
- parallel (1.22.1)
228
- parseconfig (1.1.2)
229
- parser (3.1.2.0)
230
- ast (~> 2.4.1)
231
- parslet (2.0.0)
232
- public_suffix (4.0.7)
233
- racc (1.6.0)
234
- rack (2.2.4)
235
- rainbow (3.1.1)
236
- rchardet (1.8.0)
237
- rexml (3.2.5)
238
- rouge (3.29.0)
239
- rspec (3.11.0)
240
- rspec-core (~> 3.11.0)
241
- rspec-expectations (~> 3.11.0)
242
- rspec-mocks (~> 3.11.0)
243
- rspec-core (3.11.0)
244
- rspec-support (~> 3.11.0)
245
- rspec-expectations (3.11.0)
246
- diff-lcs (>= 1.2.0, < 2.0)
247
- rspec-support (~> 3.11.0)
248
- rspec-mocks (3.11.1)
249
- diff-lcs (>= 1.2.0, < 2.0)
250
- rspec-support (~> 3.11.0)
251
- rspec-support (3.11.0)
252
- rubocop (0.80.1)
253
- jaro_winkler (~> 1.5.1)
254
- parallel (~> 1.10)
255
- parser (>= 2.7.0.1)
256
- rainbow (>= 2.2.2, < 4.0)
257
- rexml
258
- ruby-progressbar (~> 1.7)
259
- unicode-display_width (>= 1.4.0, < 1.7)
260
- rubocop-rails (2.4.2)
261
- rack (>= 1.1)
262
- rubocop (>= 0.72.0)
263
- rubocop-rspec (1.38.1)
264
- rubocop (>= 0.68.1)
265
- ruby-filemagic (0.7.3)
266
- ruby-progressbar (1.11.0)
267
- ruby2_keywords (0.0.5)
268
- tzinfo (2.0.5)
269
- concurrent-ruby (~> 1.0)
270
- unicode-display_width (1.6.1)
271
- zeitwerk (2.6.0)
272
- zlib (2.1.1)
273
-
274
- PLATFORMS
275
- x86_64-linux
276
-
277
- DEPENDENCIES
278
- avm-eac_asciidoctor_base0!
279
- avm-eac_postgresql_base0!
280
- avm-eac_ubuntu_base0!
281
- avm-files!
282
- avm-git!
283
- avm-tools!
284
- eac_docker!
285
- eac_git!
286
- eac_rest!
287
- eac_ruby_gem_support (~> 0.5.1)
288
- eac_templates!
289
-
290
- BUNDLED WITH
291
- 2.3.17