eac_tools 0.5.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +35 -29
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +1 -0
  5. data/sub/avm/lib/avm/registry/with_path/cache.rb +31 -0
  6. data/sub/avm/lib/avm/registry/with_path.rb +25 -5
  7. data/sub/avm/lib/avm/sources/base/configuration.rb +23 -2
  8. data/sub/avm/lib/avm/sources/base/locale.rb +1 -1
  9. data/sub/avm/lib/avm/sources/base/parent.rb +8 -11
  10. data/sub/avm/lib/avm/sources/base/subs_paths.rb +1 -1
  11. data/sub/avm/lib/avm/sources/base/testing.rb +4 -4
  12. data/sub/avm/lib/avm/sources/tests/builder.rb +17 -11
  13. data/sub/avm/lib/avm/version.rb +1 -1
  14. data/sub/avm-eac_rails_base0/Gemfile +3 -0
  15. data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +1 -1
  16. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
  17. data/sub/avm-eac_redmine_base0/Gemfile +3 -0
  18. data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +6 -6
  19. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/base.rb +8 -0
  20. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  21. data/sub/avm-eac_redmine_plugin_base0/avm-eac_redmine_plugin_base0.gemspec +1 -1
  22. data/sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0/sources/base.rb +40 -2
  23. data/sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0/version.rb +1 -1
  24. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +1 -1
  25. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/bundler.rb +1 -1
  26. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/rake.rb +14 -0
  27. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base.rb +18 -4
  28. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  29. data/sub/avm-tools/Gemfile +3 -0
  30. data/sub/avm-tools/Gemfile.lock +17 -22
  31. data/sub/avm-tools/lib/avm/tools/runner/app_src/info.rb +19 -0
  32. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  33. data/sub/eac_cli/Gemfile +3 -0
  34. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  35. data/sub/eac_config/Gemfile +8 -0
  36. data/sub/{avm-tools/sub/eac_config → eac_config}/eac_config.gemspec +0 -0
  37. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/entry.rb +0 -0
  38. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/entry_path.rb +5 -0
  39. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/envvars_node/entry.rb +0 -0
  40. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/envvars_node.rb +0 -0
  41. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/load_nodes_search.rb +0 -0
  42. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/load_path.rb +0 -0
  43. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/node.rb +6 -0
  44. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/node_entry.rb +0 -0
  45. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/node_uri.rb +0 -0
  46. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/old_configs/base.rb +0 -0
  47. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/old_configs/file.rb +0 -0
  48. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/old_configs.rb +0 -0
  49. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash/entry_key_error.rb +0 -0
  50. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash/node.rb +0 -0
  51. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash/path_search.rb +0 -0
  52. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash.rb +0 -0
  53. data/sub/eac_config/lib/eac_config/prefixed_path_node/entry.rb +25 -0
  54. data/sub/eac_config/lib/eac_config/prefixed_path_node.rb +19 -0
  55. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/rspec/setup.rb +0 -0
  56. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/rspec.rb +0 -0
  57. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/version.rb +1 -1
  58. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/yaml_file_node/entry.rb +0 -0
  59. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/yaml_file_node.rb +0 -0
  60. data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config.rb +0 -0
  61. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/entry_path_spec.rb +0 -0
  62. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/envvars_node/entry_spec.rb +0 -0
  63. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/envvars_node_spec.rb +0 -0
  64. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/old_configs_spec.rb +0 -0
  65. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/paths_hash_spec.rb +0 -0
  66. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec.rb +0 -0
  67. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +0 -0
  68. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +0 -0
  69. 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
  70. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +0 -0
  71. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/rubocop_spec.rb +0 -0
  72. data/sub/{avm-tools/sub/eac_config → eac_config}/spec/spec_helper.rb +0 -0
  73. data/sub/eac_fs/Gemfile +3 -0
  74. data/sub/eac_fs/lib/eac_fs/version.rb +1 -1
  75. data/sub/eac_ruby_base0/Gemfile +3 -0
  76. data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  77. data/sub/eac_ruby_utils/Gemfile +2 -10
  78. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  79. metadata +55 -52
  80. data/sub/avm-tools/sub/eac_config/Gemfile +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e96780cde14c4b87945f466bcedbb9344b12aa87a9b9832fc520d5ab681fa13
