dtk-dsl 1.0.1 → 1.0.2

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
  SHA1:
3
- metadata.gz: 80e593bfb3fdafca2ec5659cb23d027021b12646
4
- data.tar.gz: 719da019d2d90879ae54fb0cd5862644eef253fc
3
+ metadata.gz: d8d7e9667524d13ccf2f97b3b150a435aa81f7ad
4
+ data.tar.gz: 2c1f1b937882c34122b10f160387da0a158be9b6
5
5
  SHA512:
6
- metadata.gz: 5180a6a6ff23dff2c813d535b04885164bef6d45e397843c06cab7f5907cea83681846f62fae3025b4800074f2b5968d1e864f5e804261cdaa5013d37be14013
7
- data.tar.gz: af53ec0c65ce2625bcc8bd2548e7c3e8a66e1748697565952eb9755d99cb4f24aba8cd0a5e42f7d6d6d90537064f2461ccddbe262dc893819dae12da02881eee
6
+ metadata.gz: 0bf7ed5a03b682eb4b908f4a979cec62b21fb213669afc03b28be701c82a258c91c62e49a20f4e93a732e74d9324e5444c773756b869751720e8853cd74a4596
7
+ data.tar.gz: e9eccc9fc8a61162631461dbdfdcd6b8d63279c0a9dfe8238e6f8b25e3fe08a5263ae7e6b47bfce77af5d8c6923d6bb7d0b7ee5582cd56f933f6610a85ac0416
@@ -45,16 +45,17 @@ module DTK::DSL
45
45
  OrderedComponents = :ordered_components
46
46
 
47
47
  # Used at multiple levels
48
- Name = :name
49
- Description = :description
50
- Namespace = :namespace
51
- ModuleName = :module_name
52
- ModuleVersion = :version
53
- Attributes = :attributes
54
- Value = :value
55
- Nodes = :nodes
56
- Target = :target
57
- Components = :components
48
+ Name = :name
49
+ Description = :description
50
+ Namespace = :namespace
51
+ ModuleName = :module_name
52
+ ModuleVersion = :version
53
+ Attributes = :attributes
54
+ Value = :value
55
+ Nodes = :nodes
56
+ Target = :target
57
+ Components = :components
58
+ ComponentLinks = :component_links
58
59
 
59
60
  # meta info
60
61
  Import = :import
@@ -80,8 +80,10 @@ module DTK::DSL
80
80
 
81
81
  def generate_component_hash
82
82
  ret = {}
83
+
83
84
  set_generation_hash(ret, :Attributes, generate_child_elements(:attribute, val(:Attributes)))
84
- #TODO: set component_links
85
+ set_generation_hash(ret, :ComponentLinks, generate_child_elements(:component_link, val(:ComponentLinks)))
86
+
85
87
  ret
86
88
  end
87
89
 
@@ -0,0 +1,26 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module DTK::DSL
19
+ class Template::V1
20
+ class ComponentLink
21
+ class SemanticParse < InputOutputCommon::SemanticParse::Hash
22
+ end
23
+ end
24
+ end
25
+ end
26
+
@@ -0,0 +1,75 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ class DTK::DSL::Template
19
+ class V1
20
+ class ComponentLink < self
21
+ require_relative('component_link/semantic_parse')
22
+
23
+ module Constant
24
+ module Variations
25
+ end
26
+
27
+ extend ClassMixin::Constant
28
+ Value = 'value'
29
+ end
30
+
31
+ ### For parsing
32
+ def parser_output_type
33
+ :hash
34
+ end
35
+
36
+ def self.elements_collection_type
37
+ :hash
38
+ end
39
+
40
+ def self.parse_elements(input_hash, parent_info)
41
+ input_hash.inject(file_parser_output_hash) do |h, (name, value)|
42
+ h.merge(name => parse_element({ 'value' => value}, parent_info, :index => name))
43
+ end
44
+ end
45
+
46
+ def parse!
47
+ # using 'input_key_value?' (i.e., with '?') in case null value
48
+ set :Value, input_key_value?(:Value)
49
+ end
50
+
51
+ ### For generation
52
+ def self.generate_elements(component_links_content, parent)
53
+ component_links_content.inject({}) do |h, (component_link_name, component_link)|
54
+ component_link.set(:Name, component_link_name)
55
+ element = generate_element?(component_link, parent)
56
+ element.nil? ? h : h.merge(element)
57
+ end
58
+ end
59
+
60
+ def generate!
61
+ value = val(:Value)
62
+ unless value.nil?
63
+ merge(req(:Name) => val(:Value))
64
+ self
65
+ end
66
+ end
67
+
68
+ def generate?
69
+ generate! unless skip_for_generation?
70
+ end
71
+
72
+ end
73
+ end
74
+ end
75
+
@@ -26,6 +26,7 @@ module DTK::DSL
26
26
  require_relative('v1/module_ref')
27
27
  require_relative('v1/assembly')
28
28
  require_relative('v1/attribute')
29
+ require_relative('v1/component_link')
29
30
  # attribute must go before node_attribute
30
31
  require_relative('v1/node_attribute')
31
32
  require_relative('v1/node')
data/lib/dsl/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module DTK
2
2
  module DSL
3
- VERSION="1.0.1"
3
+ VERSION="1.0.2"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtk-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reactor8
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-18 00:00:00.000000000 Z
11
+ date: 2016-12-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Library for parsing DT DSL files.
14
14
  email: support@reactor8.com
@@ -16,8 +16,8 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
- - ".byebug_history"
20
- - ".gitignore"
19
+ - .byebug_history
20
+ - .gitignore
21
21
  - Gemfile
22
22
  - README.md
23
23
  - dtk-dsl.gemspec
@@ -81,6 +81,8 @@ files:
81
81
  - lib/dsl/template/v1/common_module_summary.rb
82
82
  - lib/dsl/template/v1/component.rb
83
83
  - lib/dsl/template/v1/component/semantic_parse.rb
84
+ - lib/dsl/template/v1/component_link.rb
85
+ - lib/dsl/template/v1/component_link/semantic_parse.rb
84
86
  - lib/dsl/template/v1/dependency.rb
85
87
  - lib/dsl/template/v1/module_ref.rb
86
88
  - lib/dsl/template/v1/node.rb
@@ -104,17 +106,17 @@ require_paths:
104
106
  - lib
105
107
  required_ruby_version: !ruby/object:Gem::Requirement
106
108
  requirements:
107
- - - ">="
109
+ - - '>='
108
110
  - !ruby/object:Gem::Version
109
111
  version: 1.9.3
110
112
  required_rubygems_version: !ruby/object:Gem::Requirement
111
113
  requirements:
112
- - - ">="
114
+ - - '>='
113
115
  - !ruby/object:Gem::Version
114
116
  version: '0'
115
117
  requirements: []
116
118
  rubyforge_project:
117
- rubygems_version: 2.4.1
119
+ rubygems_version: 2.0.14.1
118
120
  signing_key:
119
121
  specification_version: 4
120
122
  summary: Library for parsing DT DSL files.