avm 0.53.0 → 0.55.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/applications/base.rb +24 -3
- data/lib/avm/entries/entry.rb +5 -0
- data/lib/avm/instances/base.rb +5 -12
- data/lib/avm/instances/ids.rb +30 -0
- data/lib/avm/rspec/setup/source_generator.rb +22 -0
- data/lib/avm/rspec/setup.rb +12 -4
- data/lib/avm/rspec/shared_examples/avm_source_generated.rb +23 -0
- data/lib/avm/sources/base/instance.rb +2 -14
- data/lib/avm/version.rb +1 -1
- metadata +13 -29
- data/lib/avm/rspec/source_generator.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a1e14183c236b827b6b39bc79d7fb1a1ab6ace3284d897e634d692581db10f8
|
4
|
+
data.tar.gz: 2c03c7564a37f2df94acd5b22b0288eaff35179b3f41c41ae7924db4cd54afa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 933eceb86eea9a697e57cfd6219449cc2f07fdaabde00facdf67a69d7eb26f1f46b843fd19686a096fb4d2bb6a2396203c98b7d831780df68ae8db2dd4c0f728
|
7
|
+
data.tar.gz: 8030a0bff5ea657b2a4c196b68cb0d3b27984a276bce196609b090564206dc130966d0e880242226931fa79f4d1f9ba2ffec3a0c7151c466cc38686ba6142ef6
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/entries/base'
|
4
|
+
require 'avm/instances/ids'
|
4
5
|
require 'avm/registry'
|
5
6
|
require 'eac_ruby_utils/core_ext'
|
6
7
|
|
@@ -22,23 +23,43 @@ module Avm
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def instance(suffix)
|
25
|
-
|
26
|
+
stereotype.instance_class.new(self, suffix)
|
26
27
|
end
|
27
28
|
|
28
29
|
def name
|
29
30
|
entry(::Avm::Instances::EntryKeys::NAME).read
|
30
31
|
end
|
31
32
|
|
33
|
+
# @return [String]
|
34
|
+
def local_instance_id
|
35
|
+
::Avm::Instances::Ids.build(id, local_instance_suffix)
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [Pathname]
|
39
|
+
def local_source_path
|
40
|
+
local_source_path_entry.value!.to_pathname
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [EacConfig::Entry]
|
44
|
+
def local_source_path_entry
|
45
|
+
::EacConfig::Node.context.current.entry([local_instance_id, 'install', 'path'])
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [String]
|
49
|
+
def local_instance_suffix
|
50
|
+
LOCAL_INSTANCE_SUFFIX
|
51
|
+
end
|
52
|
+
|
32
53
|
private
|
33
54
|
|
34
55
|
# @return [Avm::Instances::Base]
|
35
56
|
def local_instance_uncached
|
36
|
-
instance(
|
57
|
+
instance(local_instance_suffix)
|
37
58
|
end
|
38
59
|
|
39
60
|
# @return [Avm::Sources::Base]
|
40
61
|
def local_source_uncached
|
41
|
-
::Avm::Registry.sources.detect(
|
62
|
+
::Avm::Registry.sources.detect(local_source_path)
|
42
63
|
end
|
43
64
|
end
|
44
65
|
end
|
data/lib/avm/entries/entry.rb
CHANGED
data/lib/avm/instances/base.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/instances/ids'
|
3
4
|
require 'avm/with/application_stereotype'
|
4
5
|
require 'avm/with/extra_subcommands'
|
5
6
|
require 'eac_ruby_utils/require_sub'
|
@@ -23,18 +24,9 @@ module Avm
|
|
23
24
|
|
24
25
|
class << self
|
25
26
|
def by_id(id)
|
26
|
-
|
27
|
+
parsed_id = ::Avm::Instances::Ids.parse!(id)
|
27
28
|
require 'avm/applications/base'
|
28
|
-
new(::Avm::Applications::Base.new(application_id),
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def parse_id(id)
|
34
|
-
m = ID_PATTERN.match(id)
|
35
|
-
return [m[1], m[2]] if m
|
36
|
-
|
37
|
-
raise "ID Pattern no matched: \"#{id}\""
|
29
|
+
new(::Avm::Applications::Base.new(parsed_id.application_id), parsed_id.instance_suffix)
|
38
30
|
end
|
39
31
|
end
|
40
32
|
|
@@ -42,8 +34,9 @@ module Avm
|
|
42
34
|
self.suffix = suffix.to_s
|
43
35
|
end
|
44
36
|
|
37
|
+
# @return [String]
|
45
38
|
def id
|
46
|
-
|
39
|
+
::Avm::Instances::Ids.build(application.id, suffix)
|
47
40
|
end
|
48
41
|
|
49
42
|
def to_s
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Instances
|
7
|
+
module Ids
|
8
|
+
ID_PARTS_SEPARATOR = '_'
|
9
|
+
ID_PATTERN = /\A([a-z0-9]+(?:\-[a-z0-9]+)*)_(.+)\z/.freeze
|
10
|
+
ID_PARSER = ID_PATTERN.to_parser do |m|
|
11
|
+
::Struct.new(:application_id, :instance_suffix).new(m[1], m[2])
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
# @param application_id [String]
|
16
|
+
# @param instance_suffix [String]
|
17
|
+
# @return [String]
|
18
|
+
def build(application_id, instance_suffix)
|
19
|
+
[application_id, instance_suffix].join(ID_PARTS_SEPARATOR)
|
20
|
+
end
|
21
|
+
|
22
|
+
# @param id [String]
|
23
|
+
# @return [String]
|
24
|
+
def parse!(id)
|
25
|
+
ID_PARSER.parse!(id)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
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
|
+
module SourceGenerator
|
9
|
+
DEFAULT_TARGET_BASENAME = 'generated_app'
|
10
|
+
|
11
|
+
# @return [Avm::Sources::Base]
|
12
|
+
def avm_source(stereotype_name, options = {})
|
13
|
+
options = options.dup
|
14
|
+
target_basename ||= options.delete(:target_basename) || DEFAULT_TARGET_BASENAME
|
15
|
+
target_path ||= options.delete(:target_path) || temp_dir.join(target_basename)
|
16
|
+
::Avm::Registry.source_generators.detect(stereotype_name, target_path, options).perform
|
17
|
+
::Avm::Registry.sources.detect(target_path)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/avm/rspec/setup.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/rspec/source_generator'
|
3
|
+
require 'avm/rspec/setup/source_generator'
|
4
4
|
require 'eac_ruby_utils/core_ext'
|
5
5
|
|
6
6
|
module Avm
|
7
7
|
module Rspec
|
8
8
|
module Setup
|
9
9
|
require_sub __FILE__
|
10
|
-
EXAMPLES = %w[avm_file_formats_with_fixtures entries_values
|
11
|
-
not_in_avm_registry].freeze
|
10
|
+
EXAMPLES = %w[avm_file_formats_with_fixtures avm_source_generated entries_values
|
11
|
+
in_avm_registry not_in_avm_registry].freeze
|
12
12
|
|
13
13
|
def self.extended(obj)
|
14
14
|
obj.setup_examples
|
15
15
|
obj.rspec_config.include(::Avm::Rspec::Setup::Launcher)
|
16
|
-
obj.rspec_config.include(::Avm::Rspec::SourceGenerator)
|
16
|
+
obj.rspec_config.include(::Avm::Rspec::Setup::SourceGenerator)
|
17
17
|
end
|
18
18
|
|
19
19
|
def setup_examples
|
@@ -21,6 +21,14 @@ module Avm
|
|
21
21
|
require "avm/rspec/shared_examples/#{example}"
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
# @return [self]
|
26
|
+
def stub_avm_contexts
|
27
|
+
stub_eac_config_node
|
28
|
+
stub_eac_speaker
|
29
|
+
|
30
|
+
self
|
31
|
+
end
|
24
32
|
end
|
25
33
|
end
|
26
34
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_fs/comparator'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
::RSpec.shared_examples 'avm_source_generated' do |spec_file, stereotype, options = {}|
|
7
|
+
fixtures_dir = ::Pathname.new('base_spec_files').expand_path(::File.dirname(spec_file))
|
8
|
+
|
9
|
+
fixtures_dir.children.select(&:directory?).each do |target_dir|
|
10
|
+
context "when target is \"#{target_dir.basename}\"" do
|
11
|
+
let(:source) { avm_source(stereotype, options.merge(target_basename: target_dir.basename)) }
|
12
|
+
|
13
|
+
it do
|
14
|
+
expect(fs_comparator.build(source.path)).to eq(fs_comparator.build(target_dir))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# @return [EacFs::Comparato]
|
20
|
+
def fs_comparator
|
21
|
+
::EacFs::Comparator.new.rename_file('.gitignore', '_gitignore')
|
22
|
+
end
|
23
|
+
end
|
@@ -7,20 +7,8 @@ module Avm
|
|
7
7
|
module Sources
|
8
8
|
class Base
|
9
9
|
module Instance
|
10
|
-
|
11
|
-
|
12
|
-
def instance_suffix
|
13
|
-
DEFAULT_INSTANCE_SUFFIX
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def application_uncached
|
19
|
-
::Avm::Applications::Base.new(path.basename)
|
20
|
-
end
|
21
|
-
|
22
|
-
def instance_uncached
|
23
|
-
::Avm::Instances::Base.new(application, DEFAULT_INSTANCE_SUFFIX)
|
10
|
+
def instance
|
11
|
+
application.local_instance
|
24
12
|
end
|
25
13
|
end
|
26
14
|
end
|
data/lib/avm/version.rb
CHANGED
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.
|
4
|
+
version: 0.55.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-
|
11
|
+
date: 2022-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -36,34 +36,28 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.29'
|
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.29'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: eac_config
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 0.11.1
|
53
|
+
version: '0.12'
|
57
54
|
type: :runtime
|
58
55
|
prerelease: false
|
59
56
|
version_requirements: !ruby/object:Gem::Requirement
|
60
57
|
requirements:
|
61
58
|
- - "~>"
|
62
59
|
- !ruby/object:Gem::Version
|
63
|
-
version: '0.
|
64
|
-
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 0.11.1
|
60
|
+
version: '0.12'
|
67
61
|
- !ruby/object:Gem::Dependency
|
68
62
|
name: eac_docker
|
69
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,20 +78,14 @@ dependencies:
|
|
84
78
|
requirements:
|
85
79
|
- - "~>"
|
86
80
|
- !ruby/object:Gem::Version
|
87
|
-
version: '0.
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: 0.12.3
|
81
|
+
version: '0.14'
|
91
82
|
type: :runtime
|
92
83
|
prerelease: false
|
93
84
|
version_requirements: !ruby/object:Gem::Requirement
|
94
85
|
requirements:
|
95
86
|
- - "~>"
|
96
87
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0.
|
98
|
-
- - ">="
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version: 0.12.3
|
88
|
+
version: '0.14'
|
101
89
|
- !ruby/object:Gem::Dependency
|
102
90
|
name: eac_git
|
103
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,20 +106,14 @@ dependencies:
|
|
118
106
|
requirements:
|
119
107
|
- - "~>"
|
120
108
|
- !ruby/object:Gem::Version
|
121
|
-
version: '0.
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 0.106.1
|
109
|
+
version: '0.107'
|
125
110
|
type: :runtime
|
126
111
|
prerelease: false
|
127
112
|
version_requirements: !ruby/object:Gem::Requirement
|
128
113
|
requirements:
|
129
114
|
- - "~>"
|
130
115
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0.
|
132
|
-
- - ">="
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version: 0.106.1
|
116
|
+
version: '0.107'
|
135
117
|
- !ruby/object:Gem::Dependency
|
136
118
|
name: eac_templates
|
137
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -329,6 +311,7 @@ files:
|
|
329
311
|
- lib/avm/instances/base/web.rb
|
330
312
|
- lib/avm/instances/docker_image.rb
|
331
313
|
- lib/avm/instances/entry_keys.rb
|
314
|
+
- lib/avm/instances/ids.rb
|
332
315
|
- lib/avm/instances/runner.rb
|
333
316
|
- lib/avm/launcher.rb
|
334
317
|
- lib/avm/launcher/context.rb
|
@@ -375,11 +358,12 @@ files:
|
|
375
358
|
- lib/avm/rspec.rb
|
376
359
|
- lib/avm/rspec/setup.rb
|
377
360
|
- lib/avm/rspec/setup/launcher.rb
|
361
|
+
- lib/avm/rspec/setup/source_generator.rb
|
378
362
|
- lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
|
363
|
+
- lib/avm/rspec/shared_examples/avm_source_generated.rb
|
379
364
|
- lib/avm/rspec/shared_examples/entries_values.rb
|
380
365
|
- lib/avm/rspec/shared_examples/in_avm_registry.rb
|
381
366
|
- lib/avm/rspec/shared_examples/not_in_avm_registry.rb
|
382
|
-
- lib/avm/rspec/source_generator.rb
|
383
367
|
- lib/avm/runners/base.rb
|
384
368
|
- lib/avm/scms/base.rb
|
385
369
|
- lib/avm/scms/commit.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Rspec
|
7
|
-
module SourceGenerator
|
8
|
-
# @return [Avm::Sources::Base]
|
9
|
-
def avm_source(stereotype_name, options = {})
|
10
|
-
target_path ||= options.delete(:target_path) || temp_dir.join('generated_app')
|
11
|
-
::Avm::Registry.source_generators.detect(stereotype_name, target_path, options).perform
|
12
|
-
::Avm::Registry.sources.detect(target_path)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|