eac_tools 0.6.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +27 -21
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +1 -0
  5. data/sub/avm/lib/avm/application_stereotypes/base/by_gem.rb +17 -0
  6. data/sub/avm/lib/avm/application_stereotypes/base/detection.rb +34 -0
  7. data/sub/avm/lib/avm/application_stereotypes/base.rb +21 -0
  8. data/sub/avm/lib/avm/application_stereotypes.rb +9 -0
  9. data/sub/avm/lib/avm/{instances/application.rb → applications/base.rb} +5 -6
  10. data/sub/avm/lib/avm/applications.rb +9 -0
  11. data/sub/avm/lib/avm/instances/base.rb +7 -2
  12. data/sub/avm/lib/avm/instances.rb +1 -1
  13. data/sub/avm/lib/avm/registry/application_stereotypes/build_available.rb +46 -0
  14. data/sub/avm/lib/avm/registry/application_stereotypes/stereotype_builder.rb +30 -0
  15. data/sub/avm/lib/avm/registry/application_stereotypes.rb +36 -0
  16. data/sub/avm/lib/avm/registry/{base.rb → from_gems.rb} +13 -4
  17. data/sub/avm/lib/avm/registry/instances.rb +16 -0
  18. data/sub/avm/lib/avm/registry/runners.rb +10 -0
  19. data/sub/avm/lib/avm/registry/scms.rb +10 -0
  20. data/sub/avm/lib/avm/registry/sources.rb +10 -0
  21. data/sub/avm/lib/avm/registry/with_path/cache.rb +31 -0
  22. data/sub/avm/lib/avm/registry/with_path.rb +33 -7
  23. data/sub/avm/lib/avm/registry.rb +3 -7
  24. data/sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +1 -1
  25. data/sub/avm/lib/avm/sources/base/configuration.rb +23 -2
  26. data/sub/avm/lib/avm/sources/base/instance.rb +2 -2
  27. data/sub/avm/lib/avm/sources/base/locale.rb +1 -1
  28. data/sub/avm/lib/avm/sources/base/parent.rb +8 -11
  29. data/sub/avm/lib/avm/sources/base/subs_paths.rb +1 -1
  30. data/sub/avm/lib/avm/sources/base/testing.rb +4 -4
  31. data/sub/avm/lib/avm/sources/base.rb +4 -0
  32. data/sub/avm/lib/avm/sources/tests/builder.rb +5 -10
  33. data/sub/avm/lib/avm/version.rb +1 -1
  34. data/sub/avm/lib/avm/with_application_stereotype.rb +23 -0
  35. data/sub/avm/lib/avm/with_dynamic_runners.rb +42 -0
  36. data/sub/{avm-tools/spec/lib/avm/instances/application_spec.rb → avm/spec/lib/avm/applications/base_spec.rb} +3 -3
  37. data/sub/{avm-tools/spec/lib/avm/instances/application_spec_fixture.yml → avm/spec/lib/avm/applications/base_spec_fixture.yml} +0 -0
  38. data/sub/{avm-tools → avm}/spec/lib/avm/instances/base_spec.rb +0 -0
  39. data/sub/{avm-tools → avm}/spec/lib/avm/instances/base_spec_configs_storage.yml +0 -0
  40. data/sub/avm-eac_rails_base0/Gemfile +3 -0
  41. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  42. data/sub/avm-eac_redmine_plugin_base0/avm-eac_redmine_plugin_base0.gemspec +1 -1
  43. data/sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0/sources/base.rb +40 -2
  44. data/sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0/version.rb +1 -1
  45. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +1 -1
  46. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/bundler.rb +1 -1
  47. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/rake.rb +14 -0
  48. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base.rb +12 -0
  49. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  50. data/sub/avm-tools/Gemfile +3 -0
  51. data/sub/avm-tools/avm-tools.gemspec +1 -1
  52. data/sub/avm-tools/lib/avm/tools/runner/app_src/info.rb +19 -0
  53. data/sub/avm-tools/lib/avm/tools/runner/application_stereotypes/list.rb +31 -0
  54. data/sub/avm-tools/lib/avm/tools/runner/application_stereotypes.rb +16 -0
  55. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  56. data/sub/eac_cli/Gemfile +3 -0
  57. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  58. data/sub/eac_config/Gemfile +8 -0
  59. data/sub/{avm-tools/sub/eac_config → eac_config}/eac_config.gemspec +0 -0
  60. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/entry.rb +0 -0
  61. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/entry_path.rb +5 -0
  62. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/envvars_node/entry.rb +0 -0
  63. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/envvars_node.rb +0 -0
  64. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/load_nodes_search.rb +0 -0
  65. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/load_path.rb +0 -0
  66. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/node.rb +6 -0
  67. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/node_entry.rb +0 -0
  68. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/node_uri.rb +0 -0
  69. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/old_configs/base.rb +0 -0
  70. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/old_configs/file.rb +0 -0
  71. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/old_configs.rb +0 -0
  72. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash/entry_key_error.rb +0 -0
  73. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash/node.rb +0 -0
  74. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash/path_search.rb +0 -0
  75. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash.rb +0 -0
  76. data/sub/eac_config/lib/eac_config/prefixed_path_node/entry.rb +25 -0
  77. data/sub/eac_config/lib/eac_config/prefixed_path_node.rb +19 -0
  78. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/rspec/setup.rb +0 -0
  79. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/rspec.rb +0 -0
  80. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/version.rb +1 -1
  81. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/yaml_file_node/entry.rb +0 -0
  82. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/yaml_file_node.rb +0 -0
  83. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config.rb +0 -0
  84. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/entry_path_spec.rb +0 -0
  85. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/envvars_node/entry_spec.rb +0 -0
  86. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/envvars_node_spec.rb +0 -0
  87. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/old_configs_spec.rb +0 -0
  88. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/paths_hash_spec.rb +0 -0
  89. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec.rb +0 -0
  90. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +0 -0
  91. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +0 -0
  92. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +0 -0
  93. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +0 -0
  94. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/rubocop_spec.rb +0 -0
  95. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/spec_helper.rb +0 -0
  96. data/sub/eac_fs/Gemfile +3 -0
  97. data/sub/eac_fs/lib/eac_fs/version.rb +1 -1
  98. data/sub/eac_ruby_base0/Gemfile +3 -0
  99. data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  100. data/sub/eac_ruby_utils/Gemfile +2 -10
  101. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  102. metadata +69 -58
  103. data/sub/avm/lib/avm/sources/base/runners.rb +0 -47
  104. data/sub/avm-tools/Gemfile.lock +0 -296
  105. data/sub/avm-tools/sub/eac_config/Gemfile +0 -5
