avm-tools 0.117.3 → 0.118.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fec1bb05188ea00085f3ca44ed3945e58675f2dddb1593fd857312ce98caa45
4
- data.tar.gz: 695a666752439b000d12d60da7ee84c1b34aba488a650409eedeb2708702a8f1
3
+ metadata.gz: 934d4ed06e787c60b6d3bb79b2962290ab933e7dc4b75a0f2a7b767e346d8ed6
4
+ data.tar.gz: ed4f80fe5ec3bac6ae64e6efc6c8bf95f47e228ecc6445f79f9ab9807239278e
5
5
  SHA512:
6
- metadata.gz: fb85f443966aa7612f54b69f367a0b72df3d9ba4016cb6b4b4ea8e1f927d34c6d3716bcbdfd1f2638faba539b50d7042043d202469ffb604e35f41ea6b8e5906
7
- data.tar.gz: d3629c61d983caee50edfc740da31ff96d031e9632f170ce25be6f73687295baa5c6fe410ffb32260c212290c0716fb0534a1229884be2849bfa3206bc84dac5
6
+ metadata.gz: c9fe3ccc4c3b9c5527405cf534c1ac481bacf9be50cadca02511a6a58311fde0132e1905ac466eb0a0d3b9529f36f2174b7100e4581a4842c4870f93952f2065
7
+ data.tar.gz: 7f6e8a7c43bedeeb8bf8c28d3fbd0d6467c5ec41ab7914b46d978a6adba1babfbbe8c7809d86744165ac2edffa6bc58a2475ab57d84106360a76696793718e70
@@ -14,7 +14,6 @@ module Avm
14
14
  def run
15
15
  show_instance
16
16
  show_source
17
- show_subs
18
17
  end
19
18
 
20
19
  private
@@ -29,13 +28,6 @@ module Avm
29
28
  infov 'SCM', runner_context.call(:subject).scm
30
29
  end
31
30
 
32
- def show_subs
33
- infov 'Sub applications', instance.avm_instance.subs.count
34
- instance.avm_instance.subs.each do |subapp|
35
- infov ' * ', "#{subapp.relative_path} [#{subapp.class}]"
36
- end
37
- end
38
-
39
31
  def instance
40
32
  runner_context.call(:instance)
41
33
  end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/tools/core_ext'
4
+
5
+ module Avm
6
+ module Tools
7
+ class Runner
8
+ class AppSrc
9
+ class Subs
10
+ PADDING = ' '
11
+
12
+ runner_with :help, :output do
13
+ desc 'Output source\'s subs.'
14
+ bool_opt '-i', '--info'
15
+ bool_opt '-R', '--recursive'
16
+ bool_opt '-t', '--tree'
17
+ end
18
+
19
+ def run
20
+ start_banner
21
+ run_output
22
+ end
23
+
24
+ def start_banner
25
+ infov 'Include PATH', runner_context.call(:subject).subs_include_path
26
+ infov 'Exclude PATH', runner_context.call(:subject).subs_exclude_path
27
+ infov 'Count', runner_context.call(:subject).subs.count
28
+ end
29
+
30
+ def output_content
31
+ b = []
32
+ runner_context.call(:subject).subs.each do |sub|
33
+ b += sub_output_content_lines(sub, 0)
34
+ end
35
+ b.map { |line| "#{line}\n" }.join
36
+ end
37
+
38
+ def sub_info_label(sub)
39
+ return '' unless parsed.info?
40
+
41
+ ' [' + {
42
+ 'CLASS' => sub.class.name
43
+ }.map { |k, v| "#{k}: #{v}" }.join(', ') + ']'
44
+ end
45
+
46
+ def sub_label(sub, level)
47
+ sub_self_label(sub, level) + sub_info_label(sub)
48
+ end
49
+
50
+ def sub_self_label(sub, level)
51
+ if parsed.tree?
52
+ (PADDING * level) + sub.relative_path.to_s
53
+ else
54
+ sub.path.relative_path_from(runner_context.call(:subject).path).to_s
55
+ end
56
+ end
57
+
58
+ def sub_output_content_lines(sub, level)
59
+ [sub_label(sub, level)] + sub_subs_output_content_lines(sub, level)
60
+ end
61
+
62
+ def sub_subs_output_content_lines(sub, level)
63
+ return [] unless parsed.recursive?
64
+
65
+ sub.subs.flat_map { |sub_sub| sub_output_content_lines(sub_sub, level + 1) }
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.117.3'
5
+ VERSION = '0.118.0'
6
6
  end
7
7
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_config/yaml_file_node'
3
4
  require 'eac_ruby_utils/core_ext'
4
5
  require 'eac_ruby_utils/yaml'
5
6
  require 'shellwords'
@@ -10,21 +11,27 @@ module Avm
10
11
  module Configuration
11
12
  # @return [Array<String>, nil]
12
13
  def read_configuration_as_shell_words(key)
