avm 0.5.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/data/package/dump.rb +3 -3
- data/lib/avm/{files → data}/rotate.rb +1 -1
- data/lib/avm/docker/runner.rb +8 -0
- data/lib/avm/instances/application.rb +25 -0
- data/lib/avm/instances/base/auto_values/access.rb +40 -0
- data/lib/avm/instances/base/auto_values/admin.rb +19 -0
- data/lib/avm/instances/base/auto_values/data.rb +26 -0
- data/lib/avm/instances/base/auto_values/database.rb +76 -0
- data/lib/avm/instances/base/auto_values/filesystem.rb +45 -0
- data/lib/avm/instances/base/auto_values/mailer.rb +34 -0
- data/lib/avm/instances/base/auto_values/ruby.rb +15 -0
- data/lib/avm/instances/base/auto_values/source.rb +15 -0
- data/lib/avm/instances/base/auto_values/system.rb +23 -0
- data/lib/avm/instances/base/auto_values/web.rb +46 -0
- data/lib/avm/instances/base/auto_values.rb +21 -0
- data/lib/avm/instances/base/dockerizable.rb +45 -0
- data/lib/avm/instances/base/entry_keys.rb +22 -0
- data/lib/avm/instances/base.rb +64 -0
- data/lib/avm/instances/entries.rb +43 -0
- data/lib/avm/instances/entry.rb +54 -0
- data/lib/avm/instances/entry_keys.rb +57 -0
- data/lib/avm/instances/runner.rb +38 -0
- data/lib/avm/instances.rb +8 -0
- data/lib/avm/jobs/base.rb +1 -0
- data/lib/avm/registry/base.rb +65 -0
- data/lib/avm/registry.rb +29 -0
- data/lib/avm/rspec/setup.rb +22 -0
- data/lib/avm/rspec/shared_examples/in_avm_registry.rb +11 -0
- data/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +14 -0
- data/lib/avm/{git/organize.rb → rspec.rb} +2 -4
- data/lib/avm/runners/base.rb +31 -0
- data/lib/avm/scms/base.rb +28 -0
- data/lib/avm/scms/commit.rb +43 -0
- data/lib/avm/self/docker_image.rb +14 -0
- data/lib/avm/self/instance/entry_keys.rb +12 -0
- data/lib/avm/self/instance.rb +24 -0
- data/lib/avm/source_stereotypes/base.rb +21 -0
- data/lib/avm/sources/base.rb +22 -0
- data/lib/avm/version.rb +1 -1
- metadata +58 -67
- data/lib/avm/files/appendable/file_content.rb +0 -24
- data/lib/avm/files/appendable/plain_directory.rb +0 -25
- data/lib/avm/files/appendable/resource_base.rb +0 -13
- data/lib/avm/files/appendable/tar_output_command.rb +0 -26
- data/lib/avm/files/appendable/templatized_directory.rb +0 -29
- data/lib/avm/files/appendable.rb +0 -55
- data/lib/avm/files/appender.rb +0 -11
- data/lib/avm/files/deploy.rb +0 -71
- data/lib/avm/files/formatter/formats/base.rb +0 -62
- data/lib/avm/files/formatter/formats/generic_plain.rb +0 -34
- data/lib/avm/files/formatter/formats/html.rb +0 -45
- data/lib/avm/files/formatter/formats/javascript.rb +0 -24
- data/lib/avm/files/formatter/formats/json.rb +0 -27
- data/lib/avm/files/formatter/formats/php.rb +0 -22
- data/lib/avm/files/formatter/formats/python.rb +0 -22
- data/lib/avm/files/formatter/formats/ruby.rb +0 -22
- data/lib/avm/files/formatter/formats/xml.rb +0 -28
- data/lib/avm/files/formatter/formats.rb +0 -13
- data/lib/avm/files/formatter/utf8_assert.rb +0 -74
- data/lib/avm/files/formatter.rb +0 -90
- data/lib/avm/files.rb +0 -9
- data/lib/avm/git/auto_commit/commit_info.rb +0 -23
- data/lib/avm/git/auto_commit/rules/base.rb +0 -39
- data/lib/avm/git/auto_commit/rules/last.rb +0 -19
- data/lib/avm/git/auto_commit/rules/manual.rb +0 -45
- data/lib/avm/git/auto_commit/rules/new.rb +0 -24
- data/lib/avm/git/auto_commit/rules/nth.rb +0 -31
- data/lib/avm/git/auto_commit/rules/unique.rb +0 -21
- data/lib/avm/git/auto_commit/rules.rb +0 -31
- data/lib/avm/git/auto_commit_path/ruby.rb +0 -20
- data/lib/avm/git/auto_commit_path.rb +0 -28
- data/lib/avm/git/commit/class_methods.rb +0 -31
- data/lib/avm/git/commit/deploy.rb +0 -38
- data/lib/avm/git/commit/deploy_methods.rb +0 -19
- data/lib/avm/git/commit/diff_tree_line.rb +0 -32
- data/lib/avm/git/commit/file.rb +0 -46
- data/lib/avm/git/commit.rb +0 -59
- data/lib/avm/git/file_auto_fixup.rb +0 -83
- data/lib/avm/git/issue/complete/commits.rb +0 -42
- data/lib/avm/git/issue/complete/git_subrepos.rb +0 -23
- data/lib/avm/git/issue/complete/local_branch.rb +0 -54
- data/lib/avm/git/issue/complete/local_tag.rb +0 -39
- data/lib/avm/git/issue/complete/push.rb +0 -54
- data/lib/avm/git/issue/complete/remote.rb +0 -33
- data/lib/avm/git/issue/complete/test.rb +0 -45
- data/lib/avm/git/issue/complete/tracker.rb +0 -28
- data/lib/avm/git/issue/complete/validation.rb +0 -31
- data/lib/avm/git/issue/complete/validations.rb +0 -53
- data/lib/avm/git/issue/complete/working_tree.rb +0 -19
- data/lib/avm/git/issue/complete.rb +0 -51
- data/lib/avm/git/issue/deliver.rb +0 -56
- data/lib/avm/git/issue.rb +0 -11
- data/lib/avm/git/organize/reference_update.rb +0 -34
- data/lib/avm/git/organize/repository.rb +0 -76
- data/lib/avm/git/revision_test.rb +0 -105
- data/lib/avm/git/subrepo_check/parent.rb +0 -51
- data/lib/avm/git/subrepo_check/remote.rb +0 -89
- data/lib/avm/git/subrepo_check/show_result.rb +0 -32
- data/lib/avm/git/subrepo_check.rb +0 -38
- data/lib/avm/git/subrepo_checks.rb +0 -59
- data/lib/avm/git.rb +0 -10
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_config/node'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Instances
|
8
|
+
class Entry
|
9
|
+
class << self
|
10
|
+
def auto_value_method_name(suffix)
|
11
|
+
"auto_#{suffix.to_s.gsub('.', '_')}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
common_constructor :parent, :suffix, :options
|
16
|
+
|
17
|
+
def auto_value
|
18
|
+
parent.respond_to?(auto_value_method, true) ? parent.send(auto_value_method) : nil
|
19
|
+
end
|
20
|
+
|
21
|
+
def auto_value_method
|
22
|
+
self.class.auto_value_method_name(suffix)
|
23
|
+
end
|
24
|
+
|
25
|
+
def full_path
|
26
|
+
(parent.path_prefix + suffix_as_array).join('.')
|
27
|
+
end
|
28
|
+
|
29
|
+
def optional_value
|
30
|
+
read(required: false, noinput: true) || auto_value
|
31
|
+
end
|
32
|
+
|
33
|
+
def read(extra_options = {})
|
34
|
+
::EacConfig::Node.context.current.entry(full_path, options.merge(extra_options)).value
|
35
|
+
end
|
36
|
+
|
37
|
+
def suffix_as_array
|
38
|
+
if suffix.is_a?(::Array)
|
39
|
+
suffix.dup
|
40
|
+
else
|
41
|
+
::EacConfig::PathsHash.parse_entry_key(suffix.to_s)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def value
|
46
|
+
optional_value || read
|
47
|
+
end
|
48
|
+
|
49
|
+
def write(value)
|
50
|
+
::EacConfig::Node.context.current.entry(full_path).value = value
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Instances
|
7
|
+
module EntryKeys
|
8
|
+
class << self
|
9
|
+
def all
|
10
|
+
all_keys.to_a
|
11
|
+
end
|
12
|
+
|
13
|
+
def keys_consts_set(prefix, suffixes)
|
14
|
+
if suffixes.is_a?(::Hash)
|
15
|
+
keys_consts_set_from_hash(prefix, suffixes)
|
16
|
+
elsif suffixes.is_a?(::Enumerable)
|
17
|
+
keys_consts_set_from_enum(prefix, suffixes)
|
18
|
+
else
|
19
|
+
raise "Unmapped suffixes class: #{suffixes.class}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def key_const_set(prefix, suffix)
|
24
|
+
key = [prefix, suffix].reject(&:blank?).join('.')
|
25
|
+
const_set(key.gsub('.', '_').upcase, key)
|
26
|
+
all_keys << key
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def all_keys
|
32
|
+
@all_keys ||= ::Set.new
|
33
|
+
end
|
34
|
+
|
35
|
+
def keys_consts_set_from_enum(prefix, suffixes)
|
36
|
+
suffixes.each { |suffix| key_const_set(prefix, suffix) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def keys_consts_set_from_hash(prefix, suffixes)
|
40
|
+
suffixes.each { |k, v| keys_consts_set(prefix.to_s + (k.blank? ? '' : ".#{k}"), v) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
{
|
45
|
+
'' => %w[fs_path host_id source_instance_id],
|
46
|
+
database: %w[id hostname limit name password port system timeout username extra],
|
47
|
+
docker: %w[registry],
|
48
|
+
mailer: {
|
49
|
+
'' => %w[id from reply_to],
|
50
|
+
smtp: %w[address port domain username password authentication starttls_auto]
|
51
|
+
},
|
52
|
+
ssh: %w[hostname port url username],
|
53
|
+
web: %w[authority hostname path port scheme url userinfo]
|
54
|
+
}.each { |prefix, suffixes| keys_consts_set(prefix, suffixes) }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Instances
|
7
|
+
class Runner
|
8
|
+
class << self
|
9
|
+
def instance_class
|
10
|
+
::Avm.const_get(stereotype_name).const_get('Instance')
|
11
|
+
end
|
12
|
+
|
13
|
+
def stereotype_module
|
14
|
+
::Avm.const_get(stereotype_name)
|
15
|
+
end
|
16
|
+
|
17
|
+
def stereotype_name
|
18
|
+
name.demodulize
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
description = "Utilities for #{stereotype_name} instances."
|
23
|
+
runner_with :help, :subcommands do
|
24
|
+
desc description
|
25
|
+
pos_arg 'instance-id'
|
26
|
+
subcommands
|
27
|
+
end
|
28
|
+
|
29
|
+
delegate :instance_class, :stereotype_module, :stereotype_name, to: :class
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def instance_uncached
|
34
|
+
self.class.instance_class.by_id(parsed.instance_id)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/avm/jobs/base.rb
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/gems_registry'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Registry
|
8
|
+
class Base
|
9
|
+
enable_simple_cache
|
10
|
+
common_constructor :module_suffix
|
11
|
+
|
12
|
+
def detect(*registered_initialize_args)
|
13
|
+
detect_optional(*registered_initialize_args) ||
|
14
|
+
raise("No registered module valid for #{registered_initialize_args}" \
|
15
|
+
" (Module suffix: #{module_suffix})")
|
16
|
+
end
|
17
|
+
|
18
|
+
def detect_optional(*registered_initialize_args)
|
19
|
+
registered_modules.lazy.map { |klass| klass.new(*registered_initialize_args) }
|
20
|
+
.find(&:valid?)
|
21
|
+
end
|
22
|
+
|
23
|
+
def provider_module_suffix
|
24
|
+
"#{module_suffix}::Provider"
|
25
|
+
end
|
26
|
+
|
27
|
+
def single_module_suffix
|
28
|
+
"#{module_suffix}::Base"
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_s
|
32
|
+
"#{self.class}[#{module_suffix}]"
|
33
|
+
end
|
34
|
+
|
35
|
+
def valid_registered_module?(a_module)
|
36
|
+
a_module.is_a?(::Class) && !a_module.abstract?
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def registered_modules_uncached
|
42
|
+
(single_registered_modules + provider_registered_modules)
|
43
|
+
.select { |v| valid_registered_module?(v) }.uniq.sort_by { |s| [s.name] }
|
44
|
+
end
|
45
|
+
|
46
|
+
def single_registered_modules
|
47
|
+
single_instance_registry.registered.map(&:registered_module)
|
48
|
+
end
|
49
|
+
|
50
|
+
def provider_registered_modules
|
51
|
+
provider_registry.registered.map(&:registered_module).flat_map do |provider_class|
|
52
|
+
provider_class.new.all
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def single_instance_registry_uncached
|
57
|
+
::EacRubyUtils::GemsRegistry.new(single_module_suffix)
|
58
|
+
end
|
59
|
+
|
60
|
+
def provider_registry_uncached
|
61
|
+
::EacRubyUtils::GemsRegistry.new(provider_module_suffix)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/lib/avm/registry.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/gems_registry'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Registry
|
8
|
+
require_sub __FILE__
|
9
|
+
enable_listable
|
10
|
+
lists.add_symbol :category, :instance_stereotypes, :runners, :scms, :source_stereotypes
|
11
|
+
|
12
|
+
class << self
|
13
|
+
enable_simple_cache
|
14
|
+
|
15
|
+
# @return [Array<Avm::Registry::Base>]
|
16
|
+
def registries
|
17
|
+
lists.category.values.map { |c| send(c) }
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
::Avm::Registry.lists.category.each_value do |category|
|
23
|
+
define_method "#{category}_uncached" do
|
24
|
+
::Avm::Registry::Base.new(category.to_s.camelize)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Rspec
|
7
|
+
module Setup
|
8
|
+
def self.extended(obj)
|
9
|
+
obj.setup_in_avm_registry_example
|
10
|
+
obj.setup_not_in_avm_registry_example
|
11
|
+
end
|
12
|
+
|
13
|
+
def setup_in_avm_registry_example
|
14
|
+
require 'avm/rspec/shared_examples/in_avm_registry'
|
15
|
+
end
|
16
|
+
|
17
|
+
def setup_not_in_avm_registry_example
|
18
|
+
require 'avm/rspec/shared_examples/not_in_avm_registry'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/registry'
|
4
|
+
|
5
|
+
::RSpec.shared_examples 'in_avm_registry' do |registry_method|
|
6
|
+
let(:avm_registry) { ::Avm::Registry.send(registry_method) }
|
7
|
+
|
8
|
+
it 'is in the avm registry' do
|
9
|
+
expect(avm_registry.registered_modules).to include(described_class)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/registry'
|
4
|
+
|
5
|
+
::RSpec.shared_examples 'not_in_avm_registry' do |registry_method = nil|
|
6
|
+
registry_method.if_present(::Avm::Registry.registries) { |v| [::Avm::Registry.send(v)] }
|
7
|
+
.each do |registry|
|
8
|
+
context "when registry is #{registry}" do
|
9
|
+
it 'is not in the avm registry' do
|
10
|
+
expect(registry.registered_modules).not_to include(described_class)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Runners
|
7
|
+
class Base
|
8
|
+
enable_abstract_methods
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def command_argument
|
12
|
+
stereotype_name.underscore.dasherize
|
13
|
+
end
|
14
|
+
|
15
|
+
def stereotype_name
|
16
|
+
name.split('::')[-3]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
delegate :command_argument, :stereotype_name, to: :class
|
21
|
+
|
22
|
+
runner_with :help, :subcommands do
|
23
|
+
subcommands
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_s
|
27
|
+
stereotype_name
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Scms
|
7
|
+
class Base
|
8
|
+
enable_abstract_methods
|
9
|
+
abstract_methods :update, :valid?
|
10
|
+
common_constructor :path do
|
11
|
+
self.path = path.to_pathname
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Avm::Scms::Commit,NilClass]
|
15
|
+
def commit_if_change(_message = nil)
|
16
|
+
raise_abstract_method __method__
|
17
|
+
end
|
18
|
+
|
19
|
+
def name
|
20
|
+
self.class.name.demodulize
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_s
|
24
|
+
name
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Scms
|
7
|
+
class Commit
|
8
|
+
enable_abstract_methods
|
9
|
+
|
10
|
+
# @return [Array<Pathname>]
|
11
|
+
def changed_files
|
12
|
+
raise_abstract_method __method__
|
13
|
+
end
|
14
|
+
|
15
|
+
# @param other [Avm::Scms::Commit]
|
16
|
+
# @return [Avm::Scms::Commit]
|
17
|
+
def merge_with(_other)
|
18
|
+
raise_abstract_method __method__
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [Array<Pathname>]
|
22
|
+
def no_scm_changed_files
|
23
|
+
changed_files.reject { |path| scm_file?(path) }
|
24
|
+
end
|
25
|
+
|
26
|
+
# @param new_message [String]
|
27
|
+
def reword(_new_message)
|
28
|
+
raise_abstract_method __method__
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Array<Pathname>]
|
32
|
+
def scm_changed_files
|
33
|
+
changed_files.select { |path| scm_file?(path) }
|
34
|
+
end
|
35
|
+
|
36
|
+
# @param path [Pathname]
|
37
|
+
# @return [TrueClass,FalseClass]
|
38
|
+
def scm_file?(_path)
|
39
|
+
raise_abstract_method __method__
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/base'
|
4
|
+
require 'avm/self/docker_image'
|
5
|
+
require 'avm/self/instance/entry_keys'
|
6
|
+
require 'avm/eac_ubuntu_base0/docker_image'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Self
|
10
|
+
class Instance < ::Avm::Instances::Base
|
11
|
+
def docker_image_class
|
12
|
+
::Avm::Self::DockerImage
|
13
|
+
end
|
14
|
+
|
15
|
+
def docker_registry
|
16
|
+
read_entry(::Avm::Self::Instance::EntryKeys::DOCKER_REGISTRY_NAME)
|
17
|
+
end
|
18
|
+
|
19
|
+
def docker_run_arguments
|
20
|
+
['-e', "LOCAL_USER_ID=#{::Process.uid}"]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module SourceStereotypes
|
7
|
+
class Base
|
8
|
+
enable_abstract_methods
|
9
|
+
abstract_methods :valid?
|
10
|
+
common_constructor :source
|
11
|
+
|
12
|
+
def name
|
13
|
+
self.class.name
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
name
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/avm/sources/base.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/registry'
|
3
4
|
require 'eac_git'
|
4
5
|
require 'eac_ruby_utils/core_ext'
|
5
6
|
|
6
7
|
module Avm
|
7
8
|
module Sources
|
8
9
|
class Base
|
10
|
+
require_sub __FILE__
|
9
11
|
enable_simple_cache
|
10
12
|
enable_listable
|
11
13
|
lists.add_symbol :option, :parent
|
@@ -14,6 +16,7 @@ module Avm
|
|
14
16
|
self.options = self.class.lists.option.hash_keys_validate!(options)
|
15
17
|
end
|
16
18
|
|
19
|
+
delegate :locale, to: :configuration
|
17
20
|
delegate :to_s, to: :path
|
18
21
|
|
19
22
|
# @return [Avm::Sources::Base]
|
@@ -34,12 +37,31 @@ module Avm
|
|
34
37
|
.map { |subrepo| self.class.new(subrepo.subpath.expand_path(path), parent: self) }
|
35
38
|
end
|
36
39
|
|
40
|
+
def update
|
41
|
+
stereotype.update_source(self)
|
42
|
+
end
|
43
|
+
|
37
44
|
private
|
38
45
|
|
46
|
+
# @return [Avm::Sources::Configuration]
|
47
|
+
def configuration_uncached
|
48
|
+
::Avm::Sources::Configuration.find_in_path(path) || ::Avm::Sources::Configuration.new
|
49
|
+
end
|
50
|
+
|
39
51
|
# @return [EacGit::Local]
|
40
52
|
def git_repo_uncached
|
41
53
|
::EacGit::Local.new(path)
|
42
54
|
end
|
55
|
+
|
56
|
+
# @return [Avm::Scms::Base]
|
57
|
+
def scm_uncached
|
58
|
+
::Avm::Registry.scms.detect(path)
|
59
|
+
end
|
60
|
+
|
61
|
+
# @return [Avm::SourceStereotypes::Base]
|
62
|
+
def stereotype_uncached
|
63
|
+
::Avm::Registry.source_stereotypes.detect(self)
|
64
|
+
end
|
43
65
|
end
|
44
66
|
end
|
45
67
|
end
|
data/lib/avm/version.rb
CHANGED