avm 0.47.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 169f69fb35b1ee123d067563e8b7ce5c58ee21181e45ca14d7e9ac2319682c73
4
- data.tar.gz: a48d7c3b575abde9feb9fac26c7a332be3d01779b80681b3365057f3ab2b84cb
3
+ metadata.gz: 6154966f958a3a20d945e50d0adfa863e2cdc4347a387d1cc438693dd2bafe4d
4
+ data.tar.gz: 851e61bcad1cf7ce2d4ff29786abb52ea9421ce0954f504b339ca54f9482cf2c
5
5
  SHA512:
6
- metadata.gz: 19796266444018aab3b5a998f24a88140b246155ab14e7d0f23551b5caf913ee977f43e70e2a66a39114e4bde906894917196fa3db3cd366e8401945af15771b
7
- data.tar.gz: 4d90e1e9402fecf637b290cd778304afa5f28e6252e82fe64f77286c0a8dd15c30f9e1b2a8c338f908cce78a1feae62d7b85862c9f80209ec63c94193fa3ed8e
6
+ metadata.gz: 91cfb8131fa8053b3819582a957899c1b7957fe709513cb4cba5032c66bf45540a8ea376b6838a3651913481696efef9c841e0f621d5992f5de85760836fb15f
7
+ data.tar.gz: 56cf053b8f7a9a2790a5a60deec1e8336c00c5909ee3bf944947a7ff1365987ddf95f5bbe75c24fbe1a863ce7847fd00611949b8363083b878fbe8ecb108fdc6
@@ -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)
@@ -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
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.48.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.48.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
@@ -282,6 +282,7 @@ 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
285
286
  - lib/avm/path_string.rb
286
287
  - lib/avm/registry.rb
287
288
  - lib/avm/registry/application_stereotypes.rb