13
- configuration[key].if_present do |v|
14
+ configuration.entry(key).value.if_present do |v|
14
15
  v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v.to_s)
15
16
  end
16
17
  end
17
18
 
18
19
  private
19
20
 
20
- # @return [Hash]
21
+ # @return [EacConfig::YamlFileNode]
21
22
  def configuration_uncached
22
23
  ::Avm::Sources::Configuration::FILENAMES.each do |filename|
23
- file_path = path.join(filename)
24
- return ::EacRubyUtils::Yaml.load_file(file_path).with_indifferent_access if
25
- file_path.exist?
24
+ configuration_with_filename(filename, true)
26
25
  end
27
- {}
26
+ configuration_with_filename(::Avm::Sources::Configuration::FILENAMES.first, false)
27
+ end
28
+
29
+ # @return [EacConfig::YamlFileNode, nil]
30
+ def configuration_with_filename(filename, needs_exist)
31
+ file_path = path.join(filename)
32
+ return ::EacConfig::YamlFileNode.new(file_path) if !needs_exist || file_path.exist?
33
+
34
+ nil
28
35
  end
29
36
 
30
37
  # @return [Avm::Sources::Configuration]
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/sources/base/subs_paths'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Sources
8
+ class Base
9
+ module Subs
10
+ CONFIGURATION_SUBS_EXCLUDE_PATHS_KEY = 'subs.exclude_path'
11
+ CONFIGURATION_SUBS_INCLUDE_PATHS_KEY = 'subs.include_path'
12
+ SUBS_EXCLUDE_PATHS_DEFAULT = [].freeze
13
+ SUBS_INCLUDE_PATHS_DEFAULT = ['sub/*'].freeze
14
+
15
+ # @return [Enumerable<Avm::Sources::Base>]
16
+ def subs
17
+ subs_paths_to_search
18
+ .map { |sub_path| ::Avm::Registry.sources.detect_optional(sub_path, parent: self) }
19
+ .reject(&:blank?)
20
+ .sort_by { |sub| [sub.path] }
21
+ end
22
+
23
+ def subs_paths_to_search
24
+ subs_include_paths.flat_map do |subs_include_path|
25
+ ::Pathname.glob(path.join(subs_include_path)).reject do |sub_path|
26
+ subs_exclude_paths.any? do |subs_exclude_path|
27
+ sub_path.fnmatch?(path.join(subs_exclude_path).to_path)
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ %i[include exclude].each do |type|
34
+ %i[path paths configured_paths default_paths].each do |method_suffix|
35
+ obj_method_name = "subs_#{type}_path_obj"
36
+
37
+ define_method "subs_#{type}_#{method_suffix}" do
38
+ send(obj_method_name).send(method_suffix)
39
+ end
40
+
41
+ define_method "#{obj_method_name}_uncached" do
42
+ ::Avm::Sources::Base::SubsPaths.new(
43
+ self,
44
+ self.class.const_get("CONFIGURATION_SUBS_#{type}_PATHS_KEY".upcase),
45
+ self.class.const_get("SUBS_#{type}_PATHS_DEFAULT".upcase)
46
+ )
47
+ end
48
+
49
+ private "#{obj_method_name}_uncached" # rubocop:disable Style/AccessModifierDeclarations
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Sources
7
+ class Base
8
+ class SubsPaths
9
+ SUBS_PATH_SEPARATOR = ':'
10
+
11
+ common_constructor :source, :configuration_key, :default_paths
12
+
13
+ # @return [String]
14
+ def path
15
+ paths.join(SUBS_PATH_SEPARATOR)
16
+ end
17
+
18
+ # @return [Array<String>]
19
+ def paths
20
+ configured_paths || default_paths
21
+ end
22
+
23
+ # @return [Array<String>]
24
+ def configured_paths
25
+ source.configuration.entry(configuration_key).value.if_present do |v|
26
+ v.split(SUBS_PATH_SEPARATOR)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -33,11 +33,6 @@ module Avm
33
33
  "#{self.class}[#{path}]"
34
34
  end
35
35
 
36
- # @return [Enumerable<Avm::Sources::Base>]
37
- def subs
38
- scm.subs.map { |subrepo| ::Avm::Registry.sources.detect(subrepo.path, parent: self) }
39
- end
40
-
41
36
  private
42
37
 
43
38
  # @return [Avm::Scms::Base]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.19.0'
4
+ VERSION = '0.20.0'
5
5
  end
@@ -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_rails_base1', '~> 0.2'
15
+ s.add_dependency 'avm-eac_rails_base1', '~> 0.3'
16
16
  s.add_dependency 'eac_ruby_utils', '~> 0.80', '>= 0.80.2'
17
17
 
