avm-tools 0.138.0 → 0.140.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/launcher/git/warp_base.rb +2 -2
- data/lib/avm/projects/stereotypes/git_subrepo/warp.rb +2 -2
- data/lib/avm/projects/stereotypes.rb +0 -9
- data/lib/avm/tools/core_ext.rb +0 -1
- data/lib/avm/tools/runner/launcher.rb +1 -0
- data/lib/avm/tools/runner/source/info.rb +0 -4
- data/lib/avm/tools/runner/source/test.rb +1 -1
- data/lib/avm/tools/runner/source.rb +0 -12
- data/lib/avm/tools/version.rb +1 -1
- metadata +6 -36
- data/lib/avm/launcher/context/instance_collector.rb +0 -46
- data/lib/avm/launcher/context/instance_discovery.rb +0 -56
- data/lib/avm/launcher/context/instance_manager/cached_instance.rb +0 -37
- data/lib/avm/launcher/context/instance_manager/cached_instances.rb +0 -35
- data/lib/avm/launcher/context/instance_manager.rb +0 -76
- data/lib/avm/launcher/context/settings.rb +0 -53
- data/lib/avm/launcher/context.rb +0 -94
- data/lib/avm/launcher/instances/base/cache.rb +0 -43
- data/lib/avm/launcher/instances/base.rb +0 -96
- data/lib/avm/launcher/instances/error.rb +0 -10
- data/lib/avm/launcher/instances/runner_helper.rb +0 -47
- data/lib/avm/launcher/instances/settings.rb +0 -55
- data/lib/avm/launcher/instances.rb +0 -6
- data/lib/avm/launcher/paths/logical.rb +0 -87
- data/lib/avm/launcher/paths.rb +0 -4
- data/lib/avm/launcher/project.rb +0 -18
- data/lib/avm/launcher/publish/base.rb +0 -47
- data/lib/avm/launcher/publish.rb +0 -4
- data/lib/avm/launcher/vendor/github.rb +0 -20
- data/lib/avm/launcher/vendor.rb +0 -3
- data/lib/avm/patches/i18n.rb +0 -22
- data/lib/avm/patches.rb +0 -9
- data/lib/avm/projects/stereotype/job_comparator.rb +0 -32
- data/lib/avm/projects/stereotypes/rails_application/local_project_mixin.rb +0 -18
- data/lib/avm/projects/stereotypes/rails_application.rb +0 -25
- data/lib/avm/projects/stereotypes/redmine_plugin.rb +0 -23
- data/lib/avm/stereotypes.rb +0 -9
- data/lib/avm/tools/source.rb +0 -64
- data/locale/en.yml +0 -7
- data/locale/pt-BR.yml +0 -7
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module Launcher
|
5
|
-
module Instances
|
6
|
-
module Base
|
7
|
-
module Cache
|
8
|
-
def cache_path(subpath)
|
9
|
-
File.join(cache_root, subpath)
|
10
|
-
end
|
11
|
-
|
12
|
-
def cache_key(key, &block)
|
13
|
-
v = cache_key_get(key)
|
14
|
-
return v if v.present? || block.nil?
|
15
|
-
|
16
|
-
v = yield
|
17
|
-
cache_key_write(key, v)
|
18
|
-
v
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def cache_key_get(key)
|
24
|
-
File.file?(cache_key_path(key)) ? File.read(cache_key_path(key)) : nil
|
25
|
-
end
|
26
|
-
|
27
|
-
def cache_key_write(key, value)
|
28
|
-
FileUtils.mkdir_p(File.dirname(cache_key_path(key)))
|
29
|
-
File.write(cache_key_path(key), value)
|
30
|
-
end
|
31
|
-
|
32
|
-
def cache_key_path(key)
|
33
|
-
File.join(cache_root, 'keys', key.parameterize)
|
34
|
-
end
|
35
|
-
|
36
|
-
def cache_root
|
37
|
-
File.join(::Avm::Launcher::Context.current.cache_root, name.parameterize)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,96 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base/cache'
|
4
|
-
require 'avm/launcher/errors/non_project'
|
5
|
-
require 'eac_ruby_utils/speaker/sender'
|
6
|
-
|
7
|
-
module Avm
|
8
|
-
module Launcher
|
9
|
-
module Instances
|
10
|
-
module Base
|
11
|
-
class << self
|
12
|
-
def extend_object(object)
|
13
|
-
object.extend ::EacRubyUtils::SimpleCache
|
14
|
-
object.extend ::EacRubyUtils::Speaker::Sender
|
15
|
-
object.extend ::Avm::Launcher::Instances::Base::Cache
|
16
|
-
super
|
17
|
-
end
|
18
|
-
|
19
|
-
def instanciate(path, parent)
|
20
|
-
unless path.is_a?(::Avm::Launcher::Instances::Base)
|
21
|
-
raise ::Avm::Launcher::Errors::NonProject, path unless path.project?
|
22
|
-
|
23
|
-
path.extend(::Avm::Launcher::Instances::Base)
|
24
|
-
path.parent = parent
|
25
|
-
end
|
26
|
-
path
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
attr_accessor :parent
|
31
|
-
|
32
|
-
def name
|
33
|
-
logical
|
34
|
-
end
|
35
|
-
|
36
|
-
def stereotype?(stereotype)
|
37
|
-
stereotypes.include?(stereotype)
|
38
|
-
end
|
39
|
-
|
40
|
-
def to_parent_path
|
41
|
-
return self unless @parent
|
42
|
-
|
43
|
-
logical.gsub(/\A#{Regexp.quote(@parent.logical)}/, '')
|
44
|
-
end
|
45
|
-
|
46
|
-
def project?
|
47
|
-
stereotypes.any?
|
48
|
-
end
|
49
|
-
|
50
|
-
def publish_run
|
51
|
-
stereotypes.each do |s|
|
52
|
-
next unless publish?(s)
|
53
|
-
|
54
|
-
infov(name, "publishing #{s.label}")
|
55
|
-
s.publish_class.new(self).run
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def publish_check
|
60
|
-
stereotypes.each do |s|
|
61
|
-
next unless publish?(s)
|
62
|
-
|
63
|
-
puts "#{name.to_s.cyan}|#{s.label}|" \
|
64
|
-
"#{s.publish_class.new(self).check}"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def project_name
|
69
|
-
::File.basename(logical)
|
70
|
-
end
|
71
|
-
|
72
|
-
def included?
|
73
|
-
!::Avm::Launcher::Context.current.settings.excluded_projects.include?(project_name)
|
74
|
-
end
|
75
|
-
|
76
|
-
def to_h
|
77
|
-
super.to_h.merge(parent: parent ? parent.logical : nil)
|
78
|
-
end
|
79
|
-
|
80
|
-
private
|
81
|
-
|
82
|
-
def publish?(stereotype)
|
83
|
-
return false unless stereotype.publish_class
|
84
|
-
return false unless options.stereotype_publishable?(stereotype)
|
85
|
-
|
86
|
-
filter = ::Avm::Launcher::Context.current.publish_options[:stereotype]
|
87
|
-
filter.blank? ? true : filter == stereotype.name.demodulize
|
88
|
-
end
|
89
|
-
|
90
|
-
def options_uncached
|
91
|
-
::Avm::Launcher::Context.current.settings.instance_settings(self)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/launcher/context'
|
4
|
-
require 'avm/tools/core_ext'
|
5
|
-
require 'avm/launcher/context/instance_collector'
|
6
|
-
|
7
|
-
module Avm
|
8
|
-
module Launcher
|
9
|
-
module Instances
|
10
|
-
module RunnerHelper
|
11
|
-
common_concern do
|
12
|
-
runner_definition do
|
13
|
-
bool_opt '--all', 'Select all instances.'
|
14
|
-
bool_opt '--pending', 'Select pending instances.'
|
15
|
-
bool_opt '--recache', 'Rewrite instances cache.'
|
16
|
-
end
|
17
|
-
|
18
|
-
set_callback :run, :before, :setup_cache
|
19
|
-
end
|
20
|
-
|
21
|
-
def context
|
22
|
-
@context ||= ::Avm::Launcher::Context.current
|
23
|
-
end
|
24
|
-
|
25
|
-
def instances
|
26
|
-
collector = ::Avm::Launcher::Context::InstanceCollector.new(context)
|
27
|
-
collector.add_all if parsed.all?
|
28
|
-
collector.add_pending if parsed.pending?
|
29
|
-
parsed.instance_path.flat_map { |p| collector.add_path(p) }
|
30
|
-
collector.instances
|
31
|
-
end
|
32
|
-
|
33
|
-
def instance_stereotypes(instance)
|
34
|
-
instance.stereotypes.map(&:label).join(', ')
|
35
|
-
end
|
36
|
-
|
37
|
-
def instance_label(instance)
|
38
|
-
"#{instance.name} [#{instance_stereotypes(instance)}]"
|
39
|
-
end
|
40
|
-
|
41
|
-
def setup_cache
|
42
|
-
::Avm::Launcher::Context.current.recache = parsed.recache?
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Launcher
|
7
|
-
module Instances
|
8
|
-
class Settings
|
9
|
-
DEFAULT_CURRENT_REVISION = 'origin/master'
|
10
|
-
DEFAULT_PUBLISH_REMOTE = 'publish'
|
11
|
-
PUBLISHABLE_KEY = :publishable
|
12
|
-
|
13
|
-
common_constructor :data do
|
14
|
-
self.data = (data.is_a?(Hash) ? data : {}).with_indifferent_access
|
15
|
-
end
|
16
|
-
|
17
|
-
def git_current_revision
|
18
|
-
data[__method__] || DEFAULT_CURRENT_REVISION
|
19
|
-
end
|
20
|
-
|
21
|
-
def git_publish_remote
|
22
|
-
data[__method__] || DEFAULT_PUBLISH_REMOTE
|
23
|
-
end
|
24
|
-
|
25
|
-
def publishable?
|
26
|
-
publishable_value ? true : false
|
27
|
-
end
|
28
|
-
|
29
|
-
def stereotype_publishable?(stereotype)
|
30
|
-
return publishable? unless publishable_value.is_a?(::Hash)
|
31
|
-
|
32
|
-
parse_publishable_value(publishable_value[stereotype.stereotype_name], true)
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def publishable_value
|
38
|
-
parse_publishable_value(data[PUBLISHABLE_KEY], false)
|
39
|
-
end
|
40
|
-
|
41
|
-
def parse_publishable_value(value, hash_to_true)
|
42
|
-
return value.with_indifferent_access if parse_publishable_value_hash?(value, hash_to_true)
|
43
|
-
return true if value.nil? || value == true
|
44
|
-
return false if value == false
|
45
|
-
|
46
|
-
value ? true : false
|
47
|
-
end
|
48
|
-
|
49
|
-
def parse_publishable_value_hash?(value, hash_to_true)
|
50
|
-
!hash_to_true && value.is_a?(::Hash)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/projects/stereotypes'
|
4
|
-
require 'avm/launcher/paths/real'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Launcher
|
8
|
-
module Paths
|
9
|
-
class Logical
|
10
|
-
include ::Comparable
|
11
|
-
include ::EacRubyUtils::SimpleCache
|
12
|
-
|
13
|
-
class << self
|
14
|
-
def from_h(context, hash)
|
15
|
-
parent_path = hash[:parent_path] ? from_h(context, hash[:parent_path]) : nil
|
16
|
-
new(context, parent_path, hash[:real], hash[:logical])
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
attr_reader :context, :real, :logical, :parent_path
|
21
|
-
|
22
|
-
def initialize(context, parent_path, real, logical)
|
23
|
-
@context = context
|
24
|
-
@parent_path = parent_path
|
25
|
-
@real = ::Avm::Launcher::Paths::Real.new(real)
|
26
|
-
@logical = logical
|
27
|
-
end
|
28
|
-
|
29
|
-
def <=>(other)
|
30
|
-
[logical, real] <=> [other.logical, other.real]
|
31
|
-
end
|
32
|
-
|
33
|
-
def to_s
|
34
|
-
logical
|
35
|
-
end
|
36
|
-
|
37
|
-
def to_h
|
38
|
-
{ logical: logical, real: real.to_s, parent_path: parent_path ? parent_path.to_h : nil }
|
39
|
-
end
|
40
|
-
|
41
|
-
def project?
|
42
|
-
stereotypes.any?
|
43
|
-
end
|
44
|
-
|
45
|
-
def children
|
46
|
-
r = []
|
47
|
-
Dir.entries(warped).each do |c|
|
48
|
-
c_path = ::File.join(warped, c)
|
49
|
-
next unless ::File.directory?(c_path)
|
50
|
-
next if c.start_with?('.')
|
51
|
-
|
52
|
-
r << build_child(c)
|
53
|
-
end
|
54
|
-
r
|
55
|
-
end
|
56
|
-
|
57
|
-
def included?
|
58
|
-
!context.settings.excluded_paths.include?(logical)
|
59
|
-
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
def stereotypes_uncached
|
64
|
-
::Avm::Projects::Stereotype.stereotypes.select { |s| s.match?(self) }
|
65
|
-
end
|
66
|
-
|
67
|
-
def build_child(name)
|
68
|
-
::Avm::Launcher::Paths::Logical.new(
|
69
|
-
context,
|
70
|
-
self,
|
71
|
-
::File.join(warped, name),
|
72
|
-
::File.join(logical, name)
|
73
|
-
)
|
74
|
-
end
|
75
|
-
|
76
|
-
def warped_uncached
|
77
|
-
if is_a?(::Avm::Launcher::Instances::Base)
|
78
|
-
stereotypes.each do |s|
|
79
|
-
return s.warp_class.new(self) if s.warp_class
|
80
|
-
end
|
81
|
-
end
|
82
|
-
real
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
data/lib/avm/launcher/paths.rb
DELETED
data/lib/avm/launcher/project.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module Launcher
|
5
|
-
class Project
|
6
|
-
attr_reader :name, :instances
|
7
|
-
|
8
|
-
def initialize(name, instances)
|
9
|
-
@name = name
|
10
|
-
@instances = instances.to_a
|
11
|
-
end
|
12
|
-
|
13
|
-
def to_s
|
14
|
-
name
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/launcher/errors/base'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Launcher
|
7
|
-
module Publish
|
8
|
-
class Base
|
9
|
-
attr_reader :instance
|
10
|
-
|
11
|
-
def initialize(instance)
|
12
|
-
@instance = instance
|
13
|
-
end
|
14
|
-
|
15
|
-
def run
|
16
|
-
s = check
|
17
|
-
info("Check: #{s}")
|
18
|
-
return unless s.status == ::Avm::Launcher::Publish::CheckResult::STATUS_PENDING
|
19
|
-
|
20
|
-
publish
|
21
|
-
end
|
22
|
-
|
23
|
-
def check
|
24
|
-
s = check_with_rescue
|
25
|
-
::Avm::Launcher::Context.current.instance_manager.publish_state_set(
|
26
|
-
instance, stereotype.stereotype_name, s.status
|
27
|
-
)
|
28
|
-
s
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def stereotype
|
34
|
-
self.class.name.deconstantize.constantize
|
35
|
-
end
|
36
|
-
|
37
|
-
def check_with_rescue
|
38
|
-
internal_check
|
39
|
-
rescue ::Avm::Launcher::Errors::Base => e
|
40
|
-
::Avm::Launcher::Publish::CheckResult.blocked("Error: #{e}")
|
41
|
-
rescue ::Avm::Launcher::Git::Error => e
|
42
|
-
::Avm::Launcher::Publish::CheckResult.blocked("Git error: #{e}")
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
data/lib/avm/launcher/publish.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module Launcher
|
5
|
-
module Vendor
|
6
|
-
module Github
|
7
|
-
class << self
|
8
|
-
def to_ssh_url(url)
|
9
|
-
return nil if url.blank?
|
10
|
-
|
11
|
-
url_no_dot_git = url.gsub(/\.git\z/, '')
|
12
|
-
|
13
|
-
m = %r{\Ahttps://github.com/([^/]+)/([^/]+)\z}.match(url_no_dot_git.to_s)
|
14
|
-
m ? "git@github.com:#{m[1]}/#{m[2]}.git" : url
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/avm/launcher/vendor.rb
DELETED
data/lib/avm/patches/i18n.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/tools/self'
|
4
|
-
require 'i18n'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Patches
|
8
|
-
module I18n
|
9
|
-
class << self
|
10
|
-
def setup_i18n
|
11
|
-
::I18n.load_path += locale_files_paths.map(&:to_path)
|
12
|
-
end
|
13
|
-
|
14
|
-
def locale_files_paths
|
15
|
-
::Avm::Tools::Self.root.join('locale').glob('*.yml')
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
::Avm::Patches::I18n.setup_i18n
|
data/lib/avm/patches.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Projects
|
7
|
-
module Stereotype
|
8
|
-
class JobComparator
|
9
|
-
common_constructor :job1, :job2
|
10
|
-
|
11
|
-
def result
|
12
|
-
return -1 if run_before?(job1, job2)
|
13
|
-
return 1 if run_before?(job2, job1)
|
14
|
-
|
15
|
-
job1.object_id <=> job2.class.name
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def run_before?(a_job, other_job)
|
21
|
-
return false unless a_job.respond_to?(:run_before)
|
22
|
-
|
23
|
-
a_job.run_before.map(&:to_sym).include?(job_stereotype_key(other_job))
|
24
|
-
end
|
25
|
-
|
26
|
-
def job_stereotype_key(job)
|
27
|
-
job.class.name.split('::')[0..-2].join('::').demodulize.variableize.to_sym
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/projects/stereotypes/ruby_gem/local_project_mixin'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Projects
|
8
|
-
module Stereotypes
|
9
|
-
class RailsApplication
|
10
|
-
module LocalProjectMixin
|
11
|
-
common_concern do
|
12
|
-
include ::Avm::Projects::Stereotypes::RubyGem::LocalProjectMixin
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/projects/stereotype'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Projects
|
8
|
-
module Stereotypes
|
9
|
-
class RailsApplication
|
10
|
-
require_sub __FILE__
|
11
|
-
include Avm::Projects::Stereotype
|
12
|
-
|
13
|
-
class << self
|
14
|
-
def match?(path)
|
15
|
-
File.exist?(path.real.subpath('config.ru')) && path.real.basename != 'dummy'
|
16
|
-
end
|
17
|
-
|
18
|
-
def color
|
19
|
-
:magenta
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/projects/stereotype'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Projects
|
7
|
-
module Stereotypes
|
8
|
-
class RedminePlugin
|
9
|
-
include Avm::Projects::Stereotype
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def match?(path)
|
13
|
-
File.exist?(path.real.subpath('init.rb'))
|
14
|
-
end
|
15
|
-
|
16
|
-
def color
|
17
|
-
:light_magenta
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/lib/avm/stereotypes.rb
DELETED
data/lib/avm/tools/source.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/registry'
|
4
|
-
require 'avm/sources/configuration'
|
5
|
-
require 'avm/launcher/paths/real'
|
6
|
-
require 'avm/projects/stereotype/job_comparator'
|
7
|
-
require 'eac_ruby_utils/core_ext'
|
8
|
-
require 'avm/projects/stereotypes'
|
9
|
-
require 'i18n'
|
10
|
-
|
11
|
-
module Avm
|
12
|
-
module Tools
|
13
|
-
class Source
|
14
|
-
enable_simple_cache
|
15
|
-
common_constructor :path do
|
16
|
-
self.path = path.to_pathname
|
17
|
-
source_stereotypes_mixins
|
18
|
-
end
|
19
|
-
|
20
|
-
delegate :configuration, to: :avm_instance
|
21
|
-
delegate :to_s, to: :path
|
22
|
-
|
23
|
-
def locale
|
24
|
-
configuration.if_present(&:locale) || ::I18n.default_locale
|
25
|
-
end
|
26
|
-
|
27
|
-
# Backward compatibility with [Avm::Launcher::Paths::Logical].
|
28
|
-
# @return [Avm::Launcher::Paths::Real].
|
29
|
-
def real
|
30
|
-
::Avm::Launcher::Paths::Real.new(path.to_path)
|
31
|
-
end
|
32
|
-
|
33
|
-
def run_job(job, job_args = [])
|
34
|
-
stereotypes_jobs(job, job_args).each(&:run)
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def avm_instance_uncached
|
40
|
-
::Avm::Registry.sources.detect(path)
|
41
|
-
end
|
42
|
-
|
43
|
-
def stereotypes_jobs(job, job_args)
|
44
|
-
job_class_method = "#{job}_class"
|
45
|
-
r = []
|
46
|
-
stereotypes.each do |stereotype|
|
47
|
-
r << stereotype.send(job_class_method).new(self, *job_args) if
|
48
|
-
stereotype.send(job_class_method).present?
|
49
|
-
end
|
50
|
-
r.sort { |a, b| ::Avm::Projects::Stereotype::JobComparator.new(a, b).result }
|
51
|
-
end
|
52
|
-
|
53
|
-
def stereotypes_uncached
|
54
|
-
::Avm::Projects::Stereotypes.list.select { |s| s.match?(self) }
|
55
|
-
end
|
56
|
-
|
57
|
-
def source_stereotypes_mixins
|
58
|
-
stereotypes.each do |s|
|
59
|
-
s.local_project_mixin_module.if_present { |v| singleton_class.include(v) }
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
data/locale/en.yml
DELETED