@@ -9,8 +9,19 @@ module Avm
9
9
  module Sources
10
10
  class Base
11
11
  module Configuration
12
+ PARENT_CONFIGURATION_SUFFIX = %w[subs at].freeze
12
13
  CONFIGURATION_FILENAMES = %w[.avm.yml .avm.yaml].freeze
13
14
 
15
+ # @return [EacConfig::NodeEntry]
16
+ def configuration_entry(*entry_args)
17
+ parent_configuration.if_present do |v|
18
+ parent_entry = v.entry(*entry_args)
19
+ return parent_entry if parent_entry.found?
20
+ end
21
+
22
+ configuration.entry(*entry_args)
23
+ end
24
+
14
25
  # @return [EacRubyUtils::Envs::Command, nil]
15
26
  def configuration_value_to_env_command(value)
16
27
  configuration_value_to_shell_words(value).if_present { |v| env.command(v).chdir(path) }
@@ -25,13 +36,13 @@ module Avm
25
36
 
26
37
  # @return [Array<String>, nil]
27
38
  def read_configuration_as_shell_words(key)
28
- configuration_value_to_shell_words(configuration.entry(key).value)
39
+ configuration_value_to_shell_words(configuration_entry(key).value)
29
40
  end
30
41
 
31
42
  # Utility to read a configuration as a [EacRubyUtils::Envs::Command].
32
43
  # @return [EacRubyUtils::Envs::Command]
33
44
  def read_configuration_as_env_command(key)
34
- configuration_value_to_env_command(configuration.entry(key).value)
45
+ configuration_value_to_env_command(configuration_entry(key).value)
35
46
  end
36
47
 
37
48
  private
@@ -44,6 +55,16 @@ module Avm
44
55
  configuration_with_filename(CONFIGURATION_FILENAMES.first, false)
45
56
  end
46
57
 
58
+ # @return [String]
59
+ def parent_configuration_prefix
60
+ PARENT_CONFIGURATION_SUFFIX + [relative_path]
61
+ end
62
+
63
+ # @return [EacConfig::PrefixedPathNode]
64
+ def parent_configuration_uncached
65
+ parent.if_present { |v| v.configuration.with_prefix(parent_configuration_prefix) }
66
+ end
67
+
47
68
  # @return [EacConfig::YamlFileNode, nil]
