avm-tools 0.138.0 → 0.139.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: e7bf83b886d7158f37723c559d52eab9c7212390f673937cd81fa75209b7f6ff
4
- data.tar.gz: 88797a72e234d4fa2900365cf3793fd7f2ea91ae9f8f804e8d624bc2946c3f17
3
+ metadata.gz: 0e13784fd3035a1563c1eab7234d82b6b8d097ed58aae86ee922b1cbbb0fa208
4
+ data.tar.gz: 29fa552a0905ccad677c5b2557d7216b3ec7b388d59ea928375bc8603c2a4588
5
5
  SHA512:
6
- metadata.gz: 3ea44e51d1adf4b4607f08f12437c6cda8bb26a180ff1b3be138cf492e4b025e0364be3e6a70bcc35704c9755a087636e111f7ffb187ebfed1654e0943489aa7
7
- data.tar.gz: 504f1b7e9c8e8019452078ba76abc89a13daee3969a8e25cb4a4a671e26c297a4efd8bf3ba34b383efde402217644c1779552ff9eef03b32892b4e0f6ab30ca8
6
+ metadata.gz: 8e7802bda4db106026decfb5b7e403f292b3c3fb0b998ab362b2feea704d8bee9c833f9fb0c9cfabb962e7fbf2b09a7c9630147332c6736d5511cc9ee7f385ec
7
+ data.tar.gz: a9c310b9a2c40c54a34b4768780e0d8ed7133b2f8cd1bad2d02e96c3890454e9b65a1e9395a94036543e5fa62620ba1d28f61b823de9d1a3a17e6effad34fce4
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'avm/launcher/git/mirror_update'
4
4
  require 'avm/launcher/instances/error'
5
- require 'avm/launcher/vendor/github'
5
+ require 'avm/git/vendor/github'
6
6
  require 'avm/projects/stereotypes/git/publish'
7
7
 
8
8
  module Avm
@@ -59,7 +59,7 @@ module Avm
59
59
  end
60
60
 
61
61
  def target_remote_url
62
- ::Avm::Launcher::Vendor::Github.to_ssh_url(source_git.git.remote(source_remote_name).url)
62
+ ::Avm::Git::Vendor::Github.to_ssh_url(source_git.git.remote(source_remote_name).url)
63
63
  end
64
64
  end
65
65
  end
@@ -4,7 +4,7 @@ require 'eac_ruby_utils/simple_cache'
4
4
  require 'avm/launcher/git/sub_warp_base'
5
5
  require 'avm/launcher/errors/base'
6
6
  require 'avm/launcher/paths/real'
7
- require 'avm/launcher/vendor/github'
7
+ require 'avm/git/vendor/github'
8
8
 
9
9
  module Avm
10
10
  module Projects
@@ -77,7 +77,7 @@ module Avm
77
77
  end
78
78
 
79
79
  def target_remote_url