4
- data.tar.gz: '028b3f2c1c65d20cf6c0a1b65470806c49d6368e688bb962161674472e7b7b84'
3
+ metadata.gz: ee0e7b0ec8c211e2d60baa268eec54c8f94ed0402f8a248d354f6d5ced0e0b3b
4
+ data.tar.gz: 68ca11e086283e81939d5c8552e6c4c7ea03897790038e789d6d5f2dbf91eb16
5
5
  SHA512:
6
- metadata.gz: 68acf9dcd522d222060f070a7400834e2baabdfa3a5cd8a268077b6b8863abf5470588d8dd040aea08b9542144b57f983434511b1b44c6d4d10d83b8581eed42
7
- data.tar.gz: cdf796ff102923bd500a1c427d6598ae6d1026f4146d80ddff2ffd212ff13c596c9309445c43b1b6e76b9c8015865fadf8927570986afd0fb1ac3945b778a23f
6
+ metadata.gz: bbbcbdb525534c94dea882fc4aa20533c1836e56fefa47f816c97da91f8d31ec03b95ffe7d4b6da049fab7f42d64f64ff652162533ab53056ce06ef4df285556
7
+ data.tar.gz: 8a14803261fca0b5780abb81a23ee5ac63b72e442b0ebfdc087984277a21e3ec08f17d6cd39ce460e5d0c6768105ec829590afa531e95945e7777d983efbe825
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.5.0)
4
+ eac_tools (0.8.0)
5
5
  avm-eac_generic_base0 (~> 0.3)
6
6
  avm-eac_rails_base0 (~> 0.5)
7
- avm-eac_rails_base1 (~> 0.4)
8
- avm-eac_redmine_base0 (~> 0.8)
9
- avm-eac_redmine_plugin_base0 (~> 0.1, >= 0.1.1)
10
- avm-eac_ruby_base1 (~> 0.9)
11
- avm-tools (~> 0.121)
7
+ avm-eac_rails_base1 (~> 0.4, >= 0.4.1)
8
+ avm-eac_redmine_base0 (~> 0.9)
9
+ avm-eac_redmine_plugin_base0 (~> 0.3)
10
+ avm-eac_ruby_base1 (~> 0.11)
11
+ avm-tools (~> 0.122)
12
12
  eac_ruby_utils (~> 0.95, >= 0.95.2)
13
13
 
14
14
  PATH
@@ -28,41 +28,41 @@ PATH
28
28
  PATH
29
29
  remote: sub/avm-eac_rails_base1
30
30
  specs:
31
- avm-eac_rails_base1 (0.4.0)
32
- avm-eac_ruby_base1 (~> 0.9)
31
+ avm-eac_rails_base1 (0.4.1)
32
+ avm-eac_ruby_base1 (~> 0.9, >= 0.9.1)
33
33
  avm-eac_webapp_base0 (~> 0.3)
34
34
  eac_ruby_utils (~> 0.95, >= 0.95.2)
35
35
 
36
36
  PATH
37
37
  remote: sub/avm-eac_redmine_base0
38
38
  specs:
39
- avm-eac_redmine_base0 (0.8.0)
40
- avm-eac_rails_base1 (~> 0.3)
41
- avm-eac_ubuntu_base0 (~> 0.2)
42
- curb (~> 0.9.10)
43
- eac_fs (~> 0.4)
44
- eac_rest (~> 0.4)
45
- eac_ruby_utils (~> 0.68)
39
+ avm-eac_redmine_base0 (0.9.1)
40
+ avm-eac_rails_base1 (~> 0.4, >= 0.4.1)
41
+ avm-eac_ubuntu_base0 (~> 0.3)
42
+ curb (~> 0.9.11)
43
+ eac_fs (~> 0.12, >= 0.12.2)
44
+ eac_rest (~> 0.6, >= 0.6.1)
45
+ eac_ruby_utils (~> 0.95, >= 0.95.2)
46
46
 
47
47
  PATH