48
69
  def configuration_with_filename(filename, needs_exist)
49
70
  file_path = path.join(filename)
@@ -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
@@ -14,7 +14,7 @@ module Avm
14
14
  end
15
15
 
16
16
  def configured_locale
17
- configuration.entry(LOCALE_KEY).value
17
+ configuration_entry(LOCALE_KEY).value
18
18
  end
19
19
 
20
20
  def default_locale
@@ -6,11 +6,6 @@ module Avm
6
6
  module Sources
7
7
  class Base
8
8
  module Parent
9
- # @return [Avm::Sources::Base]
10
- def parent
11
- parent_by_option || parent_by_search
12
- end
13
-
14
9
  # @return [Avm::Sources::Base]
15
10
  def parent_by_option
16
11
  options[OPTION_PARENT]
@@ -18,12 +13,14 @@ module Avm
18
13
 
19
14
  # @return [Avm::Sources::Base]
20
15
  def parent_by_search
21
- parent_path = path.parent
22
- until parent_path.root?
23
- ::Avm::Registry.sources.detect_optional(parent_path).if_present { |v| return v }
24
- parent_path = parent_path.parent
25
- end
26
- nil
16
+ ::Avm::Registry.sources.detect_by_path_optional(path.parent)
17
+ end
18
+
19
+ private
20
+
21
+ # @return [Avm::Sources::Base]
22
+ def parent_uncached
23
+ parent_by_option || parent_by_search
27
24
  end
28
25
  end
29
26
  end
@@ -22,7 +22,7 @@ module Avm
22
22
 
23
23
  # @return [Array<String>]
24
24
  def configured_paths
25
- source.configuration.entry(configuration_key).value.if_present do |v|
25
+ source.configuration_entry(configuration_key).value.if_present do |v|
26
26
  v.split(SUBS_PATH_SEPARATOR)
27
27
  end
28
28
  end
@@ -18,12 +18,12 @@ module Avm
18
18
 
19
19
  # @return [Hash<String, EacRubyUtils::Envs::Command>, nil]
20
20
  def configured_test_commands
21
- configured_value_as_test_commands(configuration.entry(TEST_COMMANDS_KEY).value)
21
+ configured_value_as_test_commands(configuration_entry(TEST_COMMANDS_KEY).value)
22
22
  end
23
23
 
24
24
  # @return [Hash<String, EacRubyUtils::Envs::Command>, nil]
25
25
  def configured_value_as_test_commands(value)
26
- return nil if value.blank?
26
+ return nil if value.nil?
27
27
 
28
28
  [::EacRubyUtils::Envs::Command, ::Hash, ::Enumerable].each do |type|
29
29
  next unless value.is_a?(type)
@@ -45,8 +45,8 @@ module Avm
45
45
  # @return [Enumerable<EacRubyUtils::Envs::Command>]
46
46
  def test_commands
47
47
  configured_test_commands ||
48
- configured_value_as_test_commands(configured_test_command)
49
- default_test_commands
48
+ configured_value_as_test_commands(configured_test_command) ||
49
+ default_test_commands
50
50
  end
51
51
 
52
52
  protected
@@ -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
@@ -35,7 +35,7 @@ module Avm
35
35
  # @return [Array<Avm::Sources::Tests::Single>]
36
36
  def available_units
37
37
  @available_units ||= ([main_source] + main_source.subs)
38
- .map { |a_source| create_unit(a_source) }
38
+ .flat_map { |a_source| create_source_units(a_source) }
39
39
  end
40
40
 
41
41
  def available_units_from_main
@@ -62,20 +62,15 @@ module Avm
62
62
  end
63
63
  end
64
64
 
65
- # @return [Avm::Sources::Tests::Single]
66
- def create_unit(source)
67
- ::Avm::Sources::Tests::Single.new(self, source)
68
- end
69
-
70
65
  # @return [Array<Avm::Sources::Tests::Single>]
71
66
  def create_units(sources)
72
67
  sources.flat_map { |a_source| create_source_units(a_source) }
73
68
  end
74
69
 
75
70
  # @return [Avm::Sources::Tests::Single]
76
- def create_unit_by_id(source_id)
77
- r = available_units.find { |unit| unit.id == source_id }
78
- return r if r
71
+ def create_units_by_id(source_id)
72
+ r = available_units.select { |unit| unit.source.relative_path.to_path == source_id.to_s }
73
+ return r if r.any?
79
74
 
