avm 0.47.0 → 0.49.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: 169f69fb35b1ee123d067563e8b7ce5c58ee21181e45ca14d7e9ac2319682c73
4
- data.tar.gz: a48d7c3b575abde9feb9fac26c7a332be3d01779b80681b3365057f3ab2b84cb
3
+ metadata.gz: 45c9b97e84c6bc931f5c39f0b4504f2ff0bb54777eefec60a11ca75f0f78d7ac
4
+ data.tar.gz: 8056ef32f78b0dd4e0dd3befb96b76215e427dee54439150bddc8ca55b6f79f9
5
5
  SHA512:
6
- metadata.gz: 19796266444018aab3b5a998f24a88140b246155ab14e7d0f23551b5caf913ee977f43e70e2a66a39114e4bde906894917196fa3db3cd366e8401945af15771b
7
- data.tar.gz: 4d90e1e9402fecf637b290cd778304afa5f28e6252e82fe64f77286c0a8dd15c30f9e1b2a8c338f908cce78a1feae62d7b85862c9f80209ec63c94193fa3ed8e
6
+ metadata.gz: 645d93964df7e611a16976cebaad4a49cffb661b0e44b3d499a3c09f92c3ddf2376de919ee864759e2cd0fb1d63b942a934ce47a1c524bcd62c6e10400858fa1
7
+ data.tar.gz: 47dd65cb91878b663412a94e47da514d31b39bcb37f87d20796abaffe4877537885207ef2d291f78d511bbe9389333de66be73de053ae484aabfff314e566cde
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'avm/projects/stereotypes'
4
4
  require 'avm/launcher/paths/real'
5
+ require 'avm/launcher/stereotype'
5
6
 
6
7
  module Avm
7
8
  module Launcher
@@ -61,7 +62,7 @@ module Avm
61
62
  private
62
63
 
63
64
  def stereotypes_uncached
64
- ::Avm::Projects::Stereotype.stereotypes.select { |s| s.match?(self) }
65
+ ::Avm::Launcher::Stereotype.stereotypes.select { |s| s.match?(self) }
65
66
  end
66
67
 
67
68
  def build_child(name)
@@ -35,8 +35,6 @@ module Avm
35
35
  internal_check
36
36
  rescue ::Avm::Launcher::Errors::Base => e
37
37
  ::Avm::Launcher::Publish::CheckResult.blocked("Error: #{e}")
38
- rescue ::Avm::Launcher::Git::Error => e
39
- ::Avm::Launcher::Publish::CheckResult.blocked("Git error: #{e}")
40
38
  end
41
39
  end
42
40
  end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/string/inflections'
4
+ require 'colorized_string'
5
+
6
+ module Avm
7
+ module Launcher
8
+ module Stereotype
9
+ class << self
10
+ attr_reader :stereotypes
11
+
12
+ def included(base)
13
+ @stereotypes ||= []
14
+ @stereotypes << base
15
+ base.extend(ClassMethods)
16
+ end
17
+
18
+ def git_stereotypes
19
+ stereotypes.select { |c| c.name.demodulize.downcase.match('git') }
20
+ end
21
+
22
+ def nogit_stereotypes
23
+ stereotypes - git_stereotypes
24
+ end
25
+ end
26
+
27
+ module ClassMethods
28
+ def label
29
+ ::ColorizedString.new(stereotype_name).send(color)
30
+ end
31
+
32
+ def stereotype_name
33
+ name.demodulize
34
+ end
35
+
36
+ {
37
+ local_project_mixin: ::Module,
38
+ publish: ::Class,
39
+ update: ::Class,
40
+ version_bump: ::Class,
41
+ warp: ::Class
42
+ }.each do |name, is_a|
43
+ define_method "#{name}_#{is_a.name.underscore}" do
44
+ sub_constant(name.to_s.camelcase, is_a)
45
+ end
46
+ end
47
+
48
+ private
49
+
50
+ def sub_constant(constant_name, is_a)
51
+ return nil unless const_defined?(constant_name)
52
+
53
+ constant = const_get(constant_name)
54
+ unless is_a.if_present(true) { |v| constant.is_a?(v) }
55
+ raise("#{constant} is not a #{is_a}")
56
+ end
57
+
58
+ constant
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module LauncherStereotypes
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/with_path'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Registry
8
+ class LauncherStereotypes < ::Avm::Registry::WithPath
9
+ end
10
+ end
11
+ end
data/lib/avm/registry.rb CHANGED
@@ -7,8 +7,8 @@ module Avm
7
7
  module Registry
8
8
  require_sub __FILE__
9
9
  enable_listable
10
- lists.add_symbol :category, :application_stereotypes, :instances, :runners, :scms,
11
- :source_generators, :sources
10
+ lists.add_symbol :category, :application_stereotypes, :instances, :launcher_stereotypes,
11
+ :runners, :scms, :source_generators, :sources
12
12
 
13
13
  class << self
14
14
  enable_simple_cache
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/rspec/source_generator'
3
4
  require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module Avm
@@ -9,6 +10,7 @@ module Avm
9
10
 
10
11
  def self.extended(obj)
11
12
  obj.setup_examples
13
+ obj.rspec_config.include(::Avm::Rspec::SourceGenerator)
12
14
  end
13
15
 
14
16
  def setup_examples
@@ -0,0 +1,16 @@
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, target_path = nil)
10
+ target_path ||= temp_dir.join('generated_app')
11
+ ::Avm::Registry.source_generators.detect(stereotype_name, target_path).perform
12
+ ::Avm::Registry.sources.detect(target_path)
13
+ end
14
+ end
15
+ end
16
+ end
data/lib/avm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.47.0'
4
+ VERSION = '0.49.0'
5
5
  end
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.47.0
4
+ version: 0.49.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-10-11 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_cli
@@ -282,6 +282,8 @@ files:
282
282
  - lib/avm/launcher/publish.rb
283
283
  - lib/avm/launcher/publish/base.rb
284
284
  - lib/avm/launcher/publish/check_result.rb
285
+ - lib/avm/launcher/stereotype.rb
286
+ - lib/avm/launcher_stereotypes.rb
285
287
  - lib/avm/path_string.rb
286
288
  - lib/avm/registry.rb
287
289
  - lib/avm/registry/application_stereotypes.rb
@@ -289,6 +291,7 @@ files:
289
291
  - lib/avm/registry/application_stereotypes/stereotype_builder.rb
290
292
  - lib/avm/registry/from_gems.rb
291
293
  - lib/avm/registry/instances.rb
294
+ - lib/avm/registry/launcher_stereotypes.rb
292
295
  - lib/avm/registry/runners.rb
293
296
  - lib/avm/registry/scms.rb
294
297
  - lib/avm/registry/source_generators.rb
@@ -301,6 +304,7 @@ files:
301
304
  - lib/avm/rspec/shared_examples/entries_values.rb
302
305
  - lib/avm/rspec/shared_examples/in_avm_registry.rb
303
306
  - lib/avm/rspec/shared_examples/not_in_avm_registry.rb
307
+ - lib/avm/rspec/source_generator.rb
304
308
  - lib/avm/runners/base.rb
305
309
  - lib/avm/scms/base.rb
306
310
  - lib/avm/scms/commit.rb