dtk-dsl 1.1.2 → 1.1.3
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/.gitignore +1 -0
- data/lib/dsl/directory_type.rb +35 -0
- data/lib/dsl/file_type/subclasses.rb +11 -0
- data/lib/dsl/file_type.rb +7 -8
- data/lib/dsl/template/v1/module_refs_lock.rb +75 -0
- data/lib/dsl/template/v1.rb +1 -0
- data/lib/dsl/version.rb +1 -1
- data/lib/dtk_dsl.rb +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fdec98b2b6ec12ef4c8ea2e0168a9ea95da6fe2
|
4
|
+
data.tar.gz: bffe2e314871bc8f257a61fed9e83623c813425a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd49050dca65cde7aa395e8fc6e03db4c5c2c00dcd5fa231106024b7c2f6bd698d9a229114c1866352d63e65a4a366591e3d4587524dee3b0857446a80f1f4f2
|
7
|
+
data.tar.gz: aa03fa92d045244f3ba5b3354f4e5835f698f3d0599e0d19875ce8fb02e53df1ff3a39b38f4483a335136a2544142cc9890019aa70e1a5bcf6f93cc2999c9833
|
data/.gitignore
CHANGED
@@ -0,0 +1,35 @@
|
|
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
|
+
|
19
|
+
module DTK::DSL
|
20
|
+
class DirectoryType
|
21
|
+
class ServiceInstance
|
22
|
+
class NestedModule
|
23
|
+
def self.canonical_path
|
24
|
+
'modules'
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.possible_paths
|
28
|
+
[canonical_path, 'dtk-modules']
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
@@ -29,6 +29,17 @@ module DTK::DSL
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
class ModuleRefsLock < self
|
33
|
+
def self.top_level_type
|
34
|
+
:module_refs_lock
|
35
|
+
end
|
36
|
+
|
37
|
+
class DSLFile < self
|
38
|
+
class Top < self
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
32
43
|
class ServiceInstance < self
|
33
44
|
def self.top_level_type
|
34
45
|
:service_instance
|
data/lib/dsl/file_type.rb
CHANGED
@@ -36,26 +36,25 @@ module DTK::DSL
|
|
36
36
|
MatchingFiles.matching_files_array?(file_type_classes, file_paths)
|
37
37
|
end
|
38
38
|
|
39
|
-
SERVICE_INSTANCE_NESTED_MODULE_DIR = 'modules'
|
40
39
|
TYPES = {
|
41
40
|
CommonModule::DSLFile::Top => {
|
42
41
|
:regexp => Regexp.new("dtk\.module\.(yml|yaml)"),
|
43
42
|
:canonical_path_lambda => lambda { |_params| 'dtk.module.yaml' },
|
44
43
|
:print_name => 'module DSL file'
|
45
44
|
},
|
45
|
+
ModuleRefsLock::DSLFile::Top => {
|
46
|
+
:regexp => Regexp.new("dtk\.module\.lock"),
|
47
|
+
:canonical_path_lambda => lambda { |_params| 'dtk\.modules.lock' },
|
48
|
+
:print_name => 'module refs lock DSL file'
|
49
|
+
},
|
46
50
|
ServiceInstance::DSLFile::Top => {
|
47
51
|
:regexp => Regexp.new("dtk\.service\.(yml|yaml)"),
|
48
52
|
:canonical_path_lambda => lambda { |_params| 'dtk.service.yaml' },
|
49
53
|
:print_name => 'service DSL file'
|
50
54
|
},
|
51
|
-
ServiceInstance::NestedModule => {
|
52
|
-
:instance_match_lambda => lambda { |path| path =~ Regexp.new("^#{SERVICE_INSTANCE_NESTED_MODULE_DIR}/([^/]+)/.+$") && { :module_name => $1 } },
|
53
|
-
:base_dir_lambda => lambda { |params| "#{SERVICE_INSTANCE_NESTED_MODULE_DIR}/#{params[:module_name]}" },
|
54
|
-
:print_name => 'nested module file'
|
55
|
-
},
|
56
55
|
ServiceInstance::NestedModule::DSLFile::Top => {
|
57
|
-
:regexp => Regexp.new("
|
58
|
-
:canonical_path_lambda => lambda { |
|
56
|
+
:regexp => Regexp.new("dtk\.module\.(yml|yaml)"),
|
57
|
+
:canonical_path_lambda => lambda { |_params| 'dtk.module.yaml' },
|
59
58
|
:print_name => 'nested module DSL file'
|
60
59
|
}
|
61
60
|
}
|
@@ -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 ModuleRefsLock < self
|
21
|
+
def parser_output_type
|
22
|
+
:array
|
23
|
+
end
|
24
|
+
|
25
|
+
def parse!
|
26
|
+
input_hash.each_pair do |module_ref_term, info_hash|
|
27
|
+
add parse_element(module_ref_term, info_hash)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def parse_element(module_ref_term, info_hash)
|
34
|
+
ret = self.class.file_parser_output_hash
|
35
|
+
|
36
|
+
version = parse_version(info_hash)
|
37
|
+
namespace, module_name = parse_module_ref_term(module_ref_term)
|
38
|
+
|
39
|
+
ret.set :Namespace, namespace
|
40
|
+
ret.set :ModuleName, module_name
|
41
|
+
ret.set :ModuleVersion, version
|
42
|
+
ret
|
43
|
+
end
|
44
|
+
|
45
|
+
def parse_version(info_hash)
|
46
|
+
unless version = info_hash['version']
|
47
|
+
raise parsing_error("The missing version info")
|
48
|
+
end
|
49
|
+
# TODO: check syntax of version
|
50
|
+
version
|
51
|
+
end
|
52
|
+
|
53
|
+
# returns [namespace, module_name]
|
54
|
+
def parse_module_ref_term(module_ref_term)
|
55
|
+
split = split_by_delim(module_ref_term)
|
56
|
+
unless split.size == 2
|
57
|
+
raise parsing_error("The term '#{module_ref_term}' is an ill-formed module reference")
|
58
|
+
end
|
59
|
+
namespace, module_name = split
|
60
|
+
[namespace, module_name]
|
61
|
+
end
|
62
|
+
|
63
|
+
MODULE_NAMESPACE_DELIMS = ['/', ':']
|
64
|
+
|
65
|
+
def split_by_delim(str)
|
66
|
+
if matching_delim = MODULE_NAMESPACE_DELIMS.find { |delim| str =~ Regexp.new(delim) }
|
67
|
+
str.split(matching_delim)
|
68
|
+
else
|
69
|
+
[str]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/lib/dsl/template/v1.rb
CHANGED
@@ -23,6 +23,7 @@ module DTK::DSL
|
|
23
23
|
# common_module_summary must be before common_module
|
24
24
|
require_relative('v1/common_module')
|
25
25
|
require_relative('v1/service_instance')
|
26
|
+
require_relative('v1/module_refs_lock')
|
26
27
|
require_relative('v1/module_ref')
|
27
28
|
require_relative('v1/component_def')
|
28
29
|
require_relative('v1/assembly')
|
data/lib/dsl/version.rb
CHANGED
data/lib/dtk_dsl.rb
CHANGED
@@ -22,6 +22,7 @@ module DTK
|
|
22
22
|
require_relative('dsl/error')
|
23
23
|
require_relative('dsl/dsl_version')
|
24
24
|
require_relative('dsl/file_type')
|
25
|
+
require_relative('dsl/directory_type')
|
25
26
|
require_relative('dsl/file_obj')
|
26
27
|
require_relative('dsl/yaml_helper')
|
27
28
|
require_relative('dsl/directory_parser')
|
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.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reactor8
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Library for parsing DT DSL files.
|
14
14
|
email: support@reactor8.com
|
@@ -23,6 +23,7 @@ files:
|
|
23
23
|
- lib/dsl/aux.rb
|
24
24
|
- lib/dsl/directory_generator.rb
|
25
25
|
- lib/dsl/directory_parser.rb
|
26
|
+
- lib/dsl/directory_type.rb
|
26
27
|
- lib/dsl/dsl_version.rb
|
27
28
|
- lib/dsl/error.rb
|
28
29
|
- lib/dsl/error/subclasses.rb
|
@@ -120,6 +121,7 @@ files:
|
|
120
121
|
- lib/dsl/template/v1/component_link/semantic_parse.rb
|
121
122
|
- lib/dsl/template/v1/dependency.rb
|
122
123
|
- lib/dsl/template/v1/module_ref.rb
|
124
|
+
- lib/dsl/template/v1/module_refs_lock.rb
|
123
125
|
- lib/dsl/template/v1/node.rb
|
124
126
|
- lib/dsl/template/v1/node/semantic_parse.rb
|
125
127
|
- lib/dsl/template/v1/node_attribute.rb
|
@@ -151,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
153
|
version: '0'
|
152
154
|
requirements: []
|
153
155
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.4.
|
156
|
+
rubygems_version: 2.4.8
|
155
157
|
signing_key:
|
156
158
|
specification_version: 4
|
157
159
|
summary: Library for parsing DT DSL files.
|