80
75
  raise ::ArgumentError, "Source not found with ID=#{source_id}" \
81
76
  "(Available: #{available_units.map(&:id).join(', ')})"
@@ -83,7 +78,7 @@ module Avm
83
78
 
84
79
  # @return [Array<Avm::Sources::Tests::Single>]
85
80
  def select_units_from_ids
86
- include_ids.map { |source_id| create_unit_by_id(source_id) }
81
+ include_ids.flat_map { |source_id| create_units_by_id(source_id) }
87
82
  end
88
83
 
89
84
  # @return [Array<Avm::Sources::Tests::Single>]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.25.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') }
@@ -3,3 +3,6 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRedmineBase0
5
- VERSION = '0.9.0'
5
+ VERSION = '0.9.1'
6
6
  end
7
7
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'avm-eac_ruby_base1', '~> 0.8', '>= 0.8.1'
15
+ s.add_dependency 'avm-eac_ruby_base1', '~> 0.11'
16
16
  s.add_dependency 'eac_ruby_utils', '~> 0.95', '>= 0.95.1'
17
17
 
18
18
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5', '>= 0.5.1'
@@ -1,13 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_rails_base1/sources/base'
3
+ require 'avm/eac_ruby_base1/sources/base'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module EacRedminePluginBase0
8
8
  module Sources
9
- class Base < ::Avm::EacRailsBase1::Sources::Base
9
+ class Base < ::Avm::EacRubyBase1::Sources::Base
10
10
  DEFAULT_GEMFILE_PATH = 'SelfGemfile'
11
+ RUBOCOP_GEM_NAME = 'rubocop'
12
+ RUBOCOP_TEST_NAME = 'rubocop'
13
+ PARENT_RAKE_TASK_TEST_NAME = 'parent_rake_task'
11
14
  INIT_SUBPATH = 'init.rb'
12
15
 
13
16
  # @return [String]
@@ -15,11 +18,46 @@ module Avm
15
18
  DEFAULT_GEMFILE_PATH
16
19
  end
17
20
 
21
+ # @return [Hash<String, EacRubyUtils::Envs::Command>]
22
+ def default_test_commands
23
+ r = {}
24
+ r[PARENT_RAKE_TASK_TEST_NAME] = parent_rake_test_command if parent_rake_test_command?
25
+ r[RUBOCOP_TEST_NAME] = rubocop_test_command if rubocop_test_command?
26
+ r
27
+ end
28
+
18
29
  # @return [String]
19
30
  def init_path
20
31
  path.join(INIT_SUBPATH)
21
32
  end
22
33
 
34
+ # @return [String]
35
+ def parent_rake_test_task_name
36
+ [gem_name, 'test'].map(&:variableize).join(':')
37
+ end
38
+
39
+ # @return [Boolean]
40
+ def parent_rake_test_command?
41
+ ruby_parent.rake_task?(parent_rake_test_task_name)
42
+ end
43
+
44
+ # @return [EacRubyUtils::Envs::Command]
45
+ def parent_rake_test_command
46
+ ruby_parent.rake(parent_rake_test_task_name).chdir_root.envvar('RAILS_ENV', 'test')
47
+ end
48
+
49
+ # @return [EacRubyUtils::Envs::Command]
50
+ def rubocop_test_command
51
+ bundle('exec', 'rubocop', '--ignore-parent-exclusion')
52
+ .envvar('RAILS_ENV', 'test')
53
+ .chdir_root
54
+ end
55
+
56
+ # @return [Boolean]
57
+ def rubocop_test_command?
58
+ gemfile_path.exist? && gemfile_lock_gem_version(RUBOCOP_GEM_NAME).present?
59
+ end
60
+
23
61
  # @return [Boolean]
24
62
  def valid?
25
63
  init_path.exist?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRedminePluginBase0
5
- VERSION = '0.1.1'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,locale}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.23'
15
+ s.add_dependency 'avm', '~> 0.26'
16
16
  s.add_dependency 'avm-eac_generic_base0', '~> 0.2'
17
17
  s.add_dependency 'eac_ruby_utils', '~> 0.95', '>= 0.95.1'
18
18
 
@@ -20,7 +20,7 @@ module Avm
20
20
 
21
21
  # @return [String]
22
22
  def configured_gemfile_path
23
- configuration.entry(CONFIGURED_GEMFILE_PATH_ENTRY_KEY).value
23
+ configuration_entry(CONFIGURED_GEMFILE_PATH_ENTRY_KEY).value
24
24
  end
