config_templates 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/config_templates/collections/extensions.rb +2 -2
- data/lib/config_templates/contexts/compilation.rb +12 -8
- data/lib/config_templates/contexts/rendering.rb +2 -2
- data/lib/config_templates/extensions/include.rb +3 -3
- data/lib/config_templates/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f30c2c11c2f2d4cdd040d9c5e5c235050c76dba
|
4
|
+
data.tar.gz: 658e799d25032fbdca3d667f61edb05a487c7261
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 881bc15e1e5f209b45c7388eeb20d49a718806372e480f052a16f85a28e8827eb295334b8f6901c691164843bcaea7974c0544c49cf287f71e261369e599ccf9
|
7
|
+
data.tar.gz: a6c61bd1fc3d14932c1b7c9dff390f3d749559dbebc13dc0687216997499f62a0fa90b6ab71c9d7a721aa27080a6dc5f4ff87969480c0fbdf63e733f36cc8d9e
|
@@ -2,8 +2,8 @@ module ConfigTemplates::Collections
|
|
2
2
|
class Extensions
|
3
3
|
def initialize
|
4
4
|
@extensions = {
|
5
|
-
/^.+\?$/ => ::ConfigTemplates::Extensions::Stage,
|
6
|
-
'include' => ::ConfigTemplates::Extensions::Include
|
5
|
+
/^.+\?$/ => proc { |*args| ::ConfigTemplates::Extensions::Stage.new.call *args },
|
6
|
+
'include' => proc { |*args| ::ConfigTemplates::Extensions::Include.new.call *args }
|
7
7
|
}
|
8
8
|
end
|
9
9
|
|
@@ -18,18 +18,22 @@ module ConfigTemplates::Contexts
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def components
|
21
|
-
::ConfigTemplates::Collections::Components.new
|
22
|
-
|
23
|
-
|
24
|
-
context.components = collection
|
25
|
-
collection << component(template, collection, context)
|
26
|
-
end
|
27
|
-
end
|
21
|
+
collection = ::ConfigTemplates::Collections::Components.new @criteria
|
22
|
+
add_components_to collection
|
23
|
+
collection
|
28
24
|
end
|
29
25
|
|
30
26
|
private
|
31
27
|
|
32
|
-
def
|
28
|
+
def add_components_to(collection)
|
29
|
+
@templates.find_all.each do |template|
|
30
|
+
context = ::ConfigTemplates::Contexts::Rendering.new
|
31
|
+
context.components = collection
|
32
|
+
collection << component(template, context)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def component(template, context)
|
33
37
|
validator = @validators.find_by_file_name template.source_path
|
34
38
|
engine = @engines.find_by_extension template.extension
|
35
39
|
component = ::ConfigTemplates::Models::Component.new(template, context, validator, engine)
|
@@ -29,9 +29,9 @@ module ConfigTemplates::Contexts
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def method_missing(method_name, *args, &block)
|
32
|
-
|
32
|
+
extension = @extensions.find_by_name(method_name) || super
|
33
33
|
invocation = ::ConfigTemplates::Extensions::Invocation.new method_name, args, block
|
34
|
-
|
34
|
+
extension.call self, invocation
|
35
35
|
end
|
36
36
|
|
37
37
|
def respond_to_missing?(method_name)
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module ConfigTemplates::Extensions
|
2
2
|
class Include
|
3
3
|
def call(context, invocation)
|
4
|
-
|
4
|
+
component = context.components.find_by_path!(
|
5
5
|
invocation.args.first,
|
6
6
|
context.component.source_path
|
7
7
|
)
|
8
|
-
|
9
|
-
|
8
|
+
component.child!
|
9
|
+
component.render
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config_templates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- g.ivanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|