48
48
  remote: sub/avm-eac_redmine_plugin_base0
49
49
  specs:
50
- avm-eac_redmine_plugin_base0 (0.1.1)
51
- avm-eac_ruby_base1 (~> 0.8, >= 0.8.1)
50
+ avm-eac_redmine_plugin_base0 (0.3.0)
51
+ avm-eac_ruby_base1 (~> 0.11)
52
52
  eac_ruby_utils (~> 0.95, >= 0.95.1)
53
53
 
54
54
  PATH
55
55
  remote: sub/avm-eac_ruby_base1
56
56
  specs:
57
- avm-eac_ruby_base1 (0.9.0)
58
- avm (~> 0.23)
57
+ avm-eac_ruby_base1 (0.11.0)
58
+ avm (~> 0.26)
59
59
  avm-eac_generic_base0 (~> 0.2)
60
60
  eac_ruby_utils (~> 0.95, >= 0.95.1)
61
61
 
62
62
  PATH
63
63
  remote: sub/avm-tools
64
64
  specs:
65
- avm-tools (0.121.2)
65
+ avm-tools (0.122.0)
66
66
  aranha-parsers (~> 0.4)
67
67
  avm (~> 0.22)
68
68
  avm-eac_asciidoctor_base0 (~> 0.3, >= 0.3.4)
@@ -81,8 +81,9 @@ PATH
81
81
  PATH
82
82
  remote: sub/avm
83
83
  specs:
84
- avm (0.24.0)
84
+ avm (0.26.0)
85
85
  eac_cli (~> 0.27, >= 0.27.6)
86
+ eac_config (~> 0.9)
86
87
  eac_docker (~> 0.3)
87
88
  eac_git (~> 0.6)
88
89
  eac_ruby_utils (~> 0.95)
@@ -94,15 +95,22 @@ PATH
94
95
  PATH
95
96
  remote: sub/eac_cli
96
97
  specs:
97
- eac_cli (0.27.6)
98
+ eac_cli (0.27.7)
98
99
  colorize (~> 0.8.1)
99
100
  eac_config (~> 0.8)
100
101
  eac_ruby_utils (~> 0.95)
101
102
 
103
+ PATH
104
+ remote: sub/eac_config
105
+ specs:
106
+ eac_config (0.9.0)
107
+ addressable
108
+ eac_ruby_utils (~> 0.83)
109
+
102
110
  PATH
103
111
  remote: sub/eac_fs
104
112
  specs:
105
- eac_fs (0.12.2)
113
+ eac_fs (0.12.3)
106
114
  content-type
107
115
  eac_ruby_utils (~> 0.70)
108
116
  ruby-filemagic
@@ -110,7 +118,7 @@ PATH
110
118
  PATH
111
119
  remote: sub/eac_ruby_base0
112
120
  specs:
113
- eac_ruby_base0 (0.16.5)
121
+ eac_ruby_base0 (0.16.6)
114
122
  avm-eac_ruby_base1 (~> 0.8)
115
123
  eac_cli (~> 0.27, >= 0.27.5)
116
124
  eac_fs (~> 0.10)
@@ -119,7 +127,7 @@ PATH
119
127
  PATH
120
128
  remote: sub/eac_ruby_utils
121
129
  specs:
122
- eac_ruby_utils (0.95.2)
130
+ eac_ruby_utils (0.95.3)
123
131
  activesupport (>= 4, < 7)
124
132
  addressable (~> 2.6)
125
133
  bundler
@@ -183,9 +191,6 @@ GEM
183
191
  parslet (~> 2.0)
184
192
  curb (0.9.11)
185
193
  diff-lcs (1.5.0)
186
- eac_config (0.8.1)
187
- addressable
188
- eac_ruby_utils (~> 0.83)
189
194
  eac_docker (0.4.1)
190
195
  eac_ruby_utils (~> 0.74)
191
196
  eac_templates (~> 0.1)
@@ -289,7 +294,7 @@ GEM
289
294
  ruby-filemagic (0.7.3)
290
295
  ruby-progressbar (1.11.0)
291
296
  ruby2_keywords (0.0.5)