25
25
 
26
26
  # @return [String]
@@ -9,6 +9,9 @@ module Avm
9
9
  class Base < ::Avm::EacGenericBase0::Sources::Base
10
10
  module Rake
11
11
  RAKEFILE_BASENAME = 'Rakefile'
12
+ RAKE_TASKS_LINE_PARSER = /\Arake\s+(\S+)\s+/.to_parser do |m|
13
+ m[1]
14
+ end
12
15
 
13
16
  # @return [Avm::EacRubyBase1::Sources::Base::BundleCommand]
14
17
  def rake(*args)
@@ -21,6 +24,17 @@ module Avm
21
24
  def rakefile_path
22
25
  path.join(RAKEFILE_BASENAME)
23
26
  end
27
+
28
+ # @return [Boolean]
29
+ def rake_task?(task_name)
30
+ rake_tasks.include?(task_name)
31
+ end
32
+
33
+ # @return [Array<String>]
34
+ def rake_tasks
35
+ rake('--all', '--tasks').execute!.each_line
36
+ .map { |line| RAKE_TASKS_LINE_PARSER.parse!(line) }
37
+ end
24
38
  end
25
39
  end
26
40
  end
@@ -36,6 +36,18 @@ module Avm
36
36
  self
37
37
  end
38
38
 
39
+ # @return [Avm::EacRubyBase1::Source::Base]
40
+ def ruby_parent
41
+ a_parent = parent
42
+
43
+ loop do
44
+ raise 'No Ruby parent found' if a_parent.blank?
45
+ return a_parent if a_parent.is_a?(::Avm::EacRubyBase1::Sources::Base)
46
+
47
+ a_parent = a_parent.parent
48
+ end
49
+ end
50
+
39
51
  # @return [EacRubyUtils::Envs::Command]
40
52
  def rspec_test_command
41
53
  bundle('exec', 'rspec', '--fail-fast').chdir_root
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- VERSION = '0.9.1'
5
+ VERSION = '0.11.0'
6
6
  end
7
7
  end
@@ -10,3 +10,6 @@ Dir["#{gems_subdir}/*"].each do |dir|
10
10
 
11
11
  gem ::File.basename(dir), path: dir
12
12
  end
13
+
14
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
15
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -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'
@@ -9,11 +9,15 @@ module Avm
9
9
  class Info
10
10
  runner_with :help do
11
11
  desc 'Show information about local project instance.'
12
+ bool_opt '-p', '--parent', 'Show the parent source.'
13
+ bool_opt '-t', '--tests', 'Show test commands.'
12
14
  end
13
15
 
14
16
  def run
15
17
  show_instance
16
18
  show_source
19
+ show_parent
20
+ show_test_commands
17
21
  end
18
22
 
19
23
  private
@@ -23,11 +27,26 @@ module Avm
23
27
  infov 'Launcher stereotypes', instance.stereotypes.map(&:label).join(', ')
24
28
  end
25
29
 
30
+ def show_parent
31
+ return unless parsed.parent?
32
+
33
+ infov 'Parent', runner_context.call(:subject).parent
34
+ end
35
+
26
36
  def show_source
27
37
  infov 'Stereotype', runner_context.call(:subject).class
28
38
  infov 'SCM', runner_context.call(:subject).scm
29
39
  end
30
40
 
41
+ def show_test_commands
42
+ return unless parsed.tests?
43
+
44
+ infov 'Test commands', runner_context.call(:subject).test_commands.count
45
+ runner_context.call(:subject).test_commands.each do |name, command|
46
+ infov " * #{name}", command
47
+ end
48
+ end
49
+
31
50
  def instance
32
51
  runner_context.call(:instance)
33
52
  end
@@ -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.121.2'
5
+ VERSION = '0.123.0'
6
6
  end
7
7
  end
data/sub/eac_cli/Gemfile CHANGED
@@ -3,3 +3,6 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.27.6'
4
+ VERSION = '0.27.7'
5
5
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -34,6 +34,11 @@ module EacConfig
34
34
  @parts = parts.to_a.freeze
35
35
  end
36
36
 
37
+ # @return [EacConfig::EntryPath]
38
+ def +(other)
39
+ self.class.new(parts + self.class.assert(other).parts)
40
+ end
41
+
37
42
  def to_s
38
43
  "#{self.class}[#{parts.join(PART_SEPARATOR)}]"
39
44
  end