avm 0.17.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edd4c18a4938a22e0913c03f4fea9ecd3e88fad97b0b9af4c259921d7a599834
4
- data.tar.gz: 7120426eaba5a99f1138e588c1e2b1a8d3e5e424d1e4abc29ddeab703a99dd17
3
+ metadata.gz: 60254779c64e435b8f853ab931907a47eefb974428e2298dc82b2f6d308d642a
4
+ data.tar.gz: 8c054b755c9882ed5b1faaa0c521031edf3551139d04259e0e11895844b4ef63
5
5
  SHA512:
6
- metadata.gz: 314413e3a55d8a090b7f793846300b0be4fde3468865ab395358d1029c537c7974ee2190973be7a703b48cfcc2b22f1da2b02b0c0a00fb1a99b233fb3a0a6b1a
7
- data.tar.gz: 3f9eb9c95d16ab50104ee56aa8390df9d2eaf34a851e2168002b385f9189aa7df04153a8008595528a1ac167fab29732baeab251579ac6a577490691aa1cf40f
6
+ metadata.gz: 3b7aadec66e69a23688c07dffd62f05d1579a1b14c90f57f2e5e6b2caf460e59b394ac62fe60178428100caf5359ab04ae21fecf958748dd01553129cb7d3304
7
+ data.tar.gz: c7eddaff6582abdbbb12d6b09a919b199505c1d4189fc8a6696eec61c39f5c41d3b4670d92278b9d30e049b49a99271b0826cb4d079c1b6ab2190424029d0274
@@ -9,8 +9,8 @@ module Avm
9
9
  module AutoValues
10
10
  module Mailer
11
11
  ::Avm::Instances::EntryKeys.all.select { |c| c.to_s.start_with?('mailer.') }
12
- .reject { |c| c == ::Avm::Instances::EntryKeys::MAILER_ID }
13
- .each do |mailer_key|
12
+ .reject { |c| c == ::Avm::Instances::EntryKeys::MAILER_ID }
13
+ .each do |mailer_key|
14
14
  define_method ::Avm::Instances::Entry.auto_value_method_name(mailer_key) do
15
15
  mailer_auto_common(mailer_key)
16
16
  end
@@ -43,8 +43,10 @@ module Avm
43
43
 
44
44
  {
45
45
  '' => %w[data_fs_path fs_path host_id name source_instance_id],
46
+ admin: %w[username password api_key],
46
47
  database: %w[id hostname limit name password port system timeout username extra],
47
48
  docker: %w[registry],
49
+ fs: %w[url],
48
50
  mailer: {
49
51
  '' => %w[id from reply_to],
50
52
  smtp: %w[address port domain username password authentication openssl_verify_mode
@@ -17,7 +17,7 @@ module Avm
17
17
 
18
18
  def detect_optional(*registered_initialize_args)
19
19
  registered_modules.reverse.lazy.map { |klass| klass.new(*registered_initialize_args) }
20
- .find(&:valid?)
20
+ .find(&:valid?)
21
21
  end
22
22
 
23
23
  def provider_module_suffix
@@ -40,7 +40,7 @@ module Avm
40
40
 
41
41
  def registered_modules_uncached
42
42
  registered_gems.flat_map { |registry| modules_from_registry(registry) }
43
- .select { |v| valid_registered_module?(v) }.uniq
43
+ .select { |v| valid_registered_module?(v) }.uniq
44
44
  end
45
45
 
46
46
  def modules_from_registry(registry)
@@ -4,7 +4,7 @@ require 'avm/registry'
4
4
 
5
5
  ::RSpec.shared_examples 'not_in_avm_registry' do |registry_method = nil|
6
6
  registry_method.if_present(::Avm::Registry.registries) { |v| [::Avm::Registry.send(v)] }
7
- .each do |registry|
7
+ .each do |registry|
8
8
  context "when registry is #{registry}" do
9
9
  it 'is not in the avm registry' do
10
10
  expect(registry.registered_modules).not_to include(described_class)
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)
@@ -33,7 +33,7 @@ module Avm
33
33
  # @return [Array<Avm::Sources::Tests::Single>]
34
34
  def available_units
35
35
  @available_units ||= ([main_source] + main_source.subs)
36
- .map { |a_source| create_unit(a_source) }
36
+ .map { |a_source| create_unit(a_source) }
37
37
  end
38
38
 
39
39
  def available_units_from_main
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.17.0'
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.17.0
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-04-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
@@ -146,34 +146,34 @@ dependencies:
146
146
  requirements:
147
147
  - - "~>"
148
148
  - !ruby/object:Gem::Version
149
- version: '0.7'
150
- - - ">="
149
+ version: '0.14'
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.7.2
152
+ version: 0.14.1
153
153
  type: :development
154
154
  prerelease: false
155
155
  version_requirements: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0.7'
160
- - - ">="
159
+ version: '0.14'
160
+ - - "~>"
161
161
  - !ruby/object:Gem::Version
162
- version: 0.7.2
162
+ version: 0.14.1
163
163
  - !ruby/object:Gem::Dependency
164
164
  name: eac_ruby_gem_support
165
165
  requirement: !ruby/object:Gem::Requirement
166
166
  requirements:
167
167
  - - "~>"
168
168
  - !ruby/object:Gem::Version
169
- version: '0.2'
169
+ version: 0.5.1
170
170
  type: :development
171
171
  prerelease: false
172
172
  version_requirements: !ruby/object:Gem::Requirement
173
173
  requirements:
174
174
  - - "~>"
175
175
  - !ruby/object:Gem::Version
176
- version: '0.2'
176
+ version: 0.5.1
177
177
  description:
178
178
  email:
179
179
  executables: []
@@ -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