avm 0.18.1 → 0.19.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: be0e77328fe54bdc9f2c63ee0c6f5bc234e9b993bf9c3174a376ecae7673f476
4
- data.tar.gz: 9d69cca78549d8f6b000a3efae2f6ea836cca9ec751cfca5a434caf2582f403b
3
+ metadata.gz: 60254779c64e435b8f853ab931907a47eefb974428e2298dc82b2f6d308d642a
4
+ data.tar.gz: 8c054b755c9882ed5b1faaa0c521031edf3551139d04259e0e11895844b4ef63
5
5
  SHA512:
6
- metadata.gz: 02b7a49f870144d0c730708d7f31f5279b763cdd660215934b40c775506551717009847f2b4fcfe03b730345ed8c8dce4a0b68d0816d06dce759c02a139da714
7
- data.tar.gz: 6a0ff9b34c497834575e288309987be34c449e68f000bdc139730c369dcb18469e51ea121b00289326a29b23bf7481c5b4ecc7dd35096a4c30dee33e2d487f20
6
+ metadata.gz: 3b7aadec66e69a23688c07dffd62f05d1579a1b14c90f57f2e5e6b2caf460e59b394ac62fe60178428100caf5359ab04ae21fecf958748dd01553129cb7d3304
7
+ data.tar.gz: c7eddaff6582abdbbb12d6b09a919b199505c1d4189fc8a6696eec61c39f5c41d3b4670d92278b9d30e049b49a99271b0826cb4d079c1b6ab2190424029d0274
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
@@ -29,7 +29,8 @@ module Avm
29
29
 
30
30
  # @return [Avm::Sources::Configuration]
31
31
  def old_configuration_uncached
32
- ::Avm::Sources::Configuration.find_in_path(path)
32
+ ::Avm::Sources::Configuration.find_in_path(path) ||
33
+ ::Avm::Sources::Configuration.temp_instance
33
34
  end
34
35
  end
35
36
  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
@@ -21,12 +21,6 @@ module Avm
21
21
  abstract_methods :update, :valid?
22
22
 
23
23
  delegate :locale, to: :old_configuration
24
- delegate :to_s, to: :path
25
-
26
- # @return [Avm::Sources::Base]
27
- def parent
28
- options[OPTION_PARENT]
29
- end
30
24
 
31
25
  # @return [Pathname]
32
26
  def relative_path
@@ -35,6 +29,10 @@ module Avm
35
29
  path.relative_path_from(parent.path)
36
30
  end
37
31
 
32
+ def to_s
33
+ "#{self.class}[#{path}]"
34
+ end
35
+
38
36
  # @return [Enumerable<Avm::Sources::Base>]
39
37
  def subs
40
38
  scm.subs.map { |subrepo| ::Avm::Registry.sources.detect(subrepo.path, parent: self) }
@@ -6,10 +6,12 @@ require 'i18n'
6
6
  module Avm
7
7
  module Sources
8
8
  class Configuration < ::EacConfig::OldConfigs
9
- LOCALE_KEY = :locale
9
+ module Locale
10
+ LOCALE_KEY = :locale
10
11
 
11
- def locale
12
- read_entry(LOCALE_KEY) || ::I18n.default_locale
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.18.1'
4
+ VERSION = '0.19.0'
5
5
  end
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.18.1
4
+ version: 0.19.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-04 00:00:00.000000000 Z
11
+ date: 2022-06-14 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.80'
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.80'
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,12 @@ 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
245
246
  - lib/avm/sources/base/testing.rb
246
247
  - lib/avm/sources/configuration.rb
247
- - lib/avm/sources/configuration/_locale.rb
248
- - lib/avm/sources/configuration/_rubocop.rb
249
- - lib/avm/sources/configuration/_tests.rb
248
+ - lib/avm/sources/configuration/locale.rb
249
+ - lib/avm/sources/configuration/rubocop.rb
250
+ - lib/avm/sources/configuration/tests.rb
250
251
  - lib/avm/sources/tester.rb
251
252
  - lib/avm/sources/tests.rb
252
253
  - 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