Skip to content

Commit f969969

Browse files
committed
ruby formatting under powershell/BOSH.Sysprep
1 parent 1737838 commit f969969

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

modules/BOSH.Sysprep/print_conflicted_from_audit_csv.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def uniq()
2626
values = x.split(',')
2727
keys = values[0..5].join('').downcase
2828
setting_value = values[6]
29-
keys+setting_value
29+
keys + setting_value
3030
end
3131

3232
AuditFile.new(header, uniqed)
@@ -63,13 +63,13 @@ def merge(a, b)
6363
policy_target + ',' + subcategory
6464
end
6565

66-
dups = grouped.keys.select {|k| grouped[k].size > 1}
66+
dups = grouped.keys.select { |k| grouped[k].size > 1 }
6767

68-
if(dups.nil?)
68+
if dups.nil?
6969
puts "found 0 conflicts"
7070
else
7171
puts "found #{dups.size} conflicts"
72-
dups.each {|x| puts x}
72+
dups.each { |x| puts x }
7373
end
7474

7575
merged_file = "audit-merged.csv"

modules/BOSH.Sysprep/print_conflicted_keys_from_inf_txt.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ def self.from_string_array(sections)
2525
end
2626
end
2727

28-
def uniq()
28+
def uniq
2929
trim_contents = contents.map { |x| x.strip }
30-
Inf.new(name, trim_contents.uniq {|text| text.split('=')[0].downcase + text.split('=')[1..-1].join('')})
30+
Inf.new(name, trim_contents.uniq { |text| text.split('=')[0].downcase + text.split('=')[1..-1].join('') })
3131
end
3232

33-
def sort()
33+
def sort
3434
Inf.new(name, contents.sort)
3535
end
3636

37-
def size()
37+
def size
3838
@contents.size
3939
end
4040

41-
def summary()
41+
def summary
4242
"section: #{@name} size: #{size}"
4343
end
4444
end
@@ -55,16 +55,16 @@ def convert_to_utf8(name)
5555
end
5656

5757
def merge(a, b)
58-
a_no_comment = a.split("\r\n").reject {|x| x.strip.gsub(/^;.*/,'').empty?}.join("\r\n").strip
59-
b_no_comment = b.split("\r\n").reject {|x| x.strip.gsub(/^;.*/,'').empty?}.join("\r\n").strip
58+
a_no_comment = a.split("\r\n").reject { |x| x.strip.gsub(/^;.*/, '').empty? }.join("\r\n").strip
59+
b_no_comment = b.split("\r\n").reject { |x| x.strip.gsub(/^;.*/, '').empty? }.join("\r\n").strip
6060

6161
a_normalize_equals = a_no_comment.gsub(' = ', '=').gsub(" =\r\n", "=\r\n")
6262
b_normalize_equals = b_no_comment.gsub(' = ', '=').gsub(" =\r\n", "=\r\n")
6363

6464
a_infs = Infs.from_string(a_normalize_equals)
6565
b_infs = Infs.from_string(b_normalize_equals)
6666

67-
(a_infs + b_infs).group_by {|x| x.name}.map {|section_name,infs| Inf.new(section_name, infs.map{|x| x.contents}.flatten)}
67+
(a_infs + b_infs).group_by { |x| x.name }.map { |section_name, infs| Inf.new(section_name, infs.map { |x| x.contents }.flatten) }
6868
end
6969

7070
a_contents = convert_to_utf8('GptTmpl-ms-baseline.inf')
@@ -92,17 +92,17 @@ def merge(a, b)
9292
elements = section.contents
9393
title = section.name
9494

95-
grouped = elements.group_by {|x| x.split("=")[0]}
96-
dups = grouped.keys.select {|k| grouped[k].size > 1}
95+
grouped = elements.group_by { |x| x.split("=")[0] }
96+
dups = grouped.keys.select { |k| grouped[k].size > 1 }
9797

98-
if(dups.nil?)
98+
if dups.nil?
9999
puts "found 0 conflicts in section #{title}"
100100
else
101101
puts "found #{dups.size} conflicts in section #{title}"
102-
dups.each {|x| puts x}
102+
dups.each { |x| puts x }
103103
end
104104
end
105105

106106
new_file = 'GptTmpl-merged.inf'
107-
File.write new_file, sorted.map{|section| section.name + "\n" + section.contents.join("\n")}.join("\n")
107+
File.write new_file, sorted.map { |section| section.name + "\n" + section.contents.join("\n") }.join("\n")
108108
puts "merged files with uniques removed outputted to #{new_file}"

modules/BOSH.Sysprep/print_conflicted_registry_keys_from_pol_txt.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ def convert_to_utf8(name)
66
end
77

88
def merge(a, b)
9-
a_no_comment = a.split("\r\n").reject {|x| x[0] == ';' }.join("\r\n").strip
10-
b_no_comment = b.split("\r\n").reject {|x| x[0] == ';' }.join("\r\n").strip
9+
a_no_comment = a.split("\r\n").reject { |x| x[0] == ';' }.join("\r\n").strip
10+
b_no_comment = b.split("\r\n").reject { |x| x[0] == ';' }.join("\r\n").strip
1111
a_no_comment.strip + "\r\n\r\n" + b_no_comment.strip
1212
end
1313

@@ -27,14 +27,14 @@ def merge(a, b)
2727
end
2828
puts "after uniq: #{after_uniq.size}"
2929

30-
library = after_uniq.group_by {|x| x.split("\r\n")[1..2].join('\\')}
31-
dups = library.keys.select {|k| library[k].size > 1}
30+
library = after_uniq.group_by { |x| x.split("\r\n")[1..2].join('\\') }
31+
dups = library.keys.select { |k| library[k].size > 1 }
3232

33-
if(dups.nil?)
34-
puts "found 0 conflicts"
33+
if dups.nil?
34+
puts "found 0 conflicts"
3535
else
36-
puts "found #{dups.size} conflicts"
37-
dups.each {|x| puts x}
36+
puts "found #{dups.size} conflicts"
37+
dups.each { |x| puts x }
3838
end
3939

4040
merged_file = "registry-merged.txt"

0 commit comments

Comments
 (0)