80
- ::Avm::Launcher::Vendor::Github.to_ssh_url(
80
+ ::Avm::Git::Vendor::Github.to_ssh_url(
81
81
  parent_git_warped.subrepo_remote_url(to_parent_git_path)
82
82
  )
83
83
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.138.0'
5
+ VERSION = '0.139.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.138.0
4
+ version: 0.139.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-02 00:00:00.000000000 Z
11
+ date: 2022-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.45'
39
+ version: '0.46'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.45'
46
+ version: '0.46'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: avm-eac_ruby_base1
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -98,14 +98,14 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '0.4'
101
+ version: '0.5'
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: '0.4'
108
+ version: '0.5'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: clipboard
111
111
  requirement: !ruby/object:Gem::Requirement
@@ -252,13 +252,6 @@ files:
252
252
  - Gemfile
253
253
  - exe/avm
254
254
  - lib/avm.rb
255
- - lib/avm/launcher/context.rb
256
- - lib/avm/launcher/context/instance_collector.rb
257
- - lib/avm/launcher/context/instance_discovery.rb
258
- - lib/avm/launcher/context/instance_manager.rb
259
- - lib/avm/launcher/context/instance_manager/cached_instance.rb
260
- - lib/avm/launcher/context/instance_manager/cached_instances.rb
261
- - lib/avm/launcher/context/settings.rb
262
255
  - lib/avm/launcher/git.rb
263
256
  - lib/avm/launcher/git/base.rb
264
257
  - lib/avm/launcher/git/base/class_methods.rb
@@ -273,22 +266,13 @@ files:
273
266
  - lib/avm/launcher/git/sub_warp_base.rb
274
267
  - lib/avm/launcher/git/warp_base.rb
275
268
  - lib/avm/launcher/instances.rb
276
- - lib/avm/launcher/instances/base.rb
277
- - lib/avm/launcher/instances/base/cache.rb
278
- - lib/avm/launcher/instances/error.rb
279
- - lib/avm/launcher/instances/runner_helper.rb
280
- - lib/avm/launcher/instances/settings.rb
281
269
  - lib/avm/launcher/paths.rb
282
- - lib/avm/launcher/paths/logical.rb
283
270
  - lib/avm/launcher/project.rb
284
271
  - lib/avm/launcher/publish.rb
285
- - lib/avm/launcher/publish/base.rb
286
272
  - lib/avm/launcher/ruby.rb
287
273
  - lib/avm/launcher/ruby/gem.rb
288
274
  - lib/avm/launcher/ruby/gem/build.rb
289
275
  - lib/avm/launcher/ruby/gem/specification.rb
290
- - lib/avm/launcher/vendor.rb
291
- - lib/avm/launcher/vendor/github.rb
292
276
  - lib/avm/patches.rb
293
277
  - lib/avm/patches/i18n.rb
294
278
  - lib/avm/projects.rb
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Launcher
7
- class Context
8
- class InstanceCollector
9
- common_constructor :context
10
-
11
- def add_all
12
- instances_set.merge(context.instances)
13
- self
14
- end
15
-
16
- def add_path(path)
17
- instances_set.merge(instances_on_path(path))
18
- self
19
- end
20
-
21
- def add_pending
22
- instances_set.merge(context.pending_instances)
23
- self
24
- end
25
-
26
- def instances
27
- instances_set.sort
28
- end
29
-
30
- private
31
-
32
- def instance_match?(instance, instance_name)
33
- ::File.fnmatch?(instance_name, instance.name)
34
- end
35
-
36
- def instances_on_path(path)
37
- context.instances.select { |instance| instance_match?(instance, path) }
38
- end
39
-
40
- def instances_set
41
- @instances_set ||= ::Set.new
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'ruby-progressbar'
4
- require 'avm/launcher/instances/base'
5
-
6
- module Avm
7
- module Launcher
8
- class Context
9
- class InstanceDiscovery
10
- attr_reader :instances
11
-
12
- def initialize(context)
13
- @context = context
14
- @progress = ::ProgressBar.create(title: 'Instance discovery', total: 1)
15
- @instances = path_instances(@context.root, nil)
16
- ensure
17
- @progress&.finish
18
- end
19
-
20
- private
21
-
22
- def path_instances(path, parent_instance)
23
- update_progress_format(path)
24
- on_rescued_path_instances(path) do |r|
25
- if path.project?
26
- parent_instance = ::Avm::Launcher::Instances::Base.instanciate(path, parent_instance)
27
- r << path
28
- end
29
- children = path.children
30
- update_progress_count(children)
31
- r.concat(children.flat_map { |c| path_instances(c, parent_instance) })
32
- end
33
- end
34
-
35
- def on_rescued_path_instances(path)
36
- r = []
37
- begin
38
- yield(r) if path.included?
39
- rescue StandardError => e
40
- warn("#{path}: #{e}")
41
- end
42
- r
43
- end
44
-
45
- def update_progress_format(path)
46
- @progress.format = "%t (Paths: %c/%C, Current: #{path.logical}) |%B| %a"
47
- end
48
-
49
- def update_progress_count(children)
50
- @progress.total += children.count
51
- @progress.increment
52
- end
53
- end
54
- end
55
- end
56
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/launcher/instances/base'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
- module Avm
7
- module Launcher
8
- class Context
9
- class InstanceManager
10
- class CachedInstance
11
- enable_speaker
12
- enable_simple_cache
13
- common_constructor :cached_instances, :data
14
-
15
- private
16
-
17
- def instance_uncached
18
- ::Avm::Launcher::Instances::Base.instanciate(path, parent_instance)
19
- rescue ::Avm::Launcher::Errors::NonProject
20
- warn "Cached instance \"#{data[:logical]}\" not found"
21
- nil
22
- end
23
-
24
- def parent_instance_uncached
25
- data[:parent]
26
- .if_present { |v| cached_instances.by_logical_path(v) }
27
- .if_present(&:instance)
28
- end
29
-
30
- def path_uncached
31
- ::Avm::Launcher::Paths::Logical.from_h(cached_instances.context, data)
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/launcher/context/instance_manager/cached_instance'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
- module Avm
7
- module Launcher
8
- class Context
9
- class InstanceManager
10
- class CachedInstances
11
- enable_simple_cache
12
- common_constructor :context, :content
13
-
14
- def instances
15
- content.keys.map { |k| by_logical_path(k).instance }.reject(&:blank?)
16
- end
17
-
18
- def by_logical_path(key)
19
- cached_instances[key].if_blank do
20
- cached_instances[key] = ::Avm::Launcher::Context::InstanceManager::CachedInstance.new(
21
- self, content.fetch(key)
22
- )
23
- end
24
- end
25
-
26
- private
27
-
28
- def cached_instances_uncached
29
- {}
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,76 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'avm/launcher/publish/check_result'
5
- require('yaml')
6
-
7
- module Avm
8
- module Launcher
9
- class Context
10
- class InstanceManager
11
- require_sub __FILE__
12
- enable_simple_cache
13
- common_constructor :context
14
-
15
- def publish_state_set(instance, stereotype_name, check_status)
16
- data = cached_instances_file_content_uncached
17
- data[instance.logical] ||= {}
18
- data[instance.logical][:publish_state] ||= {}
19
- data[instance.logical][:publish_state][stereotype_name] = check_status
20
- write_cache_file(data)
21
- end
22
-
23
- def pending_instances
24
- instances.select { |instance| pending_instance?(instance) }
25
- end
26
-
27
- private
28
-
29
- def instances_uncached
30
- (cached_instances || search_instances).select(&:included?)
31
- end
32
-
33
- def search_instances
34
- cache_instances(::Avm::Launcher::Context::InstanceDiscovery.new(context).instances)
35
- end
36
-
37
- def cached_instances
38
- return nil if context.recache
39
- return nil unless cached_instances_file_content
40
-
41
- CachedInstances.new(self, cached_instances_file_content).instances
42
- end
43
-
44
- def cached_instances_file_content_uncached
45
- r = YAML.load_file(cache_file_path)
46
- r.is_a?(::Hash) ? r : nil
47
- rescue Errno::ENOENT
48
- nil
49
- end
50
-
51
- def cache_instances(instances)
52
- write_cache_file(Hash[instances.map { |i| [i.logical, i.to_h] }])
53
- instances
54
- end
55
-
56
- def write_cache_file(data)
57
- ::File.write(cache_file_path, data.to_yaml)
58
- end
59
-
60
- def cache_file_path
61
- ::File.join(context.cache_root, 'instances.yml')
62
- end
63
-
64
- def pending_instance?(instance)
65
- data = cached_instances_file_content
66
- return false unless data[instance.logical]
67
- return false unless data[instance.logical][:publish_state].is_a?(Hash)
68
-
69
- data[instance.logical][:publish_state].any? do |_k, v|
70
- ::Avm::Launcher::Publish::CheckResult.pending_status?(v)
71
- end
72
- end
73
- end
74
- end
75
- end
76
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/launcher/instances/settings'
4
- require 'eac_ruby_utils/simple_cache'
5
- require 'yaml'
6
-
7
- module Avm
8
- module Launcher
9
- class Context
10
- class Settings
11
- include ::EacRubyUtils::SimpleCache
12
-
13
- def initialize(file)
14
- unless ::File.exist?(file)
15
- ::FileUtils.mkdir_p(::File.dirname(file))
16
- ::File.write(file, {}.to_yaml)
17
- end
18
- @data = YAML.load_file(file)
19
- end
20
-
21
- def instance_settings(instance)
22
- ::Avm::Launcher::Instances::Settings.new(value(['Instances', instance.name]))
23
- end
24
-
25
- private
26
-
27
- def excluded_projects_uncached
28
- enum_value(%w[Projects Exclude])
29
- end
30
-
31
- def excluded_paths_uncached
32
- enum_value(%w[Paths Exclude])
33
- end
34
-
35
- def enum_value(path)
36
- r = value(path)
37
- r.is_a?(Enumerable) ? r : []
38
- end
39
-
40
- def value(path)
41
- node_value(@data, path)
42
- end
43
-
44
- def node_value(data, path)
45
- return data if path.empty?
46
- return nil unless data.is_a?(Hash)
47
-
48
- node_value(data[path.first], path.drop(1))
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,94 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_support/core_ext/hash/indifferent_access'
4
- require 'avm/launcher/context/instance_manager'
5
- require 'eac_ruby_utils/simple_cache'
6
- require 'eac_cli/speaker'
7
- require 'avm/launcher/context/instance_discovery'
8
- require 'avm/launcher/context/settings'
9
- require 'avm/launcher/paths/logical'
10
- require 'avm/launcher/project'
11
- require 'avm/tools/self'
12
-
13
- module Avm
14
- module Launcher
15
- class Context
16
- include ::EacRubyUtils::SimpleCache
17
- enable_speaker
18
-
19
- class << self
20
- attr_writer :current
21
-
22
- def current
23
- @current ||= default
24
- end
25
-
26
- def default
27
- @default ||= Context.new
28
- end
29
- end
30
-
31
- attr_reader :root, :settings, :cache_root
32
- attr_accessor :publish_options, :recache, :instance_manager
33
-
34
- CONFIG_PATH_PREFIX = 'launcher'
35
-
36
- def initialize(options = {})
37
- @options = options.with_indifferent_access
38
- @root = ::Avm::Launcher::Paths::Logical.new(self, nil, build_option(:projects_root), '/')
39
- @settings = ::Avm::Launcher::Context::Settings.new(build_option(:settings_file))
40
- @cache_root = build_option(:cache_root)
41
- @publish_options = { new: false, confirm: false, stereotype: nil }
42
- @instance_manager = ::Avm::Launcher::Context::InstanceManager.new(self)
43
- @recache = false
44
- end
45
-
46
- def instance(name)
47
- instances.find { |i| i.name == name }
48
- end
49
-
50
- def instances
51
- @instance_manager.instances
52
- end
53
-
54
- def pending_instances
55
- @instance_manager.pending_instances
56
- end
57
-
58
- private
59
-
60
- def build_option(key)
61
- @options[key] || config_option(key) || default_option(key)
62
- end
63
-
64
- def config_option(key)
65
- ::Avm::Self::Instance.default.entry([CONFIG_PATH_PREFIX, key].join('.')).optional_value
66
- end
67
-
68
- def default_cache_root
69
- ::Avm::Tools::Self.application.cache_dir.join('launcher')
70
- end
71
-
72
- def default_option(key)
73
- send("default_#{key}".underscore)
74
- end
75
-
76
- def default_projects_root
77
- '.'
78
- end
79
-
80
- def default_settings_file
81
- ::Avm::Tools::Self.application.config_dir.join('launcher.yaml')
82
- end
83
-
84
- def projects_uncached
85
- r = {}
86
- instances.each do |i|
87
- r[i.project_name] ||= []
88
- r[i.project_name] << i
89
- end
90
- r.map { |name, instances| ::Avm::Launcher::Project.new(name, instances) }
91
- end
92
- end
93
- end
94
- end
@@ -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,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module Launcher
5
- module Instances
6
- class Error < StandardError
7
- end
8
- end
9
- end
10
- 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
@@ -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
@@ -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
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/launcher/vendor/github'