avm-tools 0.119.0 → 0.120.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/tools/app_src.rb +1 -5
  3. data/lib/avm/tools/version.rb +1 -1
  4. data/sub/avm/lib/avm/registry/base.rb +6 -2
  5. data/sub/avm/lib/avm/registry/with_path.rb +23 -0
  6. data/sub/avm/lib/avm/registry.rb +11 -1
  7. data/sub/avm/lib/avm/scms/base.rb +2 -7
  8. data/sub/avm/lib/avm/scms/null.rb +14 -0
  9. data/sub/avm/lib/avm/sources/base/configuration.rb +12 -2
  10. data/sub/avm/lib/avm/sources/base/locale.rb +26 -0
  11. data/sub/avm/lib/avm/sources/base/testing.rb +6 -0
  12. data/sub/avm/lib/avm/sources/base.rb +2 -3
  13. data/sub/avm/lib/avm/version.rb +1 -1
  14. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/sources/base.rb +2 -2
  15. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
  16. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/base.rb +3 -3
  17. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  18. data/sub/avm-eac_redmine_plugin_base0/Gemfile +5 -0
  19. data/sub/avm-eac_redmine_plugin_base0/avm-eac_redmine_plugin_base0.gemspec +19 -0
  20. data/sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0/sources/base.rb +30 -0
  21. data/sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0/version.rb +7 -0
  22. data/sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0.rb +9 -0
  23. data/sub/avm-eac_redmine_plugin_base0/spec/rubocop_spec.rb +3 -0
  24. data/sub/avm-eac_redmine_plugin_base0/spec/spec_helper.rb +4 -0
  25. metadata +26 -4
  26. data/sub/avm/lib/avm/sources/configuration/locale.rb +0 -18
  27. data/sub/avm/lib/avm/sources/configuration/tests.rb +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6c5ab539a33cf698f0aa4eaa382e2e23fd408df17185a111ae78983ab1794f1
4
- data.tar.gz: 6a9762c549ee37c533af5c35dca078ab7ee19158e6398d81f7451fce54de076a
3
+ metadata.gz: 03fc9a92381ea8132ea31e0f26c18ffca15f64f50ad147e171f8c107449cc6ab
4
+ data.tar.gz: 0b03b5e4b7ab4d014207080d4e07cb4ce8a61945f7c0773147b7226d567bb644
5
5
  SHA512:
6
- metadata.gz: 6972527557010d58fefc671e1679f011bb68961fb9ecb3a33378681411f39c7fff9fd68ef54a12f6fecf692bd1539e087ee306e05b437c29e542365a54a1231c
7
- data.tar.gz: d9f89dbe97cc6ee002566f9b5c1ec806b9f6e9eb33adca54e3473842bf7abb88923fc27e434d428b595d5b1a51281db1f921cd836af0bdc85d6ce2840c49a3db
6
+ metadata.gz: d02d876cb32ffeba8c56d3ef3d44ee66f55a49fa30a3958555bbfe90539df15ccef6a70ddd039a4c68b72384bed37dfa3e9a102fc4b9d9a74fafc42b4d8d36e3
7
+ data.tar.gz: b7860a33604d1751eb3451dd8a3646e591a93c4d4380994c175242925c1f8a64b6dd860132c3ff9f8ea9876331a88ad397ac0fbc64c37facd0cdff76cbfa4aab
@@ -17,6 +17,7 @@ module Avm
17
17
  source_stereotypes_mixins
18
18
  end
19
19
 
20
+ delegate :configuration, to: :avm_instance
20
21
  delegate :to_s, to: :path
21
22
 
22
23
  def locale
@@ -39,11 +40,6 @@ module Avm
39
40
  ::Avm::Registry.sources.detect(path)
40
41
  end
41
42
 
42
- # @return [Avm::Sources::Configuration]
43
- def configuration_uncached
44
- ::Avm::Sources::Configuration.find_in_path(path)
45
- end
46
-
47
43
  def stereotypes_jobs(job, job_args)
48
44
  job_class_method = "#{job}_class"
49
45
  r = []
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.119.0'
5
+ VERSION = '0.120.0'
6
6
  end
7
7
  end
@@ -11,8 +11,7 @@ module Avm
11
11
 
12
12
  def detect(*registered_initialize_args)
13
13
  detect_optional(*registered_initialize_args) ||
14
- raise("No registered module valid for #{registered_initialize_args}" \
15
- " (Module suffix: #{module_suffix}, Available: #{registered_modules.join(', ')})")
14
+ raise_not_found(*registered_initialize_args)
16
15
  end
17
16
 
