rggen-core 0.15.0 → 0.16.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 +4 -4
- data/lib/rggen/core/base/component.rb +11 -1
- data/lib/rggen/core/base/component_factory.rb +12 -2
- data/lib/rggen/core/base/feature.rb +16 -3
- data/lib/rggen/core/base/feature_factory.rb +7 -5
- data/lib/rggen/core/builder/component_entry.rb +5 -1
- data/lib/rggen/core/builder/component_registry.rb +5 -4
- data/lib/rggen/core/configuration/component_factory.rb +0 -4
- data/lib/rggen/core/input_base/feature.rb +6 -0
- data/lib/rggen/core/output_base/component_factory.rb +2 -2
- data/lib/rggen/core/register_map/component_factory.rb +2 -2
- data/lib/rggen/core/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0510741051f873be7dc827047f0de66a99c8597f012c4115b856b5c33080a55d
|
4
|
+
data.tar.gz: 6acbc096d450278f19c03e4fad095d1a181fa8ae3dbe11e1fcd7e8bde0f11e16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caf9bacb6b71be870d48a03afc67ff9f35516289e331b4cc8231ee1ed94f9bb3444001b496f9a508de5c2e9700bbaa99cb9e9ab05e9628f6a73902d3d7d9d46b
|
7
|
+
data.tar.gz: e1863ab6134225fc653bb9dcf88dde4ae5e307f0d73ce88c1ab87669c26452a57f3852ee29c8821c42f79d83ca279047011eb5fef6d58c516699260ae4d837d2
|
@@ -4,7 +4,8 @@ module RgGen
|
|
4
4
|
module Core
|
5
5
|
module Base
|
6
6
|
class Component
|
7
|
-
def initialize(*args)
|
7
|
+
def initialize(base_name, *args)
|
8
|
+
@base_name = base_name
|
8
9
|
@parent = args.first
|
9
10
|
@children = []
|
10
11
|
@need_children = true
|
@@ -18,6 +19,15 @@ module RgGen
|
|
18
19
|
attr_reader :children
|
19
20
|
attr_reader :level
|
20
21
|
|
22
|
+
def component_name
|
23
|
+
[hierarchy, @base_name].compact.join('@')
|
24
|
+
end
|
25
|
+
|
26
|
+
def hierarchy
|
27
|
+
end
|
28
|
+
|
29
|
+
alias_method :to_s, :component_name
|
30
|
+
|
21
31
|
def need_children?
|
22
32
|
@need_children
|
23
33
|
end
|
@@ -4,7 +4,8 @@ module RgGen
|
|
4
4
|
module Core
|
5
5
|
module Base
|
6
6
|
class ComponentFactory
|
7
|
-
def initialize
|
7
|
+
def initialize(component_name)
|
8
|
+
@component_name = component_name
|
8
9
|
@root_factory = false
|
9
10
|
block_given? && yield(self)
|
10
11
|
end
|
@@ -24,7 +25,7 @@ module RgGen
|
|
24
25
|
else
|
25
26
|
[args.first, preprocess(args[1..-1])]
|
26
27
|
end
|
27
|
-
create_component(parent,
|
28
|
+
create_component(parent, sources) do |component|
|
28
29
|
build_component(parent, component, sources)
|
29
30
|
root_factory? && finalize(component)
|
30
31
|
end
|
@@ -36,6 +37,15 @@ module RgGen
|
|
36
37
|
@root_factory
|
37
38
|
end
|
38
39
|
|
40
|
+
def create_component(parent, sources, &block)
|
41
|
+
actual_sources = Array(select_actual_sources(*sources))
|
42
|
+
@target_component
|
43
|
+
.new(@component_name, parent, *actual_sources, &block)
|
44
|
+
end
|
45
|
+
|
46
|
+
def select_actual_sources(*sources)
|
47
|
+
end
|
48
|
+
|
39
49
|
def build_component(parent, component, sources)
|
40
50
|
do_create_features(component, sources)
|
41
51
|
do_create_children(component, sources)
|
@@ -8,15 +8,28 @@ module RgGen
|
|
8
8
|
extend SharedContext
|
9
9
|
extend Forwardable
|
10
10
|
|
11
|
-
def initialize(
|
12
|
-
@component = component
|
11
|
+
def initialize(feature_name, sub_feature_name, component)
|
13
12
|
@feature_name = feature_name
|
13
|
+
@sub_feature_name = sub_feature_name
|
14
|
+
@component = component
|
14
15
|
post_initialize
|
15
16
|
block_given? && yield(self)
|
16
17
|
end
|
17
18
|
|
18
19
|
attr_reader :component
|
19
|
-
|
20
|
+
|
21
|
+
def feature_name(verbose: false)
|
22
|
+
if verbose
|
23
|
+
[@feature_name, @sub_feature_name]
|
24
|
+
.compact.reject(&:empty?).join(':')
|
25
|
+
else
|
26
|
+
@feature_name
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def inspect
|
31
|
+
"#{feature_name(verbose: true)}(#{component})"
|
32
|
+
end
|
20
33
|
|
21
34
|
class << self
|
22
35
|
attr_reader :printables
|
@@ -15,8 +15,8 @@ module RgGen
|
|
15
15
|
attr_setter :target_features
|
16
16
|
|
17
17
|
def create_feature(component, *args)
|
18
|
-
klass =
|
19
|
-
klass.new(
|
18
|
+
klass, sub_feature_name = select_feature(*args)
|
19
|
+
klass.new(@feature_name, sub_feature_name, component) do |feature|
|
20
20
|
feature.available? || break
|
21
21
|
block_given? && yield(feature)
|
22
22
|
component.add_feature(feature)
|
@@ -25,11 +25,13 @@ module RgGen
|
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
-
def
|
29
|
-
|
28
|
+
def select_feature(*args)
|
29
|
+
key = @target_features && target_feature_key(*args)
|
30
|
+
feature = (key && @target_features[key]) || @target_feature
|
31
|
+
[feature, key]
|
30
32
|
end
|
31
33
|
|
32
|
-
def
|
34
|
+
def target_feature_key(*args)
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
@@ -6,6 +6,10 @@ module RgGen
|
|
6
6
|
class ComponentEntry
|
7
7
|
Entry = Struct.new(:target, :factory)
|
8
8
|
|
9
|
+
def initialize(component_name)
|
10
|
+
@component_name = component_name
|
11
|
+
end
|
12
|
+
|
9
13
|
[:component, :feature].each do |entry_name|
|
10
14
|
define_method(entry_name) do |target, factory|
|
11
15
|
instance_variable_set("@#{__method__}", Entry.new(target, factory))
|
@@ -18,7 +22,7 @@ module RgGen
|
|
18
22
|
end
|
19
23
|
|
20
24
|
def build_factory
|
21
|
-
@component.factory.new do |f|
|
25
|
+
@component.factory.new(@component_name) do |f|
|
22
26
|
f.target_component(@component.target)
|
23
27
|
f.feature_factories(feature_registry&.build_factories)
|
24
28
|
end
|
@@ -4,8 +4,8 @@ module RgGen
|
|
4
4
|
module Core
|
5
5
|
module Builder
|
6
6
|
class ComponentRegistry
|
7
|
-
def initialize(
|
8
|
-
@
|
7
|
+
def initialize(component_name, builder)
|
8
|
+
@component_name = component_name
|
9
9
|
@builder = builder
|
10
10
|
@entries = []
|
11
11
|
end
|
@@ -31,7 +31,7 @@ module RgGen
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def create_new_entry(category, block)
|
34
|
-
entry = ComponentEntry.new
|
34
|
+
entry = ComponentEntry.new(@component_name)
|
35
35
|
Docile.dsl_eval(entry, category, &block)
|
36
36
|
add_feature_registry(category, entry.feature_registry)
|
37
37
|
entry
|
@@ -39,7 +39,8 @@ module RgGen
|
|
39
39
|
|
40
40
|
def add_feature_registry(category, feature_registry)
|
41
41
|
feature_registry || return
|
42
|
-
@builder
|
42
|
+
@builder
|
43
|
+
.add_feature_registry(@component_name, category, feature_registry)
|
43
44
|
end
|
44
45
|
end
|
45
46
|
end
|
@@ -105,6 +105,12 @@ module RgGen
|
|
105
105
|
!helper.printables.nil?
|
106
106
|
end
|
107
107
|
|
108
|
+
def inspect
|
109
|
+
printable_values =
|
110
|
+
printables&.map { |name, value| "#{name}: #{value.inspect}" }
|
111
|
+
(printable_values && "#{super}[#{printable_values.join(', ')}]") || super
|
112
|
+
end
|
113
|
+
|
108
114
|
private
|
109
115
|
|
110
116
|
def do_build(args)
|
@@ -6,8 +6,8 @@ module RgGen
|
|
6
6
|
class ComponentFactory < Base::ComponentFactory
|
7
7
|
private
|
8
8
|
|
9
|
-
def
|
10
|
-
|
9
|
+
def select_actual_sources(configuration, register_map)
|
10
|
+
[configuration, register_map]
|
11
11
|
end
|
12
12
|
|
13
13
|
def create_features(component, configuration, register_map)
|
@@ -6,8 +6,8 @@ module RgGen
|
|
6
6
|
class ComponentFactory < InputBase::ComponentFactory
|
7
7
|
private
|
8
8
|
|
9
|
-
def
|
10
|
-
|
9
|
+
def select_actual_sources(configuration, *_)
|
10
|
+
configuration
|
11
11
|
end
|
12
12
|
|
13
13
|
def create_input_data(&block)
|
data/lib/rggen/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rggen-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taichi Ishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docile
|
@@ -187,5 +187,5 @@ requirements: []
|
|
187
187
|
rubygems_version: 3.0.3
|
188
188
|
signing_key:
|
189
189
|
specification_version: 4
|
190
|
-
summary: rggen-core-0.
|
190
|
+
summary: rggen-core-0.16.0
|
191
191
|
test_files: []
|