rggen-core 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rggen/core/base/feature.rb +1 -1
- data/lib/rggen/core/base/internal_struct.rb +0 -4
- data/lib/rggen/core/builder/builder.rb +2 -2
- data/lib/rggen/core/builder/plugins.rb +23 -9
- data/lib/rggen/core/input_base/yaml_loader.rb +14 -7
- 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: 2ad3c3965e2c0ac0bea5b0ef6d96ee5edeabb686d6eef675a9331e2754e26ffc
|
4
|
+
data.tar.gz: 56a3a6ceae64abc9d4f7f0398b3b3cbeb79c80350aef7dfb094c04989497830a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a7bf7db44471e1d49fcec8f9e68d3619a0b63224854332255f4a4f8b0dc6e9f66be4142a25c374dd50d988401c9042fc7610d3ea0d2eaf3c34d83c9b6228f95
|
7
|
+
data.tar.gz: fea70cddb6c3b99904a7d0bdb20e9f71d112684bf52ebd847314b1368370863a2f05d878b153e638339c0de2bc6e64d9f90aa9a800c493a51eff47dcbe916016
|
@@ -90,8 +90,8 @@ module RgGen
|
|
90
90
|
RegisterMap.setup(self)
|
91
91
|
end
|
92
92
|
|
93
|
-
def setup(name,
|
94
|
-
plugins.add(name,
|
93
|
+
def setup(name, module_or_version = nil, &block)
|
94
|
+
plugins.add(name, module_or_version, &block)
|
95
95
|
end
|
96
96
|
|
97
97
|
def activate_plugins
|
@@ -4,23 +4,37 @@ module RgGen
|
|
4
4
|
module Core
|
5
5
|
module Builder
|
6
6
|
class Plugin
|
7
|
-
|
7
|
+
DEFAULT_PLUGIN_VERSION = '0.0.0'
|
8
|
+
|
9
|
+
def initialize(name, module_or_version, &block)
|
8
10
|
@name = name
|
9
|
-
@version = extract_version(plugin_module)
|
10
|
-
@plugin_module = plugin_module
|
11
11
|
@block = block
|
12
|
+
@version, @plugin_module =
|
13
|
+
if module_or_version.is_a?(Module)
|
14
|
+
[extract_version(module_or_version), module_or_version]
|
15
|
+
else
|
16
|
+
[module_or_version || DEFAULT_PLUGIN_VERSION]
|
17
|
+
end
|
12
18
|
end
|
13
19
|
|
14
20
|
attr_reader :name
|
15
21
|
attr_reader :version
|
16
22
|
|
17
23
|
def default_setup(builder)
|
18
|
-
@plugin_module
|
19
|
-
|
24
|
+
@plugin_module &&
|
25
|
+
begin
|
26
|
+
@plugin_module.respond_to?(:default_setup) &&
|
27
|
+
@plugin_module.default_setup(builder)
|
28
|
+
end
|
20
29
|
end
|
21
30
|
|
22
31
|
def optional_setup(builder)
|
23
|
-
@block &&
|
32
|
+
@block &&
|
33
|
+
if @plugin_module
|
34
|
+
@plugin_module.instance_exec(builder, &@block)
|
35
|
+
else
|
36
|
+
@block.call(builder)
|
37
|
+
end
|
24
38
|
end
|
25
39
|
|
26
40
|
private
|
@@ -31,7 +45,7 @@ module RgGen
|
|
31
45
|
elsif plugin_module.respond_to?(:version)
|
32
46
|
plugin_module.version
|
33
47
|
else
|
34
|
-
|
48
|
+
DEFAULT_PLUGIN_VERSION
|
35
49
|
end
|
36
50
|
end
|
37
51
|
end
|
@@ -41,8 +55,8 @@ module RgGen
|
|
41
55
|
@plugins = []
|
42
56
|
end
|
43
57
|
|
44
|
-
def add(name,
|
45
|
-
@plugins << Plugin.new(name,
|
58
|
+
def add(name, module_or_version, &block)
|
59
|
+
@plugins << Plugin.new(name, module_or_version, &block)
|
46
60
|
end
|
47
61
|
|
48
62
|
def activate(builder)
|
@@ -7,16 +7,23 @@ module RgGen
|
|
7
7
|
private
|
8
8
|
|
9
9
|
def load_yaml(file)
|
10
|
-
|
11
|
-
result =
|
12
|
-
if Psych::VERSION >= '3.1.0'
|
13
|
-
YAML.safe_load(yaml, aliases: true, filename: file)
|
14
|
-
else
|
15
|
-
YAML.safe_load(yaml, [], [], true, file)
|
16
|
-
end
|
10
|
+
result = yaml_safe_load(File.binread(file), file)
|
17
11
|
symbolize_key(result)
|
18
12
|
end
|
19
13
|
|
14
|
+
if Psych::VERSION >= '3.1.0'
|
15
|
+
def yaml_safe_load(yaml, file)
|
16
|
+
YAML.safe_load(
|
17
|
+
yaml,
|
18
|
+
permitted_classes: [Symbol], aliases: true, filename: file
|
19
|
+
)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
def yaml_safe_load(yaml, file)
|
23
|
+
YAML.safe_load(yaml, [Symbol], [], true, file)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
20
27
|
def symbolize_key(result)
|
21
28
|
case result
|
22
29
|
when Hash
|
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.14.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-09-03 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.14.0
|
191
191
|
test_files: []
|