16 lines
538 B
Ruby
Executable File
16 lines
538 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
# encoding: utf-8
|
|
|
|
ORIGINAL_PATH = "usb_hub-dfp1.sch"
|
|
ORIGINAL_FILE = IO.read(ORIGINAL_PATH)
|
|
(2..7).to_a.each do |number|
|
|
output = ORIGINAL_FILE.dup
|
|
output.gsub!(/netname=(.*)1/, "netname=" + '\1' + number.to_s)
|
|
output.gsub!(/refdes=(.*)10/, "refdes=" + '\1' + number.to_s + "0")
|
|
output.gsub!(/ - DFP1/, " - DFP#{number}")
|
|
output.gsub!(/USB2517_part-2-8-DFP1/, "USB2517_part-#{number + 1}-8-DFP#{number}")
|
|
File.open("#{ORIGINAL_PATH.gsub('1', number.to_s)}", "w") do |file|
|
|
file.write output
|
|
end
|
|
end
|