18
17
  def detect_optional(*registered_initialize_args)
@@ -38,6 +37,11 @@ module Avm
38
37
 
39
38
  private
40
39
 
40
+ def raise_not_found(*args)
41
+ raise("No registered module valid for #{args}" \
42
+ " (Module suffix: #{module_suffix}, Available: #{registered_modules.join(', ')})")
43
+ end
44
+
41
45
  def registered_modules_uncached
42
46
  registered_gems.flat_map { |registry| modules_from_registry(registry) }
43
47
  .select { |v| valid_registered_module?(v) }.uniq
@@ -0,0 +1,23 @@
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
+ def detect_by_path(path)
10
+ detect_by_path_optional(path) || raise_not_found(path)
11
+ end
12
+
13
+ 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
18
+ end
19
+ nil
20
+ end
21
+ end
22
+ end
23
+ end
@@ -9,6 +9,8 @@ module Avm
9
9
  enable_listable
10
10
  lists.add_symbol :category, :instance_stereotypes, :runners, :scms, :sources
11
11
 
12
+ WITH_PATH = [CATEGORY_SCMS, CATEGORY_SOURCES].freeze
13
+
12
14
  class << self
13
15
  enable_simple_cache
14
16
 
@@ -21,7 +23,15 @@ module Avm
21
23
 
22
24
  ::Avm::Registry.lists.category.each_value do |category|
23
25
  define_method "#{category}_uncached" do
24
- ::Avm::Registry::Base.new(category.to_s.camelize)
26
+ registry_class(category).new(category.to_s.camelize)
27
+ end
28
+ end
29
+
30
+ def registry_class(category)
31
+ if WITH_PATH.include?(category)
32
+ ::Avm::Registry::WithPath
33
+ else
34
+ ::Avm::Registry::Base
25
35
  end
26
36
  end
27
37
  end
@@ -33,13 +33,8 @@ module Avm
33
33
  private
34
34
 
35
35
  # @return [Avm::Scms::Base]
36
- def parent_scm
37
- parent_path = path.parent
38
- until parent_path.root?
39
- ::Avm::Registry.scms.detect_optional(parent_path).if_present { |v| return v }
40
- parent_path = parent_path.parent
41
- end
42
- nil
36
+ def parent_scm_uncached
37
+ ::Avm::Registry.scms.detect_by_path_optional(path.parent)
43
38
  end
44
39
  end
45
40
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Scms
8
+ class Null < ::Avm::Scms::Base
9
+ def update
10
+ # Do nothing
11
+ end
12
+ end
13
+ end
14
+ end
@@ -9,6 +9,8 @@ module Avm
9
9
  module Sources
10
10
  class Base
11
11
  module Configuration
12
+ CONFIGURATION_FILENAMES = %w[.avm.yml .avm.yaml].freeze
13
+
12
14
  # @return [Array<String>, nil]
13
15
  def read_configuration_as_shell_words(key)
14
16
  configuration.entry(key).value.if_present do |v|
@@ -16,14 +18,22 @@ module Avm
16
18
  end
17
19
  end
18
20
 
21
+ # Utility to read a configuration as a [EacRubyUtils::Envs::Command].
22
+ # @return [EacRubyUtils::Envs::Command]
23
+ def read_configuration_as_env_command(key)
24
+ read_configuration_as_shell_words(key).if_present do |v|
25
+ env.command(v).chdir(path)
26
+ end
27
+ end
28
+
19
29
  private
20
30
 
21
31
  # @return [EacConfig::YamlFileNode]
22
32
  def configuration_uncached
23
- ::Avm::Sources::Configuration::FILENAMES.each do |filename|
33
+ CONFIGURATION_FILENAMES.each do |filename|
24
34
  configuration_with_filename(filename, true)
25
35
  end
26
- configuration_with_filename(::Avm::Sources::Configuration::FILENAMES.first, false)
36
+ configuration_with_filename(CONFIGURATION_FILENAMES.first, false)
27
37
  end
28
38
 
29
39
  # @return [EacConfig::YamlFileNode, nil]
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'i18n'
5
+
6
+ module Avm
7
+ module Sources
8
+ class Base
9
+ module Locale
10
+ LOCALE_KEY = 'locale'
11
+
12
+ def locale
13
+ configured_locale || default_locale
14
+ end
15
+
16
+ def configured_locale
17
+ configuration.entry(LOCALE_KEY).value
18
+ end
19
+
20
+ def default_locale
21
+ ::I18n.default_locale
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -6,6 +6,12 @@ module Avm
6
6
  module Sources
7
7
  class Base
