palletjack 0.4.1 → 0.5.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.rubocop.yml +6 -0
- data/.rubocop_todo.yml +545 -0
- data/README.md +24 -26
- data/Rakefile +8 -3
- data/bin/console +4 -3
- data/lib/palletjack.rb +5 -90
- data/lib/palletjack/keytransformer.rb +10 -11
- data/lib/palletjack/pallet.rb +5 -6
- data/lib/palletjack/pallet/identity.rb +1 -2
- data/lib/palletjack/tool.rb +4 -5
- data/lib/palletjack/version.rb +2 -4
- data/lib/palletjack/warehouse.rb +96 -0
- data/lib/traceable.rb +3 -4
- data/palletjack.gemspec +11 -10
- metadata +20 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9ff70c32af7111464ab62ed2818f5c93d12cc03e
|
|
4
|
+
data.tar.gz: 4d90829d691b1479c027eeb9b86745b8be912c72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21babb9082289c2535e1e958d3ef87a5056d40b829c1e7725260c2f63d8f65b5772c56e3b62786a7aa43f0bedb365263252127cdfc745b56aee01e39ea9544da
|
|
7
|
+
data.tar.gz: 4d84a0d04fc9d2da039c76ab8f849f5cade93e727fe5ee45be2261f10d1025c7f086260906496c0c18f8014258ca77a41f750ff64f1c9453da565321c229d867
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2017-01-27 21:04:53 +1030 using RuboCop version 0.47.0.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 1
|
|
10
|
+
Lint/AmbiguousRegexpLiteral:
|
|
11
|
+
Exclude:
|
|
12
|
+
- 'spec/palletjack-tool_spec.rb'
|
|
13
|
+
|
|
14
|
+
# Offense count: 6
|
|
15
|
+
# Configuration parameters: AllowSafeAssignment.
|
|
16
|
+
Lint/AssignmentInCondition:
|
|
17
|
+
Exclude:
|
|
18
|
+
- 'lib/palletjack/keytransformer.rb'
|
|
19
|
+
- 'tools/exe/palletjack2pxelinux'
|
|
20
|
+
|
|
21
|
+
# Offense count: 2
|
|
22
|
+
# Cop supports --auto-correct.
|
|
23
|
+
# Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith.
|
|
24
|
+
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
25
|
+
Lint/BlockAlignment:
|
|
26
|
+
Exclude:
|
|
27
|
+
- 'tools/spec/palletjack2kea_spec.rb'
|
|
28
|
+
|
|
29
|
+
# Offense count: 1
|
|
30
|
+
Lint/FormatParameterMismatch:
|
|
31
|
+
Exclude:
|
|
32
|
+
- 'lib/palletjack/pallet.rb'
|
|
33
|
+
|
|
34
|
+
# Offense count: 1
|
|
35
|
+
Lint/NonLocalExitFromIterator:
|
|
36
|
+
Exclude:
|
|
37
|
+
- 'lib/palletjack/keytransformer.rb'
|
|
38
|
+
|
|
39
|
+
# Offense count: 1
|
|
40
|
+
# Cop supports --auto-correct.
|
|
41
|
+
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
|
42
|
+
Lint/UnusedBlockArgument:
|
|
43
|
+
Exclude:
|
|
44
|
+
- 'tools/spec/palletjack2unbound_spec.rb'
|
|
45
|
+
|
|
46
|
+
# Offense count: 1
|
|
47
|
+
# Cop supports --auto-correct.
|
|
48
|
+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
|
|
49
|
+
Lint/UnusedMethodArgument:
|
|
50
|
+
Exclude:
|
|
51
|
+
- 'lib/palletjack/tool.rb'
|
|
52
|
+
|
|
53
|
+
# Offense count: 1
|
|
54
|
+
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
|
|
55
|
+
Lint/UselessAccessModifier:
|
|
56
|
+
Exclude:
|
|
57
|
+
- 'lib/palletjack/pallet.rb'
|
|
58
|
+
|
|
59
|
+
# Offense count: 2
|
|
60
|
+
Lint/UselessAssignment:
|
|
61
|
+
Exclude:
|
|
62
|
+
- 'lib/palletjack/tool.rb'
|
|
63
|
+
- 'tools/exe/palletjack2unbound'
|
|
64
|
+
|
|
65
|
+
# Offense count: 16
|
|
66
|
+
Metrics/AbcSize:
|
|
67
|
+
Max: 67
|
|
68
|
+
|
|
69
|
+
# Offense count: 18
|
|
70
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
|
71
|
+
Metrics/BlockLength:
|
|
72
|
+
Max: 120
|
|
73
|
+
|
|
74
|
+
# Offense count: 3
|
|
75
|
+
# Configuration parameters: CountComments.
|
|
76
|
+
Metrics/ClassLength:
|
|
77
|
+
Max: 131
|
|
78
|
+
|
|
79
|
+
# Offense count: 13
|
|
80
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
81
|
+
# URISchemes: http, https
|
|
82
|
+
Metrics/LineLength:
|
|
83
|
+
Max: 122
|
|
84
|
+
|
|
85
|
+
# Offense count: 26
|
|
86
|
+
# Configuration parameters: CountComments.
|
|
87
|
+
Metrics/MethodLength:
|
|
88
|
+
Max: 59
|
|
89
|
+
|
|
90
|
+
# Offense count: 1
|
|
91
|
+
# Configuration parameters: CountKeywordArgs.
|
|
92
|
+
Metrics/ParameterLists:
|
|
93
|
+
Max: 6
|
|
94
|
+
|
|
95
|
+
# Offense count: 2
|
|
96
|
+
# Cop supports --auto-correct.
|
|
97
|
+
Performance/RedundantBlockCall:
|
|
98
|
+
Exclude:
|
|
99
|
+
- 'lib/palletjack/tool.rb'
|
|
100
|
+
|
|
101
|
+
# Offense count: 4
|
|
102
|
+
# Cop supports --auto-correct.
|
|
103
|
+
Performance/StringReplacement:
|
|
104
|
+
Exclude:
|
|
105
|
+
- 'tools/exe/palletjack2pxelinux'
|
|
106
|
+
|
|
107
|
+
# Offense count: 1
|
|
108
|
+
# Cop supports --auto-correct.
|
|
109
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
110
|
+
# SupportedStyles: prefer_alias, prefer_alias_method
|
|
111
|
+
Style/Alias:
|
|
112
|
+
Exclude:
|
|
113
|
+
- 'lib/palletjack/pallet.rb'
|
|
114
|
+
|
|
115
|
+
# Offense count: 3
|
|
116
|
+
# Cop supports --auto-correct.
|
|
117
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
118
|
+
# SupportedStyles: with_first_parameter, with_fixed_indentation
|
|
119
|
+
Style/AlignParameters:
|
|
120
|
+
Exclude:
|
|
121
|
+
- 'lib/palletjack/pallet.rb'
|
|
122
|
+
- 'tools/exe/create_ipv4_interface'
|
|
123
|
+
- 'tools/exe/create_system'
|
|
124
|
+
|
|
125
|
+
# Offense count: 3
|
|
126
|
+
# Cop supports --auto-correct.
|
|
127
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
128
|
+
# SupportedStyles: always, conditionals
|
|
129
|
+
Style/AndOr:
|
|
130
|
+
Exclude:
|
|
131
|
+
- 'lib/palletjack/pallet.rb'
|
|
132
|
+
|
|
133
|
+
# Offense count: 7
|
|
134
|
+
Style/AsciiComments:
|
|
135
|
+
Exclude:
|
|
136
|
+
- 'lib/traceable.rb'
|
|
137
|
+
|
|
138
|
+
# Offense count: 29
|
|
139
|
+
# Cop supports --auto-correct.
|
|
140
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
|
|
141
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining
|
|
142
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
|
143
|
+
# FunctionalMethods: let, let!, subject, watch
|
|
144
|
+
# IgnoredMethods: lambda, proc, it
|
|
145
|
+
Style/BlockDelimiters:
|
|
146
|
+
Exclude:
|
|
147
|
+
- 'lib/palletjack/tool.rb'
|
|
148
|
+
- 'spec/palletjack-pallet_spec.rb'
|
|
149
|
+
- 'spec/palletjack_spec.rb'
|
|
150
|
+
- 'tools/exe/create_domain'
|
|
151
|
+
- 'tools/exe/create_ipv4_interface'
|
|
152
|
+
- 'tools/exe/create_system'
|
|
153
|
+
- 'tools/exe/dump_pallet'
|
|
154
|
+
- 'tools/exe/palletjack2knot'
|
|
155
|
+
- 'tools/exe/palletjack2unbound'
|
|
156
|
+
- 'tools/spec/palletjack2kea_spec.rb'
|
|
157
|
+
- 'tools/spec/palletjack2unbound_spec.rb'
|
|
158
|
+
|
|
159
|
+
# Offense count: 11
|
|
160
|
+
# Cop supports --auto-correct.
|
|
161
|
+
Style/BlockEndNewline:
|
|
162
|
+
Exclude:
|
|
163
|
+
- 'lib/palletjack/tool.rb'
|
|
164
|
+
- 'tools/exe/create_domain'
|
|
165
|
+
- 'tools/exe/create_ipv4_interface'
|
|
166
|
+
- 'tools/exe/create_system'
|
|
167
|
+
|
|
168
|
+
# Offense count: 8
|
|
169
|
+
# Cop supports --auto-correct.
|
|
170
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
171
|
+
# SupportedStyles: braces, no_braces, context_dependent
|
|
172
|
+
Style/BracesAroundHashParameters:
|
|
173
|
+
Exclude:
|
|
174
|
+
- 'tools/spec/palletjack2kea_spec.rb'
|
|
175
|
+
- 'tools/spec/palletjack2unbound_spec.rb'
|
|
176
|
+
|
|
177
|
+
# Offense count: 1
|
|
178
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
179
|
+
# SupportedStyles: nested, compact
|
|
180
|
+
Style/ClassAndModuleChildren:
|
|
181
|
+
Exclude:
|
|
182
|
+
- 'lib/traceable.rb'
|
|
183
|
+
|
|
184
|
+
# Offense count: 2
|
|
185
|
+
Style/ClassVars:
|
|
186
|
+
Exclude:
|
|
187
|
+
- 'lib/traceable.rb'
|
|
188
|
+
|
|
189
|
+
# Offense count: 5
|
|
190
|
+
# Cop supports --auto-correct.
|
|
191
|
+
Style/ColonMethodCall:
|
|
192
|
+
Exclude:
|
|
193
|
+
- 'lib/palletjack/pallet.rb'
|
|
194
|
+
- 'lib/palletjack/tool.rb'
|
|
195
|
+
- 'spec/palletjack-pallet_spec.rb'
|
|
196
|
+
|
|
197
|
+
# Offense count: 2
|
|
198
|
+
# Cop supports --auto-correct.
|
|
199
|
+
Style/CommentIndentation:
|
|
200
|
+
Exclude:
|
|
201
|
+
- 'tools/spec/palletjack2salt_spec.rb'
|
|
202
|
+
|
|
203
|
+
# Offense count: 1
|
|
204
|
+
# Cop supports --auto-correct.
|
|
205
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
|
206
|
+
# SupportedStyles: assign_to_condition, assign_inside_condition
|
|
207
|
+
Style/ConditionalAssignment:
|
|
208
|
+
Exclude:
|
|
209
|
+
- 'lib/traceable.rb'
|
|
210
|
+
|
|
211
|
+
# Offense count: 18
|
|
212
|
+
Style/Documentation:
|
|
213
|
+
Exclude:
|
|
214
|
+
- 'spec/**/*'
|
|
215
|
+
- 'test/**/*'
|
|
216
|
+
- 'lib/palletjack/keytransformer.rb'
|
|
217
|
+
- 'lib/palletjack/pallet/identity.rb'
|
|
218
|
+
- 'lib/palletjack/tool.rb'
|
|
219
|
+
- 'lib/traceable.rb'
|
|
220
|
+
- 'tools/exe/create_domain'
|
|
221
|
+
- 'tools/exe/create_ipv4_interface'
|
|
222
|
+
- 'tools/exe/create_system'
|
|
223
|
+
- 'tools/exe/dump_pallet'
|
|
224
|
+
- 'tools/exe/palletjack2kea'
|
|
225
|
+
- 'tools/exe/palletjack2knot'
|
|
226
|
+
- 'tools/exe/palletjack2pxelinux'
|
|
227
|
+
- 'tools/exe/palletjack2salt'
|
|
228
|
+
- 'tools/exe/palletjack2unbound'
|
|
229
|
+
|
|
230
|
+
# Offense count: 1
|
|
231
|
+
# Cop supports --auto-correct.
|
|
232
|
+
Style/EmptyCaseCondition:
|
|
233
|
+
Exclude:
|
|
234
|
+
- 'lib/palletjack/pallet.rb'
|
|
235
|
+
|
|
236
|
+
# Offense count: 5
|
|
237
|
+
# Cop supports --auto-correct.
|
|
238
|
+
Style/EmptyLiteral:
|
|
239
|
+
Exclude:
|
|
240
|
+
- 'lib/palletjack/keytransformer.rb'
|
|
241
|
+
- 'lib/palletjack/pallet.rb'
|
|
242
|
+
- 'lib/palletjack/tool.rb'
|
|
243
|
+
- 'tools/exe/palletjack2salt'
|
|
244
|
+
|
|
245
|
+
# Offense count: 3
|
|
246
|
+
# Cop supports --auto-correct.
|
|
247
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
248
|
+
# SupportedStyles: compact, expanded
|
|
249
|
+
Style/EmptyMethod:
|
|
250
|
+
Exclude:
|
|
251
|
+
- 'lib/palletjack/tool.rb'
|
|
252
|
+
|
|
253
|
+
# Offense count: 2
|
|
254
|
+
# Cop supports --auto-correct.
|
|
255
|
+
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
|
256
|
+
Style/ExtraSpacing:
|
|
257
|
+
Exclude:
|
|
258
|
+
- 'palletjack.gemspec'
|
|
259
|
+
- 'tools/palletjack-tools.gemspec'
|
|
260
|
+
|
|
261
|
+
# Offense count: 3
|
|
262
|
+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
|
263
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
|
264
|
+
Style/FileName:
|
|
265
|
+
Exclude:
|
|
266
|
+
- 'spec/example-warehouse_spec.rb'
|
|
267
|
+
- 'spec/palletjack-pallet_spec.rb'
|
|
268
|
+
- 'spec/palletjack-tool_spec.rb'
|
|
269
|
+
|
|
270
|
+
# Offense count: 8
|
|
271
|
+
# Cop supports --auto-correct.
|
|
272
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
273
|
+
# SupportedStyles: consistent, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
|
274
|
+
Style/FirstParameterIndentation:
|
|
275
|
+
Exclude:
|
|
276
|
+
- 'tools/exe/create_domain'
|
|
277
|
+
- 'tools/exe/create_ipv4_interface'
|
|
278
|
+
- 'tools/exe/create_system'
|
|
279
|
+
- 'tools/exe/palletjack2kea'
|
|
280
|
+
- 'tools/exe/palletjack2knot'
|
|
281
|
+
- 'tools/exe/palletjack2pxelinux'
|
|
282
|
+
- 'tools/exe/palletjack2salt'
|
|
283
|
+
- 'tools/exe/palletjack2unbound'
|
|
284
|
+
|
|
285
|
+
# Offense count: 2
|
|
286
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
287
|
+
# SupportedStyles: format, sprintf, percent
|
|
288
|
+
Style/FormatString:
|
|
289
|
+
Exclude:
|
|
290
|
+
- 'lib/palletjack/pallet.rb'
|
|
291
|
+
- 'lib/traceable.rb'
|
|
292
|
+
|
|
293
|
+
# Offense count: 21
|
|
294
|
+
# Configuration parameters: AllowedVariables.
|
|
295
|
+
Style/GlobalVars:
|
|
296
|
+
Exclude:
|
|
297
|
+
- 'spec/example-warehouse_spec.rb'
|
|
298
|
+
- 'spec/palletjack_warehouse_spec.rb'
|
|
299
|
+
- 'spec/palletjack-pallet_spec.rb'
|
|
300
|
+
- 'spec/palletjack-tool_spec.rb'
|
|
301
|
+
- 'spec/palletjack_spec.rb'
|
|
302
|
+
- 'spec/spec_helper.rb'
|
|
303
|
+
- 'tools/spec/palletjack2kea_spec.rb'
|
|
304
|
+
- 'tools/spec/palletjack2knot_spec.rb'
|
|
305
|
+
- 'tools/spec/palletjack2salt_spec.rb'
|
|
306
|
+
- 'tools/spec/palletjack2unbound_spec.rb'
|
|
307
|
+
- 'tools/spec/spec_helper.rb'
|
|
308
|
+
|
|
309
|
+
# Offense count: 2
|
|
310
|
+
# Configuration parameters: MinBodyLength.
|
|
311
|
+
Style/GuardClause:
|
|
312
|
+
Exclude:
|
|
313
|
+
- 'lib/traceable.rb'
|
|
314
|
+
- 'tools/exe/palletjack2salt'
|
|
315
|
+
|
|
316
|
+
# Offense count: 3
|
|
317
|
+
# Cop supports --auto-correct.
|
|
318
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
|
319
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
|
320
|
+
Style/HashSyntax:
|
|
321
|
+
Exclude:
|
|
322
|
+
- 'Rakefile'
|
|
323
|
+
- 'tools/Rakefile'
|
|
324
|
+
- 'tools/exe/palletjack2pxelinux'
|
|
325
|
+
|
|
326
|
+
# Offense count: 9
|
|
327
|
+
# Cop supports --auto-correct.
|
|
328
|
+
# Configuration parameters: MaxLineLength.
|
|
329
|
+
Style/IfUnlessModifier:
|
|
330
|
+
Exclude:
|
|
331
|
+
- 'tools/exe/create_domain'
|
|
332
|
+
- 'tools/exe/create_ipv4_interface'
|
|
333
|
+
- 'tools/exe/create_system'
|
|
334
|
+
- 'tools/exe/dump_pallet'
|
|
335
|
+
- 'tools/exe/palletjack2kea'
|
|
336
|
+
- 'tools/exe/palletjack2knot'
|
|
337
|
+
- 'tools/exe/palletjack2pxelinux'
|
|
338
|
+
- 'tools/exe/palletjack2salt'
|
|
339
|
+
- 'tools/exe/palletjack2unbound'
|
|
340
|
+
|
|
341
|
+
# Offense count: 16
|
|
342
|
+
# Cop supports --auto-correct.
|
|
343
|
+
# Configuration parameters: IndentationWidth.
|
|
344
|
+
Style/IndentAssignment:
|
|
345
|
+
Exclude:
|
|
346
|
+
- 'lib/palletjack/tool.rb'
|
|
347
|
+
- 'tools/exe/create_domain'
|
|
348
|
+
- 'tools/exe/create_ipv4_interface'
|
|
349
|
+
- 'tools/exe/create_system'
|
|
350
|
+
- 'tools/exe/palletjack2kea'
|
|
351
|
+
- 'tools/exe/palletjack2knot'
|
|
352
|
+
- 'tools/exe/palletjack2pxelinux'
|
|
353
|
+
- 'tools/exe/palletjack2salt'
|
|
354
|
+
- 'tools/exe/palletjack2unbound'
|
|
355
|
+
- 'tools/spec/palletjack2kea_spec.rb'
|
|
356
|
+
- 'tools/spec/palletjack2salt_spec.rb'
|
|
357
|
+
|
|
358
|
+
# Offense count: 3
|
|
359
|
+
# Cop supports --auto-correct.
|
|
360
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
361
|
+
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
|
|
362
|
+
Style/MethodDefParentheses:
|
|
363
|
+
Exclude:
|
|
364
|
+
- 'lib/traceable.rb'
|
|
365
|
+
|
|
366
|
+
# Offense count: 2
|
|
367
|
+
Style/MultilineBlockChain:
|
|
368
|
+
Exclude:
|
|
369
|
+
- 'tools/spec/palletjack2unbound_spec.rb'
|
|
370
|
+
|
|
371
|
+
# Offense count: 1
|
|
372
|
+
# Cop supports --auto-correct.
|
|
373
|
+
Style/MultilineBlockLayout:
|
|
374
|
+
Exclude:
|
|
375
|
+
- 'tools/exe/dump_pallet'
|
|
376
|
+
|
|
377
|
+
# Offense count: 1
|
|
378
|
+
# Cop supports --auto-correct.
|
|
379
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
380
|
+
# SupportedStyles: symmetrical, new_line, same_line
|
|
381
|
+
Style/MultilineHashBraceLayout:
|
|
382
|
+
Exclude:
|
|
383
|
+
- 'tools/exe/palletjack2kea'
|
|
384
|
+
|
|
385
|
+
# Offense count: 1
|
|
386
|
+
# Cop supports --auto-correct.
|
|
387
|
+
Style/MultilineIfModifier:
|
|
388
|
+
Exclude:
|
|
389
|
+
- 'tools/exe/palletjack2unbound'
|
|
390
|
+
|
|
391
|
+
# Offense count: 5
|
|
392
|
+
# Cop supports --auto-correct.
|
|
393
|
+
Style/MultilineIfThen:
|
|
394
|
+
Exclude:
|
|
395
|
+
- 'lib/palletjack/keytransformer.rb'
|
|
396
|
+
- 'lib/palletjack/tool.rb'
|
|
397
|
+
- 'tools/exe/palletjack2unbound'
|
|
398
|
+
|
|
399
|
+
# Offense count: 6
|
|
400
|
+
# Cop supports --auto-correct.
|
|
401
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
402
|
+
# SupportedStyles: symmetrical, new_line, same_line
|
|
403
|
+
Style/MultilineMethodCallBraceLayout:
|
|
404
|
+
Exclude:
|
|
405
|
+
- 'tools/exe/dump_pallet'
|
|
406
|
+
- 'tools/exe/palletjack2kea'
|
|
407
|
+
- 'tools/spec/palletjack2kea_spec.rb'
|
|
408
|
+
- 'tools/spec/palletjack2salt_spec.rb'
|
|
409
|
+
|
|
410
|
+
# Offense count: 2
|
|
411
|
+
# Cop supports --auto-correct.
|
|
412
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
413
|
+
# SupportedStyles: aligned, indented
|
|
414
|
+
Style/MultilineOperationIndentation:
|
|
415
|
+
Exclude:
|
|
416
|
+
- 'tools/spec/palletjack2kea_spec.rb'
|
|
417
|
+
|
|
418
|
+
# Offense count: 1
|
|
419
|
+
# Cop supports --auto-correct.
|
|
420
|
+
Style/MutableConstant:
|
|
421
|
+
Exclude:
|
|
422
|
+
- 'lib/palletjack/version.rb'
|
|
423
|
+
|
|
424
|
+
# Offense count: 2
|
|
425
|
+
# Cop supports --auto-correct.
|
|
426
|
+
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
|
427
|
+
# SupportedStyles: skip_modifier_ifs, always
|
|
428
|
+
Style/Next:
|
|
429
|
+
Exclude:
|
|
430
|
+
- 'lib/palletjack/keytransformer.rb'
|
|
431
|
+
- 'lib/palletjack/tool.rb'
|
|
432
|
+
|
|
433
|
+
# Offense count: 1
|
|
434
|
+
# Cop supports --auto-correct.
|
|
435
|
+
# Configuration parameters: EnforcedOctalStyle, SupportedOctalStyles.
|
|
436
|
+
# SupportedOctalStyles: zero_with_o, zero_only
|
|
437
|
+
Style/NumericLiteralPrefix:
|
|
438
|
+
Exclude:
|
|
439
|
+
- 'lib/palletjack/tool.rb'
|
|
440
|
+
|
|
441
|
+
# Offense count: 2
|
|
442
|
+
# Cop supports --auto-correct.
|
|
443
|
+
# Configuration parameters: SupportedStyles.
|
|
444
|
+
# SupportedStyles: compact, exploded
|
|
445
|
+
Style/RaiseArgs:
|
|
446
|
+
EnforcedStyle: compact
|
|
447
|
+
|
|
448
|
+
# Offense count: 5
|
|
449
|
+
# Cop supports --auto-correct.
|
|
450
|
+
Style/RedundantSelf:
|
|
451
|
+
Exclude:
|
|
452
|
+
- 'lib/palletjack/keytransformer.rb'
|
|
453
|
+
- 'lib/palletjack/pallet.rb'
|
|
454
|
+
- 'lib/traceable.rb'
|
|
455
|
+
|
|
456
|
+
# Offense count: 2
|
|
457
|
+
# Cop supports --auto-correct.
|
|
458
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
|
|
459
|
+
# SupportedStyles: slashes, percent_r, mixed
|
|
460
|
+
Style/RegexpLiteral:
|
|
461
|
+
Exclude:
|
|
462
|
+
- 'tools/exe/create_domain'
|
|
463
|
+
- 'tools/exe/create_ipv4_interface'
|
|
464
|
+
|
|
465
|
+
# Offense count: 1
|
|
466
|
+
# Cop supports --auto-correct.
|
|
467
|
+
Style/RescueModifier:
|
|
468
|
+
Exclude:
|
|
469
|
+
- 'lib/palletjack/tool.rb'
|
|
470
|
+
|
|
471
|
+
# Offense count: 10
|
|
472
|
+
# Cop supports --auto-correct.
|
|
473
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
474
|
+
# SupportedStyles: space, no_space
|
|
475
|
+
Style/SpaceBeforeBlockBraces:
|
|
476
|
+
Exclude:
|
|
477
|
+
- 'spec/palletjack-tool_spec.rb'
|
|
478
|
+
- 'spec/palletjack_spec.rb'
|
|
479
|
+
- 'tools/spec/palletjack2knot_spec.rb'
|
|
480
|
+
- 'tools/spec/palletjack2unbound_spec.rb'
|
|
481
|
+
|
|
482
|
+
# Offense count: 37
|
|
483
|
+
# Cop supports --auto-correct.
|
|
484
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces, SpaceBeforeBlockParameters.
|
|
485
|
+
# SupportedStyles: space, no_space
|
|
486
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
|
487
|
+
Style/SpaceInsideBlockBraces:
|
|
488
|
+
Exclude:
|
|
489
|
+
- 'lib/palletjack/tool.rb'
|
|
490
|
+
- 'tools/exe/create_domain'
|
|
491
|
+
- 'tools/exe/create_ipv4_interface'
|
|
492
|
+
- 'tools/exe/create_system'
|
|
493
|
+
- 'tools/exe/dump_pallet'
|
|
494
|
+
- 'tools/exe/palletjack2kea'
|
|
495
|
+
- 'tools/exe/palletjack2knot'
|
|
496
|
+
- 'tools/exe/palletjack2pxelinux'
|
|
497
|
+
- 'tools/exe/palletjack2salt'
|
|
498
|
+
- 'tools/exe/palletjack2unbound'
|
|
499
|
+
- 'tools/spec/palletjack2knot_spec.rb'
|
|
500
|
+
- 'tools/spec/palletjack2unbound_spec.rb'
|
|
501
|
+
|
|
502
|
+
# Offense count: 31
|
|
503
|
+
# Cop supports --auto-correct.
|
|
504
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces.
|
|
505
|
+
# SupportedStyles: space, no_space, compact
|
|
506
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
|
507
|
+
Style/SpaceInsideHashLiteralBraces:
|
|
508
|
+
Exclude:
|
|
509
|
+
- 'lib/palletjack/pallet.rb'
|
|
510
|
+
- 'tools/exe/create_domain'
|
|
511
|
+
- 'tools/exe/palletjack2kea'
|
|
512
|
+
- 'tools/exe/palletjack2unbound'
|
|
513
|
+
- 'tools/spec/palletjack2kea_spec.rb'
|
|
514
|
+
- 'tools/spec/palletjack2unbound_spec.rb'
|
|
515
|
+
|
|
516
|
+
# Offense count: 2
|
|
517
|
+
# Cop supports --auto-correct.
|
|
518
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
519
|
+
# SupportedStyles: use_perl_names, use_english_names
|
|
520
|
+
Style/SpecialGlobalVars:
|
|
521
|
+
Exclude:
|
|
522
|
+
- 'lib/palletjack/tool.rb'
|
|
523
|
+
|
|
524
|
+
# Offense count: 2
|
|
525
|
+
# Cop supports --auto-correct.
|
|
526
|
+
# Configuration parameters: IgnoredMethods.
|
|
527
|
+
# IgnoredMethods: respond_to, define_method
|
|
528
|
+
Style/SymbolProc:
|
|
529
|
+
Exclude:
|
|
530
|
+
- 'lib/palletjack/tool.rb'
|
|
531
|
+
- 'tools/exe/palletjack2unbound'
|
|
532
|
+
|
|
533
|
+
# Offense count: 2
|
|
534
|
+
# Cop supports --auto-correct.
|
|
535
|
+
# Configuration parameters: AllowNamedUnderscoreVariables.
|
|
536
|
+
Style/TrailingUnderscoreVariable:
|
|
537
|
+
Exclude:
|
|
538
|
+
- 'tools/exe/palletjack2knot'
|
|
539
|
+
- 'tools/exe/palletjack2unbound'
|
|
540
|
+
|
|
541
|
+
# Offense count: 1
|
|
542
|
+
# Cop supports --auto-correct.
|
|
543
|
+
Style/WhileUntilDo:
|
|
544
|
+
Exclude:
|
|
545
|
+
- 'lib/palletjack/pallet/identity.rb'
|
data/README.md
CHANGED
|
@@ -55,17 +55,16 @@ warehouse
|
|
|
55
55
|
│ ├── chassis -> ../../chassis/Example:FastServer-128:1234ABCD/
|
|
56
56
|
│ └── type.yaml
|
|
57
57
|
├── netinstall
|
|
58
|
-
│
|
|
59
|
-
│
|
|
60
|
-
│
|
|
61
|
-
│
|
|
62
|
-
│
|
|
63
|
-
│
|
|
64
|
-
│
|
|
65
|
-
│
|
|
66
|
-
│ └── README
|
|
58
|
+
│ └── CentOS-7.3.1611-x86_64
|
|
59
|
+
│ ├── Kickstart_sda
|
|
60
|
+
│ │ └── kickstart.yaml
|
|
61
|
+
│ ├── Kickstart_vda
|
|
62
|
+
│ │ └── kickstart.yaml
|
|
63
|
+
│ ├── Manual
|
|
64
|
+
│ │ └── kickstart.yaml
|
|
65
|
+
│ └── os -> ../../os/CentOS-7.3.1611-x86_64
|
|
67
66
|
├── os
|
|
68
|
-
│ └── CentOS-7.
|
|
67
|
+
│ └── CentOS-7.3.1611-x86_64
|
|
69
68
|
│ └── kickstart.yaml
|
|
70
69
|
├── phy_nic
|
|
71
70
|
│ ├── 14:18:77:ab:cd:ef
|
|
@@ -96,31 +95,28 @@ warehouse
|
|
|
96
95
|
│ │ ├── architecture.yaml
|
|
97
96
|
│ │ ├── domain -> ../../domain/example.com/
|
|
98
97
|
│ │ ├── machine -> ../../machine/testvm/
|
|
99
|
-
│ │ ├── netinstall -> ../../netinstall/CentOS-7.
|
|
98
|
+
│ │ ├── netinstall -> ../../netinstall/CentOS-7.3.1611-x86_64/Kickstart_vda/
|
|
100
99
|
│ │ └── role.yaml
|
|
101
100
|
│ └── vmhost1
|
|
102
101
|
│ ├── architecture.yaml
|
|
103
102
|
│ ├── domain -> ../../domain/example.com/
|
|
104
103
|
│ ├── machine -> ../../machine/vmhost1/
|
|
105
|
-
│ ├── netinstall -> ../../netinstall/CentOS-7.
|
|
104
|
+
│ ├── netinstall -> ../../netinstall/CentOS-7.3.1611-x86_64/Kickstart_sda/
|
|
106
105
|
│ └── role.yaml
|
|
107
106
|
└── transforms.yaml
|
|
108
107
|
```
|
|
109
108
|
|
|
110
109
|
```bash
|
|
111
110
|
% irb -r palletjack
|
|
112
|
-
2.3.1 :001 > jack = PalletJack.
|
|
113
|
-
2.3.1 :002 > testvm = jack.fetch('system', name:'testvm')
|
|
114
|
-
=> #<PalletJack::Pallet:148ac64>
|
|
111
|
+
2.3.1 :001 > jack = PalletJack.load('examples/warehouse')
|
|
112
|
+
2.3.1 :002 > testvm = jack.fetch(kind: 'system', name: 'testvm')
|
|
115
113
|
2.3.1 :003 > testvm['host.type']
|
|
116
114
|
=> "virtual"
|
|
117
|
-
2.3.1 :004 > jack
|
|
115
|
+
2.3.1 :004 > jack.each(kind: 'system') {|pallet| puts "#{pallet['net.dns.name']}: #{pallet['chassis.serial']}" }
|
|
118
116
|
vmhost1: 1234ABCD
|
|
119
117
|
testvm: 1234ABCD
|
|
120
|
-
|
|
121
|
-
2.3.1 :005 > jack['system', with_all:{'host.type' => 'virtual'}].each {|system| puts system['net.dns.name'] }
|
|
118
|
+
2.3.1 :005 > jack.each(kind: 'system', all?: {'host.type' => 'virtual'}) {|system| puts system['net.dns.name'] }
|
|
122
119
|
testvm
|
|
123
|
-
=> #<Set: {#<PalletJack::Pallet:148ac64>}>
|
|
124
120
|
```
|
|
125
121
|
|
|
126
122
|
## Installation
|
|
@@ -147,7 +143,7 @@ objects with standard links and YAML structures for you. Example:
|
|
|
147
143
|
|
|
148
144
|
```bash
|
|
149
145
|
$ create_domain --warehouse /tmp/warehouse --domain example.com --network 192.168.42.0/24
|
|
150
|
-
$ create_system --warehouse /tmp/warehouse --system vmhost --domain example.com --os CentOS-7.
|
|
146
|
+
$ create_system --warehouse /tmp/warehouse --system vmhost --domain example.com --os CentOS-7.3.1611-x86_64
|
|
151
147
|
$ create_ipv4_interface --warehouse /tmp/warehouse --system vmhost --domain example.com --mac 52:54:00:8d:be:fe --ipv4 192.168.42.1 --network 192.168.42.0/24
|
|
152
148
|
$ dump_pallet --warehouse /tmp/warehouse --type ipv4_interface 192.168.42.1
|
|
153
149
|
```
|
|
@@ -161,11 +157,11 @@ pallet:
|
|
|
161
157
|
ipv4_network: 192.168.42.0_24
|
|
162
158
|
domain: example.com
|
|
163
159
|
phy_nic: 52:54:00:8d:be:fe
|
|
164
|
-
os: CentOS-7.
|
|
160
|
+
os: CentOS-7.3.1611-x86_64
|
|
165
161
|
system: vmhost
|
|
166
162
|
domain: example.com
|
|
167
163
|
phy_nic: 52:54:00:8d:be:fe
|
|
168
|
-
os: CentOS-7.
|
|
164
|
+
os: CentOS-7.3.1611-x86_64
|
|
169
165
|
system: vmhost
|
|
170
166
|
ipv4_interface: 192.168.42.1
|
|
171
167
|
net:
|
|
@@ -200,12 +196,12 @@ net:
|
|
|
200
196
|
address: 52:54:00:8d:be:fe
|
|
201
197
|
host:
|
|
202
198
|
kickstart:
|
|
203
|
-
baseurl: http://mirror.centos.org/centos/7.
|
|
199
|
+
baseurl: http://mirror.centos.org/centos/7.3.1611/os/x86_64/
|
|
204
200
|
pxelinux:
|
|
205
|
-
kernel: "/boot/CentOS-7.
|
|
206
|
-
config: CentOS-7.
|
|
201
|
+
kernel: "/boot/CentOS-7.3.1611-x86_64/vmlinuz"
|
|
202
|
+
config: CentOS-7.3.1611-x86_64
|
|
207
203
|
system:
|
|
208
|
-
os: CentOS-7.
|
|
204
|
+
os: CentOS-7.3.1611-x86_64
|
|
209
205
|
role:
|
|
210
206
|
- ''
|
|
211
207
|
name: vmhost
|
|
@@ -249,6 +245,8 @@ We are happy to accept contributions in the form of issues and pull requests on
|
|
|
249
245
|
|
|
250
246
|
- Test your code.
|
|
251
247
|
|
|
248
|
+
- Code shall pass [Rubocop](https://github.com/bbatsov/rubocop) tests. See [.rubocop.yml](.rubocop.yml) for configured options. Rubocop is automaticallly run with the default Rake task.
|
|
249
|
+
|
|
252
250
|
- Tests shall be written in [RSpec](http://rspec.info/).
|
|
253
251
|
|
|
254
252
|
- Library code shall have unit tests.
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
1
|
+
require 'bundler/gem_tasks'
|
|
2
|
+
require 'rspec/core/rake_task'
|
|
3
3
|
|
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
desc 'Run Rubocop'
|
|
7
|
+
require 'rubocop'
|
|
8
|
+
require 'rubocop/rake_task'
|
|
9
|
+
RuboCop::RakeTask.new(:rubocop)
|
|
10
|
+
|
|
11
|
+
task :default => [:rubocop, :spec]
|
data/bin/console
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'palletjack'
|
|
5
5
|
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
|
@@ -10,5 +10,6 @@ require "palletjack"
|
|
|
10
10
|
# require "pry"
|
|
11
11
|
# Pry.start
|
|
12
12
|
|
|
13
|
-
require
|
|
13
|
+
require 'irb'
|
|
14
|
+
require 'irb/completion'
|
|
14
15
|
IRB.start
|
data/lib/palletjack.rb
CHANGED
|
@@ -1,94 +1,9 @@
|
|
|
1
|
-
require '
|
|
2
|
-
require '
|
|
3
|
-
require 'kvdag'
|
|
4
|
-
require 'palletjack/version'
|
|
5
|
-
require 'palletjack/keytransformer'
|
|
6
|
-
require 'palletjack/pallet'
|
|
7
|
-
require 'traceable'
|
|
8
|
-
|
|
9
|
-
class PalletJack < KVDAG
|
|
10
|
-
attr_reader :warehouse
|
|
11
|
-
|
|
12
|
-
# Create and load a PalletJack warehouse, and all its pallets
|
|
1
|
+
require 'palletjack/version.rb'
|
|
2
|
+
require 'palletjack/warehouse.rb'
|
|
13
3
|
|
|
4
|
+
# Top level namespace for all PalletJack related classes
|
|
5
|
+
module PalletJack
|
|
14
6
|
def self.load(warehouse)
|
|
15
|
-
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def initialize
|
|
19
|
-
super
|
|
20
|
-
@pallets = Hash.new
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# Load a PalletJack warehouse, and all its pallets
|
|
24
|
-
|
|
25
|
-
def load(warehouse)
|
|
26
|
-
@warehouse = File.expand_path(warehouse)
|
|
27
|
-
key_transforms = TraceableYAML::load_file(File.join(@warehouse, 'transforms.yaml'), 'transforms.yaml')
|
|
28
|
-
@keytrans_reader = KeyTransformer::Reader.new(key_transforms)
|
|
29
|
-
@keytrans_writer = KeyTransformer::Writer.new(key_transforms)
|
|
30
|
-
|
|
31
|
-
Dir.foreach(@warehouse) do |kind|
|
|
32
|
-
kindpath = File.join(@warehouse, kind)
|
|
33
|
-
next unless File.directory?(kindpath) and kind !~ /^\.{1,2}$/
|
|
34
|
-
|
|
35
|
-
Dir.foreach(kindpath) do |pallet|
|
|
36
|
-
palletpath = File.join(kindpath, pallet)
|
|
37
|
-
next unless File.directory?(palletpath) and pallet !~ /^\.{1,2}$/
|
|
38
|
-
pallet(kind, pallet)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# Apply transforms in reverse DAG order, parents before children
|
|
43
|
-
sort.reverse.each do |pallet|
|
|
44
|
-
@keytrans_writer.transform! pallet
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
self
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# Return a named pallet from the warehouse
|
|
51
|
-
#
|
|
52
|
-
# If the pallet is not yet loaded, it will be.
|
|
53
|
-
#
|
|
54
|
-
# Raises RuntimeError if the warehouse is not loaded.
|
|
55
|
-
# Raises Errno::ENOENT if the pallet can't be loaded.
|
|
56
|
-
|
|
57
|
-
def pallet(kind, name)
|
|
58
|
-
raise "warehouse is not loaded" unless @warehouse
|
|
59
|
-
|
|
60
|
-
identity = Pallet::Identity.new(self, File.join(kind, name))
|
|
61
|
-
@pallets[identity.path] ||= Pallet.load(self, identity)
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
# Search for pallets in a PalletJack warehouse
|
|
65
|
-
#
|
|
66
|
-
# The search is filtered by KVDAG::Vertex#match? expressions.
|
|
67
|
-
#
|
|
68
|
-
# Useful Pallet methods to match for include:
|
|
69
|
-
#
|
|
70
|
-
# kind:: the kind of pallet
|
|
71
|
-
# name:: the filesystem +basename+ of the pallet
|
|
72
|
-
|
|
73
|
-
def [](filter = {})
|
|
74
|
-
vertices(filter)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
# Fetch a single pallet from a PalletJack warehouse
|
|
78
|
-
#
|
|
79
|
-
# The search is filtered by KVDAG::Vertex#match? expressions.
|
|
80
|
-
#
|
|
81
|
-
# Useful Pallet methods to match for include:
|
|
82
|
-
#
|
|
83
|
-
# kind:: the kind of pallet
|
|
84
|
-
# name:: the filesystem +basename+ of the pallet
|
|
85
|
-
|
|
86
|
-
def fetch(filter = {})
|
|
87
|
-
result = self[filter]
|
|
88
|
-
|
|
89
|
-
if result.length != 1
|
|
90
|
-
raise KeyError.new("#{filter} matched #{result.length} pallets")
|
|
91
|
-
end
|
|
92
|
-
result.first
|
|
7
|
+
Warehouse.load(warehouse)
|
|
93
8
|
end
|
|
94
9
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'traceable'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
module PalletJack
|
|
4
4
|
class KeyTransformer
|
|
5
5
|
class Reader < KeyTransformer
|
|
6
6
|
def concatenate(param, context = {})
|
|
@@ -45,11 +45,11 @@ class PalletJack
|
|
|
45
45
|
# used.
|
|
46
46
|
#
|
|
47
47
|
|
|
48
|
-
def synthesize_internal(param, dictionary, result=String.new)
|
|
48
|
+
def synthesize_internal(param, dictionary, result = String.new)
|
|
49
49
|
case param
|
|
50
50
|
when String
|
|
51
|
-
rex
|
|
52
|
-
if md=rex.match(param) then
|
|
51
|
+
rex = /#\[([[:alnum:]._-]+)\]/
|
|
52
|
+
if md = rex.match(param) then
|
|
53
53
|
result << md.pre_match
|
|
54
54
|
return unless lookup = dictionary[md[1]]
|
|
55
55
|
result << lookup.to_s
|
|
@@ -109,7 +109,7 @@ class PalletJack
|
|
|
109
109
|
|
|
110
110
|
def synthesize(param, context = {})
|
|
111
111
|
return if context[:value]
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
synthesize_internal(param, context[:pallet])
|
|
114
114
|
end
|
|
115
115
|
|
|
@@ -171,20 +171,20 @@ class PalletJack
|
|
|
171
171
|
|
|
172
172
|
captures = {}
|
|
173
173
|
|
|
174
|
-
param[
|
|
174
|
+
param['sources'].each do |_, source|
|
|
175
175
|
# Trying to read values from a non-existent key. Return nil
|
|
176
176
|
# and let another transform try.
|
|
177
|
-
return unless lookup = context[:pallet][source[
|
|
177
|
+
return unless lookup = context[:pallet][source['key']]
|
|
178
178
|
|
|
179
179
|
# Save all named captures
|
|
180
|
-
Regexp.new(source[
|
|
180
|
+
Regexp.new(source['regexp']).match(lookup) do |md|
|
|
181
181
|
md.names.each do |name|
|
|
182
182
|
captures[name] = md[name.to_sym]
|
|
183
183
|
end
|
|
184
184
|
end
|
|
185
185
|
end
|
|
186
186
|
|
|
187
|
-
synthesize_internal(param[
|
|
187
|
+
synthesize_internal(param['produce'], captures)
|
|
188
188
|
end
|
|
189
189
|
|
|
190
190
|
# Synthesized value will override an inherited value for a
|
|
@@ -203,7 +203,7 @@ class PalletJack
|
|
|
203
203
|
end
|
|
204
204
|
end
|
|
205
205
|
|
|
206
|
-
def initialize(key_transforms={})
|
|
206
|
+
def initialize(key_transforms = {})
|
|
207
207
|
@key_transforms = key_transforms
|
|
208
208
|
end
|
|
209
209
|
|
|
@@ -236,7 +236,6 @@ class PalletJack
|
|
|
236
236
|
|
|
237
237
|
def transform!(pallet)
|
|
238
238
|
@key_transforms.each do |keytrans_item|
|
|
239
|
-
|
|
240
239
|
# Enable early termination of transforms for a key
|
|
241
240
|
# by wrapping execution in a catch block.
|
|
242
241
|
catch do |abort_tag|
|
data/lib/palletjack/pallet.rb
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
require 'palletjack/pallet/identity'
|
|
2
2
|
require 'traceable'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
module PalletJack
|
|
5
5
|
# PalletJack managed pallet of key boxes inside a warehouse.
|
|
6
6
|
class Pallet < KVDAG::Vertex
|
|
7
|
-
|
|
8
7
|
# N.B: A pallet should never be loaded manually; use
|
|
9
8
|
# +PalletJack.load+ to initialize a complete warehouse.
|
|
10
9
|
#
|
|
@@ -47,19 +46,19 @@ class PalletJack < KVDAG
|
|
|
47
46
|
link_id = Identity.new(jack, File.expand_path(link, path))
|
|
48
47
|
|
|
49
48
|
pallet = jack.pallet(link_id.kind, link_id.full_name)
|
|
50
|
-
edge(pallet, pallet:{references:{file => link_id.full_name}})
|
|
49
|
+
edge(pallet, pallet: {references: {file => link_id.full_name}})
|
|
51
50
|
when filestat.directory?
|
|
52
51
|
child = jack.pallet(kind, File.join(name, file))
|
|
53
|
-
child.edge(self, pallet:{references:{_parent: full_name}})
|
|
52
|
+
child.edge(self, pallet: {references: {_parent: full_name}})
|
|
54
53
|
end
|
|
55
54
|
end
|
|
56
|
-
merge!(pallet:{kind => name, boxes: boxes})
|
|
55
|
+
merge!(pallet: {kind => name, boxes: boxes})
|
|
57
56
|
|
|
58
57
|
self
|
|
59
58
|
end
|
|
60
59
|
|
|
61
60
|
def inspect
|
|
62
|
-
|
|
61
|
+
'#<%s:%x>' % [self.class, self.object_id, @path]
|
|
63
62
|
end
|
|
64
63
|
|
|
65
64
|
# Override standard to_yaml serialization, because pallet objects
|
data/lib/palletjack/tool.rb
CHANGED
|
@@ -4,8 +4,7 @@ require 'optparse'
|
|
|
4
4
|
require 'singleton'
|
|
5
5
|
require 'rugged'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
module PalletJack
|
|
9
8
|
# Superclass for PalletJack tool implementations
|
|
10
9
|
#
|
|
11
10
|
# Provides convenience methods for option parsing, file generation,
|
|
@@ -240,7 +239,7 @@ class PalletJack
|
|
|
240
239
|
# | `-- somecfg.yaml
|
|
241
240
|
|
|
242
241
|
def config
|
|
243
|
-
@config ||= jack.fetch(kind:'_config',
|
|
242
|
+
@config ||= jack.fetch(kind: '_config',
|
|
244
243
|
name: self.class.to_s) rescue Hash.new
|
|
245
244
|
end
|
|
246
245
|
|
|
@@ -315,7 +314,7 @@ class PalletJack
|
|
|
315
314
|
# file << system.to_yaml
|
|
316
315
|
# end
|
|
317
316
|
|
|
318
|
-
def config_file(*path, mode:0644, &block)
|
|
317
|
+
def config_file(*path, mode: 0644, &block)
|
|
319
318
|
File.open(config_path(*path),
|
|
320
319
|
File::CREAT | File::TRUNC | File::WRONLY, mode) do |file|
|
|
321
320
|
block.call(file)
|
|
@@ -377,7 +376,7 @@ class PalletJack
|
|
|
377
376
|
#
|
|
378
377
|
# pallet_links 'system', :system, 'os'=>['os', :os], 'netinstall'=>[]
|
|
379
378
|
|
|
380
|
-
def pallet_links(kind, name, links={})
|
|
379
|
+
def pallet_links(kind, name, links = {})
|
|
381
380
|
links.each do |link_type, parent|
|
|
382
381
|
link_path = config_path(:warehouse, kind, name, link_type)
|
|
383
382
|
|
data/lib/palletjack/version.rb
CHANGED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
require 'active_support'
|
|
2
|
+
require 'yaml'
|
|
3
|
+
require 'kvdag'
|
|
4
|
+
require 'palletjack/keytransformer'
|
|
5
|
+
require 'palletjack/pallet'
|
|
6
|
+
require 'traceable'
|
|
7
|
+
|
|
8
|
+
module PalletJack
|
|
9
|
+
# A PalletJack managed warehouse of pallets
|
|
10
|
+
class Warehouse < KVDAG
|
|
11
|
+
attr_reader :warehouse
|
|
12
|
+
|
|
13
|
+
# Create and load a PalletJack warehouse, and all its pallets
|
|
14
|
+
|
|
15
|
+
def self.load(warehouse)
|
|
16
|
+
new.load(warehouse)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def initialize
|
|
20
|
+
super
|
|
21
|
+
@pallets = {}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Load a PalletJack warehouse, and all its pallets
|
|
25
|
+
|
|
26
|
+
def load(warehouse)
|
|
27
|
+
@warehouse = File.expand_path(warehouse)
|
|
28
|
+
key_transforms = TraceableYAML.load_file(File.join(@warehouse, 'transforms.yaml'), 'transforms.yaml')
|
|
29
|
+
@keytrans_reader = KeyTransformer::Reader.new(key_transforms)
|
|
30
|
+
@keytrans_writer = KeyTransformer::Writer.new(key_transforms)
|
|
31
|
+
|
|
32
|
+
Dir.foreach(@warehouse) do |kind|
|
|
33
|
+
kindpath = File.join(@warehouse, kind)
|
|
34
|
+
next unless File.directory?(kindpath) && kind !~ /^\.{1,2}$/
|
|
35
|
+
|
|
36
|
+
Dir.foreach(kindpath) do |pallet|
|
|
37
|
+
palletpath = File.join(kindpath, pallet)
|
|
38
|
+
next unless File.directory?(palletpath) && pallet !~ /^\.{1,2}$/
|
|
39
|
+
pallet(kind, pallet)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Apply transforms in reverse DAG order, parents before children
|
|
44
|
+
sort.reverse.each do |pallet|
|
|
45
|
+
@keytrans_writer.transform! pallet
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
self
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Return a named pallet from the warehouse
|
|
52
|
+
#
|
|
53
|
+
# If the pallet is not yet loaded, it will be.
|
|
54
|
+
#
|
|
55
|
+
# Raises RuntimeError if the warehouse is not loaded.
|
|
56
|
+
# Raises Errno::ENOENT if the pallet can't be loaded.
|
|
57
|
+
|
|
58
|
+
def pallet(kind, name)
|
|
59
|
+
raise 'warehouse is not loaded' unless @warehouse
|
|
60
|
+
|
|
61
|
+
identity = Pallet::Identity.new(self, File.join(kind, name))
|
|
62
|
+
@pallets[identity.path] ||= Pallet.load(self, identity)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Search for pallets in a PalletJack warehouse
|
|
66
|
+
#
|
|
67
|
+
# The search is filtered by KVDAG::Vertex#match? expressions.
|
|
68
|
+
#
|
|
69
|
+
# Useful Pallet methods to match for include:
|
|
70
|
+
#
|
|
71
|
+
# kind:: the kind of pallet
|
|
72
|
+
# name:: the filesystem +basename+ of the pallet
|
|
73
|
+
|
|
74
|
+
def [](filter = {})
|
|
75
|
+
vertices(filter)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Fetch a single pallet from a PalletJack warehouse
|
|
79
|
+
#
|
|
80
|
+
# The search is filtered by KVDAG::Vertex#match? expressions.
|
|
81
|
+
#
|
|
82
|
+
# Useful Pallet methods to match for include:
|
|
83
|
+
#
|
|
84
|
+
# kind:: the kind of pallet
|
|
85
|
+
# name:: the filesystem +basename+ of the pallet
|
|
86
|
+
|
|
87
|
+
def fetch(filter = {})
|
|
88
|
+
result = self[filter]
|
|
89
|
+
|
|
90
|
+
if result.length != 1
|
|
91
|
+
raise KeyError.new("#{filter} matched #{result.length} pallets")
|
|
92
|
+
end
|
|
93
|
+
result.first
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
data/lib/traceable.rb
CHANGED
|
@@ -90,7 +90,7 @@ class TraceableString < String
|
|
|
90
90
|
|
|
91
91
|
def inspect
|
|
92
92
|
if debug?
|
|
93
|
-
"
|
|
93
|
+
'"%s" (%s, line: %i, col: %i, byte: %i)' %
|
|
94
94
|
[self.to_str, @file, @line, @column, @byte]
|
|
95
95
|
else
|
|
96
96
|
super
|
|
@@ -119,7 +119,6 @@ end
|
|
|
119
119
|
|
|
120
120
|
# Extend the parser to remember the position of each object.
|
|
121
121
|
class PositionHandler < Psych::TreeBuilder
|
|
122
|
-
|
|
123
122
|
# The handler needs access to the parser in order to call mark
|
|
124
123
|
attr_accessor :parser
|
|
125
124
|
|
|
@@ -157,7 +156,6 @@ end
|
|
|
157
156
|
|
|
158
157
|
# Extend the Ruby structure builder to remeber each object's position.
|
|
159
158
|
class PositionVisitor < Psych::Visitors::ToRuby
|
|
160
|
-
|
|
161
159
|
# Copy a parser position from a parse tree node to a primitive
|
|
162
160
|
# object.
|
|
163
161
|
def record_position(s, o)
|
|
@@ -169,6 +167,7 @@ class PositionVisitor < Psych::Visitors::ToRuby
|
|
|
169
167
|
s
|
|
170
168
|
end
|
|
171
169
|
|
|
170
|
+
# rubocop:disable Style/MethodName
|
|
172
171
|
def visit_Psych_Nodes_Scalar o
|
|
173
172
|
# Primitive YAML values can be either strings or integers. Ruby
|
|
174
173
|
# integers cannot be extended, so convert everything to strings
|
|
@@ -183,10 +182,10 @@ class PositionVisitor < Psych::Visitors::ToRuby
|
|
|
183
182
|
def visit_Psych_Nodes_Mapping o
|
|
184
183
|
record_position(super, o)
|
|
185
184
|
end
|
|
185
|
+
# rubocop:enable Style/MethodName
|
|
186
186
|
end
|
|
187
187
|
|
|
188
188
|
module TraceableYAML
|
|
189
|
-
|
|
190
189
|
# Parse a YAML document from the string +doc+, tagging each value
|
|
191
190
|
# with the source +tag+, and return a Ruby object tree representing
|
|
192
191
|
# the result.
|
data/palletjack.gemspec
CHANGED
|
@@ -7,19 +7,19 @@ require 'palletjack/version'
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = 'palletjack'
|
|
9
9
|
spec.version = PalletJack::VERSION
|
|
10
|
-
spec.authors = [
|
|
11
|
-
spec.email = [
|
|
10
|
+
spec.authors = ['Calle Englund']
|
|
11
|
+
spec.email = ['calle.englund@saabgroup.com']
|
|
12
12
|
spec.summary = 'Lightweight Configuration Management Database'
|
|
13
13
|
spec.description = spec.summary
|
|
14
14
|
spec.homepage = 'https://github.com/saab-simc-admin/palletjack'
|
|
15
15
|
spec.license = 'MIT'
|
|
16
16
|
|
|
17
|
-
spec.files
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
18
18
|
f.match(%r{^(test|spec|features|examples|tools)/})
|
|
19
19
|
end
|
|
20
|
-
spec.bindir =
|
|
20
|
+
spec.bindir = 'exe'
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
|
-
spec.require_paths = [
|
|
22
|
+
spec.require_paths = ['lib']
|
|
23
23
|
|
|
24
24
|
spec.platform = Gem::Platform::RUBY
|
|
25
25
|
spec.required_ruby_version = '~>2'
|
|
@@ -28,11 +28,12 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
spec.add_runtime_dependency 'rugged', '~> 0.24'
|
|
29
29
|
spec.add_runtime_dependency 'kvdag', '~> 0.1.4'
|
|
30
30
|
|
|
31
|
-
spec.add_development_dependency
|
|
32
|
-
spec.add_development_dependency
|
|
33
|
-
spec.add_development_dependency
|
|
34
|
-
spec.add_development_dependency
|
|
35
|
-
spec.add_development_dependency
|
|
31
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
|
32
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
34
|
+
spec.add_development_dependency 'rspec_structure_matcher', '~> 0.0.6'
|
|
35
|
+
spec.add_development_dependency 'rspec-collection_matchers', '~> 1.1.2'
|
|
36
|
+
spec.add_development_dependency 'rubocop', '~> 0.46'
|
|
36
37
|
|
|
37
38
|
spec.has_rdoc = true
|
|
38
39
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: palletjack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Calle Englund
|
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
|
31
31
|
f8wtQllq82VF0AXUYeLtTh1f+DW3WW5BO1e2OCu5eOV7dbyaVPaNK/+rHjCN8kM/
|
|
32
32
|
DGZSwUoNADmVkQ==
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date:
|
|
34
|
+
date: 2017-01-30 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: activesupport
|
|
@@ -145,6 +145,20 @@ dependencies:
|
|
|
145
145
|
- - ~>
|
|
146
146
|
- !ruby/object:Gem::Version
|
|
147
147
|
version: 1.1.2
|
|
148
|
+
- !ruby/object:Gem::Dependency
|
|
149
|
+
name: rubocop
|
|
150
|
+
requirement: !ruby/object:Gem::Requirement
|
|
151
|
+
requirements:
|
|
152
|
+
- - ~>
|
|
153
|
+
- !ruby/object:Gem::Version
|
|
154
|
+
version: '0.46'
|
|
155
|
+
type: :development
|
|
156
|
+
prerelease: false
|
|
157
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
158
|
+
requirements:
|
|
159
|
+
- - ~>
|
|
160
|
+
- !ruby/object:Gem::Version
|
|
161
|
+
version: '0.46'
|
|
148
162
|
description: Lightweight Configuration Management Database
|
|
149
163
|
email:
|
|
150
164
|
- calle.englund@saabgroup.com
|
|
@@ -153,6 +167,8 @@ extensions: []
|
|
|
153
167
|
extra_rdoc_files: []
|
|
154
168
|
files:
|
|
155
169
|
- .gitignore
|
|
170
|
+
- .rubocop.yml
|
|
171
|
+
- .rubocop_todo.yml
|
|
156
172
|
- Gemfile
|
|
157
173
|
- LICENSE
|
|
158
174
|
- README.md
|
|
@@ -165,6 +181,7 @@ files:
|
|
|
165
181
|
- lib/palletjack/pallet/identity.rb
|
|
166
182
|
- lib/palletjack/tool.rb
|
|
167
183
|
- lib/palletjack/version.rb
|
|
184
|
+
- lib/palletjack/warehouse.rb
|
|
168
185
|
- lib/traceable.rb
|
|
169
186
|
- palletjack.gemspec
|
|
170
187
|
homepage: https://github.com/saab-simc-admin/palletjack
|
|
@@ -187,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
187
204
|
version: '0'
|
|
188
205
|
requirements: []
|
|
189
206
|
rubyforge_project:
|
|
190
|
-
rubygems_version: 2.0.14
|
|
207
|
+
rubygems_version: 2.0.14.1
|
|
191
208
|
signing_key:
|
|
192
209
|
specification_version: 4
|
|
193
210
|
summary: Lightweight Configuration Management Database
|
metadata.gz.sig
CHANGED
|
Binary file
|