structurebutcher 0.7.0 → 1.0.0
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 +5 -5
- data/lib/structurebutcher.rb +15 -5
- metadata +12 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5cd127b65de2a507451e7af172bef194d52a62c41d1a64e27aaf2173851a953e
|
4
|
+
data.tar.gz: b44a6e8b17192d2d4ef6a707dd290d70ccdbab0f8b83517273306d3a5444411c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15b0a3deb76002fa0cc81529a1b0e1ad3f5d6fbab62d164b0fcfd8a990598f2e28f59bbdbcf472dfded28974e4f1b3796eaec407694ec95486e68712c7ca3b6f
|
7
|
+
data.tar.gz: e49657755c9539a44ab6d8f17d53a008f342b6e1e2d98b41a919acf37bf30118274126f7b90bbea43329d466860f56b671a44e7e909a7b90285e04b1207cf085
|
data/lib/structurebutcher.rb
CHANGED
@@ -72,6 +72,7 @@ class StructureButcher
|
|
72
72
|
part = butcher.implantate(body, slot, part)
|
73
73
|
|
74
74
|
storer = StructureButcher::Storer.new
|
75
|
+
|
75
76
|
storer.save_structure(body, body_file, "yaml")
|
76
77
|
end
|
77
78
|
|
@@ -152,7 +153,7 @@ class StructureButcher::Parser
|
|
152
153
|
result = recursive_stringify_keys(YAML.load_file(filename))
|
153
154
|
rescue
|
154
155
|
msg = "Error parsing '" + filename + "': " + $!.message
|
155
|
-
raise
|
156
|
+
raise Exception.new(msg)
|
156
157
|
end
|
157
158
|
return result
|
158
159
|
end
|
@@ -163,7 +164,7 @@ class StructureButcher::Parser
|
|
163
164
|
result = recursive_stringify_keys(JavaProperties.load(filename))
|
164
165
|
rescue
|
165
166
|
msg = "Error parsing '" + filename + "': " + $!.message
|
166
|
-
raise
|
167
|
+
raise Exception.new(msg)
|
167
168
|
end
|
168
169
|
return result
|
169
170
|
end
|
@@ -171,10 +172,10 @@ class StructureButcher::Parser
|
|
171
172
|
def load_hocon(filename)
|
172
173
|
result = nil
|
173
174
|
begin
|
174
|
-
result = recursive_stringify_keys(Hocon.load(filename))
|
175
|
+
result = recursive_stringify_keys(Hocon.load(filename, {:syntax => Hocon::ConfigSyntax::HOCON}))
|
175
176
|
rescue
|
176
177
|
msg = "Error parsing '" + filename + "': " + $!.message
|
177
|
-
raise
|
178
|
+
raise Exception.new(msg)
|
178
179
|
end
|
179
180
|
return result
|
180
181
|
end
|
@@ -203,6 +204,15 @@ class StructureButcher::Storer
|
|
203
204
|
end
|
204
205
|
|
205
206
|
def save_structure(structure, filename, format)
|
206
|
-
|
207
|
+
sorted_structure = {}
|
208
|
+
structure.keys.each do |key|
|
209
|
+
value = structure[key]
|
210
|
+
if value.is_a?(Hash)
|
211
|
+
sorted_structure[key] = Hash[value.sort]
|
212
|
+
else
|
213
|
+
sorted_structure[key] = value
|
214
|
+
end
|
215
|
+
end
|
216
|
+
File.write(filename, structure_in_format(Hash[sorted_structure.sort], format))
|
207
217
|
end
|
208
218
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: structurebutcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miroslav Tynovsky
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1'
|
19
|
+
version: '2.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1'
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: hocon
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '1.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '1.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: java-properties
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: '0.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: '0.1'
|
55
55
|
description: Read a config file and write it to a YAML file under specific key
|
56
56
|
email: tynovsky@avast.com
|
57
57
|
executables: []
|
@@ -63,7 +63,7 @@ homepage: https://github.com/avast/structurebutcher
|
|
63
63
|
licenses:
|
64
64
|
- MIT
|
65
65
|
metadata: {}
|
66
|
-
post_install_message:
|
66
|
+
post_install_message:
|
67
67
|
rdoc_options: []
|
68
68
|
require_paths:
|
69
69
|
- lib
|
@@ -78,9 +78,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
|
-
|
82
|
-
|
83
|
-
signing_key:
|
81
|
+
rubygems_version: 3.3.5
|
82
|
+
signing_key:
|
84
83
|
specification_version: 4
|
85
84
|
summary: Config saver/restorer
|
86
85
|
test_files: []
|