33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/bosh/director/manifest/diff_lines.rb', line 33
def order
sections = {}
key = nil
self.each do |line|
if line.indent == 0 && line.text !~ /^[ -]/
key = line.text
sections[key] = []
sections[key] << Line.new(0, '', nil)
end
sections[key] << line
end
ordered_lines = []
MANIFEST_KEYS_ORDER.each do |manifest_key|
section_name = manifest_key + ':'
lines = sections[section_name]
ordered_lines += lines.to_a
sections.delete(section_name)
end
sections.each do |_, section_lines|
section_lines.each do |line|
ordered_lines << line
end
end
ordered_lines.shift
self.replace(ordered_lines)
end
|