292
- tzinfo (2.0.4)
297
+ tzinfo (2.0.5)
293
298
  concurrent-ruby (~> 1.0)
294
299
  unicode-display_width (1.6.1)
295
300
  zeitwerk (2.6.0)
@@ -308,6 +313,7 @@ DEPENDENCIES
308
313
  avm-eac_ruby_base1!
309
314
  avm-tools!
310
315
  eac_cli!
316
+ eac_config!
311
317
  eac_fs!
312
318
  eac_ruby_base0!
313
319
  eac_ruby_gem_support (~> 0.5.1)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.5.0'
4
+ VERSION = '0.8.0'
5
5
  end
data/sub/avm/avm.gemspec CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
15
  s.add_dependency 'eac_cli', '~> 0.27', '>= 0.27.6'
16
+ s.add_dependency 'eac_config', '~> 0.9'
16
17
  s.add_dependency 'eac_docker', '~> 0.3'
17
18
  s.add_dependency 'eac_git', '~> 0.6'
18
19
  s.add_dependency 'eac_ruby_utils', '~> 0.95'
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Registry
8
+ class WithPath < ::Avm::Registry::Base
9
+ class Cache
10
+ enable_simple_cache
11
+ common_constructor :owner
12
+
13
+ def detect_optional(path)
14
+ return nil if path.root?
15
+ return cached_paths.fetch(path) if cached_paths.key?(path)
16
+
17
+ detected = owner.detect_optional(path)
18
+ detected = detect_optional(path.parent) if detected.blank?
19
+ cached_paths[path] = detected
20
+ detected
21
+ end
22
+
23
+ private
24
+
25
+ def cached_paths_uncached
26
+ {}
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -6,17 +6,37 @@ require 'eac_ruby_utils/core_ext'
6
6
  module Avm
7
7
  module Registry
8
8
  class WithPath < ::Avm::Registry::Base
9
+ require_sub __FILE__
10
+
9
11
  def detect_by_path(path)
10
12
  detect_by_path_optional(path) || raise_not_found(path)
11
13
  end
12
14
 
13
15
  def detect_by_path_optional(path)
14
- current_path = path.to_pathname.expand_path
15
- until current_path.root?
16
- detect_optional(current_path).if_present { |v| return v }
17
- current_path = current_path.parent
16
+ on_cache do
17
+ cache.detect_optional(path)
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ attr_accessor :cache
24
+
25
+ def on_cache(&block)
26
+ cache.present? ? on_cache_with_cache(&block) : on_cache_with_no_cache(&block)
27
+ end
28
+
29
+ def on_cache_with_cache(&block)
30
+ block.call
31
+ end
32
+
33
+ def on_cache_with_no_cache(&block)
34
+ self.cache = ::Avm::Registry::WithPath::Cache.new(self)
35
+ begin
36
+ block.call
37
+ ensure
38
+ self.cache = nil
18
39
  end
19
- nil
20
40
  end
21
41
  end
22
42
  end
@@ -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)
@@ -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
@@ -8,6 +8,8 @@ module Avm
8
8
  module Sources
9
9
  module Tests
10
10
  class Builder
11
+ NO_TEST_TEST_NAME = 'no_test'
12
+
11
13
  require_sub __FILE__
12
14
  enable_immutable
13
15
 
@@ -33,7 +35,7 @@ module Avm
33
35
  # @return [Array<Avm::Sources::Tests::Single>]
34
36
  def available_units
35
37
  @available_units ||= ([main_source] + main_source.subs)
36
- .map { |a_source| create_unit(a_source) }
38
+ .flat_map { |a_source| create_source_units(a_source) }
37
39
  end
38
40
 
39
41
  def available_units_from_main
@@ -44,27 +46,31 @@ module Avm
44
46
  create_units(main_source.subs)
45
47
  end
46
48
 
49
+ # @return [Avm::Sources::Tests::Single]
50
+ def create_source_no_test_unit(source)
51
+ ::Avm::Sources::Tests::Single.new(self, source, NO_TEST_TEST_NAME,
52
+ source.env.command('true'))
53
+ end
54
+
47
55
  # @return [Array<Avm::Sources::Tests::Single>]
