avm 0.18.1 → 0.21.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 +4 -4
- data/lib/avm/scms/base.rb +13 -0
- data/lib/avm/sources/base/configuration.rb +15 -7
- data/lib/avm/sources/base/parent.rb +31 -0
- data/lib/avm/sources/base/subs.rb +55 -0
- data/lib/avm/sources/base/subs_paths.rb +32 -0
- data/lib/avm/sources/base.rb +10 -7
- data/lib/avm/sources/configuration/{_locale.rb → locale.rb} +5 -3
- data/lib/avm/sources/configuration/rubocop.rb +26 -0
- data/lib/avm/sources/configuration/tests.rb +29 -0
- data/lib/avm/sources/configuration.rb +5 -1
- data/lib/avm/version.rb +1 -1
- metadata +10 -7
- data/lib/avm/sources/configuration/_rubocop.rb +0 -24
- data/lib/avm/sources/configuration/_tests.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3439e5be72641bfbb2057567b3066ee5a9fa0bb230ac4b755e541a501b2f51af
|
4
|
+
data.tar.gz: 47d2db526602f0054663417bf5e3d519408df59ba1e03c0fb16c9dc5ef23871e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f50e41ecf763e2901de01276d03dffb24c4b1322ab28cca1c7d19a0860bddeef3433b42667209b480481c24e074bcbe05fb1148f13f6206427db1be33c160ca7
|
7
|
+
data.tar.gz: 6d93ed47691853ae5a56c0577de8606ab72126fe4a83eefbf9d68ca6a88f1c6960369e8a183671fefdeb235b3a23550bbe5271d2d03382c7030de549948b0619
|
data/lib/avm/scms/base.rb
CHANGED
@@ -6,6 +6,7 @@ module Avm
|
|
6
6
|
module Scms
|
7
7
|
class Base
|
8
8
|
enable_abstract_methods
|
9
|
+
enable_simple_cache
|
9
10
|
abstract_methods :update, :valid?
|
10
11
|
common_constructor :path do
|
11
12
|
self.path = path.to_pathname
|
@@ -28,6 +29,18 @@ module Avm
|
|
28
29
|
def to_s
|
29
30
|
name
|
30
31
|
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
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
|
43
|
+
end
|
31
44
|
end
|
32
45
|
end
|
33
46
|
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,26 +11,33 @@ module Avm
|
|
10
11
|
module Configuration
|
11
12
|
# @return [Array<String>, nil]
|
12
13
|
def read_configuration_as_shell_words(key)
|
13
|
-
configuration
|
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 [
|
21
|
+
# @return [EacConfig::YamlFileNode]
|
21
22
|
def configuration_uncached
|
22
23
|
::Avm::Sources::Configuration::FILENAMES.each do |filename|
|
23
|
-
|
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]
|
31
38
|
def old_configuration_uncached
|
32
|
-
::Avm::Sources::Configuration.find_in_path(path)
|
39
|
+
::Avm::Sources::Configuration.find_in_path(path) ||
|
40
|
+
::Avm::Sources::Configuration.temp_instance
|
33
41
|
end
|
34
42
|
end
|
35
43
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Sources
|
7
|
+
class Base
|
8
|
+
module Parent
|
9
|
+
# @return [Avm::Sources::Base]
|
10
|
+
def parent
|
11
|
+
parent_by_option || parent_by_search
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Avm::Sources::Base]
|
15
|
+
def parent_by_option
|
16
|
+
options[OPTION_PARENT]
|
17
|
+
end
|
18
|
+
|
19
|
+
# @return [Avm::Sources::Base]
|
20
|
+
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
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -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
|
data/lib/avm/sources/base.rb
CHANGED
@@ -21,11 +21,15 @@ module Avm
|
|
21
21
|
abstract_methods :update, :valid?
|
22
22
|
|
23
23
|
delegate :locale, to: :old_configuration
|
24
|
-
delegate :to_s, to: :path
|
25
24
|
|
26
|
-
# @return [
|
27
|
-
def
|
28
|
-
|
25
|
+
# @return [EacRubyUtils::Envs::LocalEnv]
|
26
|
+
def env
|
27
|
+
::EacRubyUtils::Envs::LocalEnv.new
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [Hash<String, Class>]
|
31
|
+
def extra_available_subcommands
|
32
|
+
{}
|
29
33
|
end
|
30
34
|
|
31
35
|
# @return [Pathname]
|
@@ -35,9 +39,8 @@ module Avm
|
|
35
39
|
path.relative_path_from(parent.path)
|
36
40
|
end
|
37
41
|
|
38
|
-
|
39
|
-
|
40
|
-
scm.subs.map { |subrepo| ::Avm::Registry.sources.detect(subrepo.path, parent: self) }
|
42
|
+
def to_s
|
43
|
+
"#{self.class}[#{path}]"
|
41
44
|
end
|
42
45
|
|
43
46
|
private
|
@@ -6,10 +6,12 @@ require 'i18n'
|
|
6
6
|
module Avm
|
7
7
|
module Sources
|
8
8
|
class Configuration < ::EacConfig::OldConfigs
|
9
|
-
|
9
|
+
module Locale
|
10
|
+
LOCALE_KEY = :locale
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
def locale
|
13
|
+
read_entry(LOCALE_KEY) || ::I18n.default_locale
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
module Sources
|
5
|
+
class Configuration < ::EacConfig::OldConfigs
|
6
|
+
module Rubocop
|
7
|
+
RUBOCOP_COMMAND_KEY = 'ruby.rubocop.command'
|
8
|
+
RUBOCOP_GEMFILE_KEY = 'ruby.rubocop.gemfile'
|
9
|
+
|
10
|
+
def rubocop_command
|
11
|
+
read_command(RUBOCOP_COMMAND_KEY)
|
12
|
+
end
|
13
|
+
|
14
|
+
def rubocop_gemfile
|
15
|
+
gemfile_path = read_entry(RUBOCOP_GEMFILE_KEY)
|
16
|
+
return nil if gemfile_path.blank?
|
17
|
+
|
18
|
+
gemfile_path = gemfile_path.to_pathname.expand_path(storage_path.parent)
|
19
|
+
return gemfile_path if gemfile_path.file?
|
20
|
+
|
21
|
+
raise "Gemfile path \"#{gemfile_path}\" does not exist or is not a file"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
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
|
@@ -7,7 +7,7 @@ require 'yaml'
|
|
7
7
|
module Avm
|
8
8
|
module Sources
|
9
9
|
class Configuration < ::EacConfig::OldConfigs
|
10
|
-
require_sub __FILE__
|
10
|
+
require_sub __FILE__, include_modules: true
|
11
11
|
|
12
12
|
FILENAMES = %w[.avm.yml .avm.yaml].freeze
|
13
13
|
|
@@ -28,6 +28,10 @@ module Avm
|
|
28
28
|
nil
|
29
29
|
end
|
30
30
|
|
31
|
+
def temp_instance
|
32
|
+
new(::Tempfile.new(['.avm', '.yaml']))
|
33
|
+
end
|
34
|
+
|
31
35
|
private
|
32
36
|
|
33
37
|
def internal_find_path(absolute_pathname)
|
data/lib/avm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_cli
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0.
|
67
|
+
version: '0.95'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0.
|
74
|
+
version: '0.95'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: eac_templates
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,11 +242,14 @@ files:
|
|
242
242
|
- lib/avm/sources/base.rb
|
243
243
|
- lib/avm/sources/base/configuration.rb
|
244
244
|
- lib/avm/sources/base/instance.rb
|
245
|
+
- lib/avm/sources/base/parent.rb
|
246
|
+
- lib/avm/sources/base/subs.rb
|
247
|
+
- lib/avm/sources/base/subs_paths.rb
|
245
248
|
- lib/avm/sources/base/testing.rb
|
246
249
|
- lib/avm/sources/configuration.rb
|
247
|
-
- lib/avm/sources/configuration/
|
248
|
-
- lib/avm/sources/configuration/
|
249
|
-
- lib/avm/sources/configuration/
|
250
|
+
- lib/avm/sources/configuration/locale.rb
|
251
|
+
- lib/avm/sources/configuration/rubocop.rb
|
252
|
+
- lib/avm/sources/configuration/tests.rb
|
250
253
|
- lib/avm/sources/tester.rb
|
251
254
|
- lib/avm/sources/tests.rb
|
252
255
|
- lib/avm/sources/tests/builder.rb
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module Sources
|
5
|
-
class Configuration < ::EacConfig::OldConfigs
|
6
|
-
RUBOCOP_COMMAND_KEY = 'ruby.rubocop.command'
|
7
|
-
RUBOCOP_GEMFILE_KEY = 'ruby.rubocop.gemfile'
|
8
|
-
|
9
|
-
def rubocop_command
|
10
|
-
read_command(RUBOCOP_COMMAND_KEY)
|
11
|
-
end
|
12
|
-
|
13
|
-
def rubocop_gemfile
|
14
|
-
gemfile_path = read_entry(RUBOCOP_GEMFILE_KEY)
|
15
|
-
return nil if gemfile_path.blank?
|
16
|
-
|
17
|
-
gemfile_path = gemfile_path.to_pathname.expand_path(storage_path.parent)
|
18
|
-
return gemfile_path if gemfile_path.file?
|
19
|
-
|
20
|
-
raise "Gemfile path \"#{gemfile_path}\" does not exist or is not a file"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,27 +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
|
-
BUNDLE_TEST_COMMAND_KEY = 'test.bundle_command'
|
9
|
-
TEST_COMMAND_KEY = 'test.command'
|
10
|
-
|
11
|
-
def any_test_command
|
12
|
-
bundle_test_command || test_command
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_command
|
16
|
-
read_command(TEST_COMMAND_KEY)
|
17
|
-
end
|
18
|
-
|
19
|
-
def bundle_test_command
|
20
|
-
read_entry(BUNDLE_TEST_COMMAND_KEY).if_present do |v|
|
21
|
-
args = v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v)
|
22
|
-
::EacRubyGemsUtils::Gem.new(::File.dirname(storage_path)).bundle(*args).chdir_root
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|