8
8
  module Testing
9
+ TEST_COMMAND_KEY = 'test.command'
10
+
11
+ def configured_test_command
12
+ read_configuration_as_env_command(TEST_COMMAND_KEY)
13
+ end
14
+
9
15
  # @return [Avm::Sources::Tester]
10
16
  def tester
11
17
  tester_class.new(self)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/registry'
4
+ require 'avm/scms/null'
4
5
  require 'eac_git'
5
6
  require 'eac_ruby_utils/core_ext'
6
7
 
@@ -20,8 +21,6 @@ module Avm
20
21
 
21
22
  abstract_methods :update, :valid?
22
23
 
23
- delegate :locale, to: :old_configuration
24
-
25
24
  # @return [EacRubyUtils::Envs::LocalEnv]
26
25
  def env
27
26
  ::EacRubyUtils::Envs::LocalEnv.new
@@ -47,7 +46,7 @@ module Avm
47
46
 
48
47
  # @return [Avm::Scms::Base]
49
48
  def scm_uncached
50
- ::Avm::Registry.scms.detect(path)
49
+ ::Avm::Registry.scms.detect_optional(path) || ::Avm::Scms::Null.new(path)
51
50
  end
52
51
  end
53
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.21.0'
4
+ VERSION = '0.22.0'
5
5
  end
@@ -8,13 +8,13 @@ module Avm
8
8
  module Sources
9
9
  class Base < ::Avm::EacRailsBase1::Sources::Base
10
10
  CONFIG_RU_SUBPATH = 'config.ru'
11
- SUBS_PATHS_DEFAULT = ['sub/*/*'].freeze
11
+ SUBS_INCLUDE_PATHS_DEFAULT = ['sub/*/*'].freeze
12
12
 
13
13
  def config_ru_path
14
14
  path.join(CONFIG_RU_SUBPATH)
15
15
  end
16
16
 
17
- def subs_paths_default
17
+ def subs_include_paths_default
18
18
  SUBS_PATHS_DEFAULT
19
19
  end
20
20
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase0
5
- VERSION = '0.4.0'
5
+ VERSION = '0.4.1'
6
6
  end
7
7
  end
@@ -8,14 +8,14 @@ module Avm
8
8
  module Sources
9
9
  class Base < ::Avm::EacRailsBase1::Sources::Base
10
10
  REDMINE_LIB_SUBPATH = 'lib/redmine.rb'
11
- SUBS_PATHS_DEFAULT = ['plugins/*'].freeze
11
+ SUBS_INCLUDE_PATHS_DEFAULT = ['plugins/*'].freeze
12
12
 
13
13
  def redmine_lib_path
14
14
  path.join(REDMINE_LIB_SUBPATH)
15
15
  end
16
16
 
17
- def subs_paths_default
18
- SUBS_PATHS_DEFAULT
17
+ def subs_include_paths_default
18
+ SUBS_INCLUDE_PATHS_DEFAULT
19
19
  end
20
20
 
21
21
  def valid?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRedmineBase0
5
- VERSION = '0.6.0'
5
+ VERSION = '0.6.1'
6
6
  end
7
7
  end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'avm/eac_redmine_plugin_base0/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'avm-eac_redmine_plugin_base0'
9
+ s.version = Avm::EacRedminePluginBase0::VERSION
10
+ s.authors = ['Eduardo H. Bogoni']
11
+ s.summary = 'E.A.C.\'s AVM base for Redmine plugins.'
12
+
13
+ s.files = Dir['{lib}/**/*']
14
+
15
+ s.add_dependency 'avm-eac_ruby_base1', '~> 0.7'
16
+ s.add_dependency 'eac_ruby_utils', '~> 0.95', '>= 0.95.1'
17
+
18
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5', '>= 0.5.1'
19
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/sources/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRedminePluginBase0
8
+ module Sources
9
+ class Base < ::Avm::EacRailsBase1::Sources::Base
10
+ DEFAULT_GEMFILE_PATH = 'PluginGemfile'
11
+ INIT_SUBPATH = 'init.rb'
12
+
13
+ # @return [String]
14
+ def default_gemfile_path
15
+ DEFAULT_GEMFILE_PATH
16
+ end
17
+
18
+ # @return [String]
19
+ def init_path
20
+ path.join(INIT_SUBPATH)
21
+ end
22
+
23
+ # @return [Boolean]
24
+ def valid?
25
+ init_path.exist?
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacRedminePluginBase0
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRedminePluginBase0
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/rspec/default_setup'
4
+ ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
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.119.0
4
+ version: 0.120.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: 2022-06-29 00:00:00.000000000 Z
11
+ date: 2022-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -92,6 +92,20 @@ dependencies:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: 0.5.2
95
+ - !ruby/object:Gem::Dependency
96
+ name: avm-eac_redmine_plugin_base0
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '0.1'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '0.1'
95
109
  - !ruby/object:Gem::Dependency