48
56
  def create_source_units(source)
49
- source.test_commands.map do |test_name, test_command|
57
+ tests = source.test_commands
58
+ return create_source_no_test_unit(source) unless tests.any?
59
+
60
+ tests.map do |test_name, test_command|
50
61
  ::Avm::Sources::Tests::Single.new(self, source, test_name, test_command)
51
62
  end
52
63
  end
53
64
 
54
- # @return [Avm::Sources::Tests::Single]
55
- def create_unit(source)
56
- ::Avm::Sources::Tests::Single.new(self, source)
57
- end
58
-
59
65
  # @return [Array<Avm::Sources::Tests::Single>]
60
66
  def create_units(sources)
61
67
  sources.flat_map { |a_source| create_source_units(a_source) }
62
68
  end
63
69
 
64
70
  # @return [Avm::Sources::Tests::Single]
65
- def create_unit_by_id(source_id)
66
- r = available_units.find { |unit| unit.id == source_id }
67
- 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?
68
74
 
69
75
  raise ::ArgumentError, "Source not found with ID=#{source_id}" \
70
76
  "(Available: #{available_units.map(&:id).join(', ')})"
@@ -72,7 +78,7 @@ module Avm
72
78
 
73
79
  # @return [Array<Avm::Sources::Tests::Single>]
74
80
  def select_units_from_ids
75
- include_ids.map { |source_id| create_unit_by_id(source_id) }
81
+ include_ids.flat_map { |source_id| create_units_by_id(source_id) }
76
82
  end
77
83
 
78
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.24.0'
4
+ VERSION = '0.26.0'
5
5
  end
@@ -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)
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm-eac_ruby_base1', '~> 0.9'
15
+ s.add_dependency 'avm-eac_ruby_base1', '~> 0.9', '>= 0.9.1'
16
16
  s.add_dependency 'avm-eac_webapp_base0', '~> 0.3'
17
17
  s.add_dependency 'eac_ruby_utils', '~> 0.95', '>= 0.95.2'
18
18
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase1
5
- VERSION = '0.4.0'
5
+ VERSION = '0.4.1'
6
6
  end
7
7
  end
@@ -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)
@@ -12,12 +12,12 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,locale,template}/**/*']
14
14
 
15
- s.add_dependency 'avm-eac_rails_base1', '~> 0.3'
16
- s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.2'
17
- s.add_dependency 'curb', '~> 0.9.10'
18
- s.add_dependency 'eac_fs', '~> 0.4'
19
- s.add_dependency 'eac_rest', '~> 0.4'
20
- s.add_dependency 'eac_ruby_utils', '~> 0.68'
15
+ s.add_dependency 'avm-eac_rails_base1', '~> 0.4', '>= 0.4.1'
16
+ s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
17
+ s.add_dependency 'curb', '~> 0.9.11'
18
+ s.add_dependency 'eac_fs', '~> 0.12', '>= 0.12.2'
19
+ s.add_dependency 'eac_rest', '~> 0.6', '>= 0.6.1'
20
+ s.add_dependency 'eac_ruby_utils', '~> 0.95', '>= 0.95.2'
21
21
 
22
22
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
23
23
  end
@@ -8,9 +8,17 @@ module Avm
8
8
  module EacRedmineBase0
9
9
  module Sources
10
10
  class Base < ::Avm::EacRailsBase1::Sources::Base
11
+ DEFAULT_TEST_COMMANDS = {}.freeze
11
12
  REDMINE_LIB_SUBPATH = 'lib/redmine.rb'
12
13
  SUBS_INCLUDE_PATHS_DEFAULT = ['plugins/*'].freeze
13
14
 
15
+ # Return a empty hash (No tests).
16
+ #
17
+ # @return [Hash<String, EacRubyUtils::Envs::Command].
18
+ def default_test_commands
19
+ DEFAULT_TEST_COMMANDS
20
+ end
21
+
14
22
  def redmine_lib_path
15
23
  path.join(REDMINE_LIB_SUBPATH)
16
24
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRedmineBase0
5
- VERSION = '0.8.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]