18
18
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
@@ -0,0 +1,27 @@
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 EacRailsBase0
8
+ module Sources
9
+ class Base < ::Avm::EacRailsBase1::Sources::Base
10
+ CONFIG_RU_SUBPATH = 'config.ru'
11
+ SUBS_PATHS_DEFAULT = ['sub/*/*'].freeze
12
+
13
+ def config_ru_path
14
+ path.join(CONFIG_RU_SUBPATH)
15
+ end
16
+
17
+ def subs_paths_default
18
+ SUBS_PATHS_DEFAULT
19
+ end
20
+
21
+ def valid?
22
+ super && config_ru_path.exist?
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase0
5
- VERSION = '0.3.0'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
@@ -12,6 +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.6'
15
16
  s.add_dependency 'avm-eac_webapp_base0', '~> 0.3'
16
17
  s.add_dependency 'eac_ruby_gems_utils', '~> 0.9', '>= 0.9.9'
17
18
  s.add_dependency 'eac_ruby_utils', '~> 0.68'
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_ruby_base1/sources/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ module Sources
9
+ class Base < ::Avm::EacRubyBase1::Sources::Base
10
+ CONFIG_RU_SUBPATH = 'config.ru'
11
+ SUBS_PATHS_DEFAULT = ['sub/*/*'].freeze
12
+
13
+ def config_ru_path
14
+ path.join(CONFIG_RU_SUBPATH)
15
+ end
16
+
17
+ def subs_paths_default
18
+ SUBS_PATHS_DEFAULT
19
+ end
20
+
21
+ def valid?
22
+ super && config_ru_path.exist?
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase1
5
- VERSION = '0.2.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,template}/**/*']
14
14
 
15
- s.add_dependency 'avm-eac_rails_base1', '~> 0.2'
15
+ s.add_dependency 'avm-eac_rails_base1', '~> 0.3'
16
16
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.2'
17
17
  s.add_dependency 'curb', '~> 0.9.10'
18
18
  s.add_dependency 'eac_fs', '~> 0.4'
@@ -0,0 +1,27 @@
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 EacRedmineBase0
8
+ module Sources
9
+ class Base < ::Avm::EacRailsBase1::Sources::Base
10
+ REDMINE_LIB_SUBPATH = 'lib/redmine.rb'
11
+ SUBS_PATHS_DEFAULT = ['plugins/*'].freeze
12
+
13
+ def redmine_lib_path
14
+ path.join(REDMINE_LIB_SUBPATH)
15
+ end
16
+
17
+ def subs_paths_default
18
+ SUBS_PATHS_DEFAULT
19
+ end
20
+
21
+ def valid?
22
+ super && redmine_lib_path.exist?
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRedmineBase0
5
- VERSION = '0.5.2'
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  end
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.117.3
4
+ version: 0.118.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-21 00:00:00.000000000 Z
11
+ date: 2022-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -398,6 +398,7 @@ files:
398
398
  - lib/avm/tools/runner/app_src/ruby/bundler/gemfile_lock.rb
399
399
  - lib/avm/tools/runner/app_src/ruby/bundler/gemfile_lock/git.rb
400
400
  - lib/avm/tools/runner/app_src/ruby/bundler/incompatible.rb
401
+ - lib/avm/tools/runner/app_src/subs.rb
401
402
  - lib/avm/tools/runner/app_src/test.rb
402
403
  - lib/avm/tools/runner/app_src/update.rb
403
404
  - lib/avm/tools/runner/app_src/version_bump.rb
@@ -490,6 +491,7 @@ files:
490
491
  - sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/instance.rb
491
492
  - sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/runners.rb
492
493
  - sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/runners/base.rb
494
+ - sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/sources/base.rb
493
495
  - sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb
494
496
  - sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_host_spec.rb
495
497
  - sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_host_spec_files/apache_host_spec_no_ssl_content.conf
@@ -516,6 +518,7 @@ files:
516
518
  - sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler/systemd_unit.rb
517
519
  - sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/bundle.rb
518
520
  - sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb
521
+ - sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/sources/base.rb
519
522
  - sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit.rb
520
523
  - sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/service.rb
521
524
  - sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.rb
@@ -534,6 +537,7 @@ files:
534
537
  - sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
535
538
  - sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb
536
539
  - sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/rest_api.rb
540
+ - sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/base.rb
537
541
  - sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb
538
542
  - sub/avm-eac_redmine_base0/spec/rubocop_spec.rb
539
543
  - sub/avm-eac_redmine_base0/spec/spec_helper.rb
@@ -773,6 +777,8 @@ files:
773
777
  - sub/avm/lib/avm/sources/base/configuration.rb
774
778
  - sub/avm/lib/avm/sources/base/instance.rb
775
779
  - sub/avm/lib/avm/sources/base/parent.rb
780
+ - sub/avm/lib/avm/sources/base/subs.rb
781
+ - sub/avm/lib/avm/sources/base/subs_paths.rb
776
782
  - sub/avm/lib/avm/sources/base/testing.rb
777
783
  - sub/avm/lib/avm/sources/configuration.rb
778
784
  - sub/avm/lib/avm/sources/configuration/locale.rb