96
110
  name: avm-eac_ruby_base1
97
111
  requirement: !ruby/object:Gem::Requirement
@@ -540,6 +554,13 @@ files:
540
554
  - sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/apache_https_virtualhost.conf.template
541
555
  - sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/install_settings.sh.template
542
556
  - sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/start.sh.template
557
+ - sub/avm-eac_redmine_plugin_base0/Gemfile
558
+ - sub/avm-eac_redmine_plugin_base0/avm-eac_redmine_plugin_base0.gemspec
559
+ - sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0.rb
560
+ - sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0/sources/base.rb
561
+ - sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0/version.rb
562
+ - sub/avm-eac_redmine_plugin_base0/spec/rubocop_spec.rb
563
+ - sub/avm-eac_redmine_plugin_base0/spec/spec_helper.rb
543
564
  - sub/avm-eac_ruby_base1/Gemfile
544
565
  - sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec
545
566
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1.rb
@@ -769,6 +790,7 @@ files:
769
790
  - sub/avm/lib/avm/path_string.rb
770
791
  - sub/avm/lib/avm/registry.rb
771
792
  - sub/avm/lib/avm/registry/base.rb
793
+ - sub/avm/lib/avm/registry/with_path.rb
772
794
  - sub/avm/lib/avm/result.rb
773
795
  - sub/avm/lib/avm/rspec.rb
774
796
  - sub/avm/lib/avm/rspec/setup.rb
@@ -778,6 +800,7 @@ files:
778
800
  - sub/avm/lib/avm/scms/base.rb
779
801
  - sub/avm/lib/avm/scms/commit.rb
780
802
  - sub/avm/lib/avm/scms/inflector.rb
803
+ - sub/avm/lib/avm/scms/null.rb
781
804
  - sub/avm/lib/avm/self/docker_image.rb
782
805
  - sub/avm/lib/avm/self/instance.rb
783
806
  - sub/avm/lib/avm/self/instance/entry_keys.rb
@@ -785,14 +808,13 @@ files:
785
808
  - sub/avm/lib/avm/sources/base.rb
786
809
  - sub/avm/lib/avm/sources/base/configuration.rb
787
810
  - sub/avm/lib/avm/sources/base/instance.rb
811
+ - sub/avm/lib/avm/sources/base/locale.rb
788
812
  - sub/avm/lib/avm/sources/base/parent.rb
789
813
  - sub/avm/lib/avm/sources/base/subs.rb
790
814
  - sub/avm/lib/avm/sources/base/subs_paths.rb
791
815
  - sub/avm/lib/avm/sources/base/testing.rb
792
816
  - sub/avm/lib/avm/sources/configuration.rb
793
- - sub/avm/lib/avm/sources/configuration/locale.rb
794
817
  - sub/avm/lib/avm/sources/configuration/rubocop.rb
795
- - sub/avm/lib/avm/sources/configuration/tests.rb
796
818
  - sub/avm/lib/avm/sources/tester.rb
797
819
  - sub/avm/lib/avm/sources/tests.rb
798
820
  - sub/avm/lib/avm/sources/tests/builder.rb
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/patches/eac_ruby_gems_utils/gem'
4
- require 'i18n'
5
-
6
- module Avm
7
- module Sources
8
- class Configuration < ::EacConfig::OldConfigs
9
- module Locale
10
- LOCALE_KEY = :locale
11
-
12
- def locale
13
- read_entry(LOCALE_KEY) || ::I18n.default_locale
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/patches/eac_ruby_gems_utils/gem'
4
-
5
- module Avm
6
- module Sources
7
- class Configuration < ::EacConfig::OldConfigs
8
- module Tests
9
- BUNDLE_TEST_COMMAND_KEY = 'test.bundle_command'
10
- TEST_COMMAND_KEY = 'test.command'
11
-
12
- def any_test_command
13
- bundle_test_command || test_command
14
- end
15
-
16
- def test_command
17
- read_command(TEST_COMMAND_KEY)
18
- end
19
-
20
- def bundle_test_command
21
- read_entry(BUNDLE_TEST_COMMAND_KEY).if_present do |v|
22
- args = v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v)
23
- ::EacRubyGemsUtils::Gem.new(::File.dirname(storage_path)).bundle(*args).chdir_root
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end