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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed2d914555d3c58362e1295400822e92705cae0150e957fd451d9bb88605bf52
|
4
|
+
data.tar.gz: 0fa211ad333f697fc6c07bb89205552f64e5be5730795e5828cb6b652eef500b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 153e38b2a7f25f90736f65388c2cdc61a011aefeee2247fdd94f0165624af5dc73b78cb7a7d31a39bec85e37712ec745b80eca5ac36f7eb2bd7a3aa129860af0
|
7
|
+
data.tar.gz: bf4e32eaf0b13d24215b29fde58b9d0dc44335050fad19ab86d6f970312d260ea63b6244e70372ccb72ada83e199bdf4d69ae2acb96c220090a4e6f3952821b8
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'avm/launcher/git/mirror_update'
|
4
4
|
require 'avm/launcher/instances/error'
|
5
|
-
require 'avm/
|
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::
|
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/
|
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::
|
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
|
@@ -1,20 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/projects/stereotype'
|
4
3
|
require 'eac_ruby_utils/core_ext'
|
5
4
|
|
6
5
|
module Avm
|
7
6
|
module Projects
|
8
7
|
module Stereotypes
|
9
8
|
require_sub __FILE__, base: nil
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def list
|
13
|
-
@list ||= constants.map { |c| const_get(c) }
|
14
|
-
.select { |c| c.included_modules.include?(Avm::Projects::Stereotype) }
|
15
|
-
.freeze
|
16
|
-
end
|
17
|
-
end
|
18
9
|
end
|
19
10
|
end
|
20
11
|
end
|
data/lib/avm/tools/core_ext.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/sources/runner'
|
4
|
-
require 'avm/tools/source'
|
5
4
|
require 'eac_cli/core_ext'
|
6
5
|
|
7
6
|
module Avm
|
@@ -10,20 +9,9 @@ module Avm
|
|
10
9
|
class Source < ::Avm::Sources::Runner
|
11
10
|
require_sub __FILE__
|
12
11
|
|
13
|
-
def instance_banner
|
14
|
-
infov 'Instance', instance
|
15
|
-
infov 'Stereotypes', instance.stereotypes.map(&:label).join(', ')
|
16
|
-
end
|
17
|
-
|
18
12
|
def subject
|
19
13
|
source
|
20
14
|
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def instance_uncached
|
25
|
-
::Avm::Tools::Source.new(source_path)
|
26
|
-
end
|
27
15
|
end
|
28
16
|
end
|
29
17
|
end
|
data/lib/avm/tools/version.rb
CHANGED
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.
|
4
|
+
version: 0.140.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-
|
11
|
+
date: 2022-10-11 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.
|
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.
|
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.
|
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.
|
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
|
@@ -272,28 +265,12 @@ files:
|
|
272
265
|
- lib/avm/launcher/git/remote.rb
|
273
266
|
- lib/avm/launcher/git/sub_warp_base.rb
|
274
267
|
- lib/avm/launcher/git/warp_base.rb
|
275
|
-
- 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
|
-
- lib/avm/launcher/paths.rb
|
282
|
-
- lib/avm/launcher/paths/logical.rb
|
283
|
-
- lib/avm/launcher/project.rb
|
284
|
-
- lib/avm/launcher/publish.rb
|
285
|
-
- lib/avm/launcher/publish/base.rb
|
286
268
|
- lib/avm/launcher/ruby.rb
|
287
269
|
- lib/avm/launcher/ruby/gem.rb
|
288
270
|
- lib/avm/launcher/ruby/gem/build.rb
|
289
271
|
- lib/avm/launcher/ruby/gem/specification.rb
|
290
|
-
- lib/avm/launcher/vendor.rb
|
291
|
-
- lib/avm/launcher/vendor/github.rb
|
292
|
-
- lib/avm/patches.rb
|
293
|
-
- lib/avm/patches/i18n.rb
|
294
272
|
- lib/avm/projects.rb
|
295
273
|
- lib/avm/projects/stereotype.rb
|
296
|
-
- lib/avm/projects/stereotype/job_comparator.rb
|
297
274
|
- lib/avm/projects/stereotypes.rb
|
298
275
|
- lib/avm/projects/stereotypes/git.rb
|
299
276
|
- lib/avm/projects/stereotypes/git/local_project_mixin.rb
|
@@ -305,13 +282,9 @@ files:
|
|
305
282
|
- lib/avm/projects/stereotypes/git_subtree.rb
|
306
283
|
- lib/avm/projects/stereotypes/git_subtree/publish.rb
|
307
284
|
- lib/avm/projects/stereotypes/git_subtree/warp.rb
|
308
|
-
- lib/avm/projects/stereotypes/rails_application.rb
|
309
|
-
- lib/avm/projects/stereotypes/rails_application/local_project_mixin.rb
|
310
|
-
- lib/avm/projects/stereotypes/redmine_plugin.rb
|
311
285
|
- lib/avm/projects/stereotypes/ruby_gem.rb
|
312
286
|
- lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb
|
313
287
|
- lib/avm/projects/stereotypes/ruby_gem/publish.rb
|
314
|
-
- lib/avm/stereotypes.rb
|
315
288
|
- lib/avm/tools.rb
|
316
289
|
- lib/avm/tools/core_ext.rb
|
317
290
|
- lib/avm/tools/runner.rb
|
@@ -353,10 +326,7 @@ files:
|
|
353
326
|
- lib/avm/tools/runner/source/version_bump.rb
|
354
327
|
- lib/avm/tools/runner/source_generate.rb
|
355
328
|
- lib/avm/tools/self.rb
|
356
|
-
- lib/avm/tools/source.rb
|
357
329
|
- lib/avm/tools/version.rb
|
358
|
-
- locale/en.yml
|
359
|
-
- locale/pt-BR.yml
|
360
330
|
- template/avm/self/docker_image/Dockerfile
|
361
331
|
- template/avm/self/docker_image/entrypoint.sh
|
362
332
|
homepage:
|
@@ -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
|
data/lib/avm/launcher/context.rb
DELETED
@@ -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
|