kafo_parsers 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kafo_parsers/puppet_strings_module_parser.rb +11 -0
- data/lib/kafo_parsers/version.rb +1 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 747520cf42c2a91caca542f85d2185620e75e291fb5cbaaa6e51bf7850868704
|
4
|
+
data.tar.gz: 556665c63d578dcc13e346a80413da96735be1fcf9df0294258e536ceff546e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92bb6e4a7c67b7a28c8834bfa702b56a87a538aa0e0055a7348369e3ef1d934a35fa6331c0758623aade6d427edc7a40a699b0c15ae282086b078e58f7479b11
|
7
|
+
data.tar.gz: 41ebd83a1ce35095dbd5206d6bfc27bd9d45499c77e32a96846330fda95f949a92343a3e802d13e60c17b3f8464e34a062e2139b278e293fd72a6d18d8dc32d9
|
@@ -173,10 +173,21 @@ module KafoParsers
|
|
173
173
|
#
|
174
174
|
# values are reported as strings which is issue especially for :under
|
175
175
|
# strings are double quoted
|
176
|
+
# basic array and hashes are supported
|
176
177
|
# others must be typecast manually according to reported type
|
177
178
|
def sanitize(value)
|
178
179
|
if (value.start_with?("'") && value.end_with?("'")) || (value.start_with?('"') && value.end_with?('"'))
|
179
180
|
value = value[1..-2]
|
181
|
+
elsif value.start_with?('[') && value.end_with?(']')
|
182
|
+
# TODO: handle commas in strings like ["a,b", "c"]
|
183
|
+
value = value[1..-2].split(',').map { |v| sanitize(v.strip) }
|
184
|
+
elsif value.start_with?('{') && value.end_with?('}')
|
185
|
+
# TODO: handle commas and => in strings, like {"key" => "value,=>"}
|
186
|
+
value = value[1..-2].split(',').map do |v|
|
187
|
+
split = v.strip.split('=>')
|
188
|
+
raise 'Invalid hash' unless split.length == 2
|
189
|
+
split.map { |s| sanitize(s.strip) }
|
190
|
+
end.to_h
|
180
191
|
end
|
181
192
|
value = :undef if value == 'undef'
|
182
193
|
|
data/lib/kafo_parsers/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kafo_parsers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Hulan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.5'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3'
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '1.5'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rake
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
151
|
- !ruby/object:Gem::Version
|
146
152
|
version: '0'
|
147
153
|
requirements: []
|
148
|
-
rubygems_version: 3.1.
|
154
|
+
rubygems_version: 3.1.6
|
149
155
|
signing_key:
|
150
156
|
specification_version: 4
|
151
157
|
summary: Puppet module parsers
|