use common schematic/layout revision number

This commit is contained in:
King Kévin 2017-11-30 17:26:13 +01:00
parent 4c3e594085
commit 661d5586aa
1 changed files with 11 additions and 6 deletions

View File

@ -33,10 +33,15 @@ names.each do |name|
sch = "#{name}.sch"
# pcb layout
pcb = "#{name}.pcb"
# schematic revision, based on the number of schematic commits
sch_rev = `git log --pretty=oneline "#{sch}" | wc -l`.chomp.to_i
# pcb layout revision, based on the number of pcb commits
pcb_rev = `git log --pretty=oneline "#{pcb}" | wc -l`.chomp.to_i
# get common schematic/layout revision number, based on the total number of commits
# this means the layout revision number can increment although only the schematic has been modified (and vice versa), but this is more convenient to have synched revision numbers
rev = `git log --pretty=oneline "#{sch}" "#{pcb}" | wc -l`.chomp.to_i
sch_rev = rev
pcb_rev = rev
# get schematic and layout revision numbers, based on the respective number of commits
# this allows to have independent number in case an edit in one does not affect the other, but you need to keep track of which revision numbers correspond
#sch_rev = `git log --pretty=oneline "#{sch}" | wc -l`.chomp.to_i
#pcb_rev = `git log --pretty=oneline "#{pcb}" | wc -l`.chomp.to_i
# schema name with version and revision
vsch = "#{name}_v#{version}.#{sch_rev.to_s.rjust(3,'0')}.sch"
# pcb layout name with version and revision
@ -319,8 +324,8 @@ end
desc "generate printable documentation (PDF) from layout"
targets.each do |target|
file "#{target[:name]}_layout.pdf" => target[:vpcb] do |t|
sh "pcb -x ps --psfile #{t.name}.ps #{t.prerequisites.join(' ')} 2> /dev/null"
sh "ps2pdf #{t.name}.ps #{t.name} 2> /dev/null"
sh "pcb -x ps --media A4 --psfile #{t.name}.ps #{t.prerequisites.join(' ')} 2> /dev/null"
sh "ps2pdf -sPAPERSIZE=a4 #{t.name}.ps #{t.name} 2> /dev/null"
sh "rm #{t.name}.ps 2> /dev/null"
end
end